{"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01120.cpp", "upstream_id": "BenchmarkTest01120", "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 _cmd = std::string(\"grep \") + data + \" /var/log/app.log\";\n FILE *_p = popen(_cmd.c_str(), \"r\");\n if (_p) pclose(_p);\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ad6e9ce41a0ff4f37fad2ab7982c08bbdc0d228156a66bfbf57893c179e58fc", "structural_hash": "f134ce4c5cb12aade16baf8a2fd7a6b7aaa4f96021b24c43250755d5ecd192af", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02843.ts", "upstream_id": "BenchmarkTest02843", "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 _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e6f5249f9a2345151a7c9880d875df5cdce68126dc1639e6f9832aa0cc6691d", "structural_hash": "4fb255dd2828bb65c7d980228831fa8211647851145c5a60387006c4f4fe44fe", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04996.py", "upstream_id": "BenchmarkTest04996", "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 multipart_value = (await request.form()).get('multipart_field', '')\n data = '%s' % str(multipart_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 if re.search('[a-zA-Z0-9_-]+', str(processed)):\n return JSONResponse({'validated': str(processed)}, status_code=200)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4ab2e3a718cccc81ace48c0700fcc96b6413a46fdc777aad71945d0be679e44", "structural_hash": "547684f3711b19cbc43e917146b480af17ef2ea4222b2b6e75db0b197cd2f565", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_31515.go", "upstream_id": "BenchmarkTest31515", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\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\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\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Redirect(302, \"/dashboard?hidden_field=\"+url.QueryEscape(processed))\n}", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19918f5a7c39c843d8f1c62d3b19c43f152fd219c3538853cdc44cd736a7e558", "structural_hash": "10d290d2f5ca92622f6eb0329995b97d2260fac7e8f85dab04bc1d6d542abe71", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04972.ts", "upstream_id": "BenchmarkTest04972", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } 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 _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5a0992a01c914ec657960ef12e90751ef506f8db13b4bc9f29ad92012600bdf", "structural_hash": "95a067fe99b7a6bbd743f856f9e19d1eafc6fc3c1fb26a5b2714826987d8303c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04378.php", "upstream_id": "BenchmarkTest04378", "language": "php", "code": "name;\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n eval((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8280da9e438f7d1002cf47c50c7d312c6668ab6dc41e03b39d05b8f861bd8e38", "structural_hash": "1ab45bc9fa12b62918db10535aad95e5329f51af4bd5f54a5df7fff4a867cfe2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22971.sh", "upstream_id": "BenchmarkTest22971", "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 xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74ddc60baeebce957e48cd6b08c9a5998eb2d9a8a0769fff45a8bc3ad99125ad", "structural_hash": "2e741871e82e97be877e1a49c80edaab7cfd7fbb865fb4be07e30f9f7dada47e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01381.rs", "upstream_id": "BenchmarkTest01381", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 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 Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edd1f432d838235231f71d654a0ceeeecbf4d4e834f51fe2a494930b7e66a0c1", "structural_hash": "37cfcf90bdc6bc3b8b320e2917dffce41af30062f6559eb4910cc72bf9c598a8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03906.rb", "upstream_id": "BenchmarkTest03906", "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 system(\"echo \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8c5325449deace5297c7ffea03874cb0ead4124c182042c80c99546e23d23ff", "structural_hash": "6bd8d7231fdd76b514499ab62055a6e0b00b50e7e71cb3d84132e38b698e0535", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03966.rs", "upstream_id": "BenchmarkTest03966", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 _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 Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04cc68697a010442406d07eb9efd08566cd7a3bda21c2cc56697b8378479211f", "structural_hash": "0b5b1d4197ec7f62ba8512d3bf641b828035ca6cfb2b096d7686454d6422d55a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04472.py", "upstream_id": "BenchmarkTest04472", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom urllib.parse import urlparse\nfrom fastapi import Form\nfrom starlette.responses import JSONResponse\nimport socket\ndef to_text(value):\n return str(value).strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n data = to_text(field_value)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JSONResponse({'error': 'forbidden host'}, status_code=403)\n target_url = data\n s = socket.create_connection((str(target_url), 80))\n s.close()\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4e33e9b913240ed11eaccf689856fb4245d68a594cdf0da25924d48ec1789e2", "structural_hash": "b0bda19e31925a51ccb9a21707c8e8e144b05a345de442374fe620e364bd7690", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00165.ts", "upstream_id": "BenchmarkTest00165", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } 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 _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "054dcf904187b73da8594557d08ecf4915bf135ca9d641e7b6f4f58a475bad1f", "structural_hash": "58e333dbfb4049192ce34057a7cd6d6f8ec260c21553a81412647b1911023154", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04085.rb", "upstream_id": "BenchmarkTest04085", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\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 _body = URI.open(data).read\n DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "000c02854cf030c13caeee48c8cfc6fa343c328cda61ae4cdc5b489e75d1e480", "structural_hash": "deb7799b9d25b676b681d659d77f742477a12d5a5b383ef2fc2269f8d70aa069", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04610.rs", "upstream_id": "BenchmarkTest04610", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 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 Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9610a8e876c5c1ab3dfc0925c6c13e4ae74c19cfca39bdcafe901eb3c93f402b", "structural_hash": "9d7250c8df89d58432d012f3995aa1db700d2031154bcad7c75b537c3eee3bf6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05291.rs", "upstream_id": "BenchmarkTest05291", "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 (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 if ![\".jpg\", \".png\", \".gif\", \".pdf\"].iter().any(|ext| data.to_lowercase().ends_with(ext)) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let entry_file = data.clone();\n tokio::fs::write(format!(\"/var/uploads/{}\", entry_file), b\"data\").await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4e2440e3c1d9a319067f1d9dc3b6301f9a86814c6cc9cca813b24ef871df8f3", "structural_hash": "99a7122fb391eb681a7bda67cac15dfd9924a851ec5fb5df566d899a3ab9f3fb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03322.java", "upstream_id": "BenchmarkTest03322", "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.join(\" \", rawData.split(\"[ \\\\t]+\"));\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d354680168316ba33e93c1c7769bc146bf2c43303cb52fe71d8892f1eafc2be", "structural_hash": "1c9890878150c68360dfa9f131832b674ae5b92567040d06473a4c05b6990c87", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01151.c", "upstream_id": "BenchmarkTest01151", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 snprintf(data, sizeof(data), \"%s\", user_input);\n if (strcmp(data, \"hunter2_default_pw\") == 0) { printf(\"auth ok\\n\"); }\n}", "label": 1, "cwe": ["CWE-259"], "category": "password_in_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "024bdbc57c9d9fc26ad970e130dd49400de0f3dce827602a2e99ba7511b61727", "structural_hash": "0fc1c02a43e1a6acf3d78cc1ccec143c454810ef81646cd452820e1c2f2cf98f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02566.rs", "upstream_id": "BenchmarkTest02566", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse shell_escape;\nuse tokio::process::Command;\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 _prefix: String = graphql_var.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => graphql_var.to_lowercase(),\n \"f\" => graphql_var.to_uppercase(),\n _ => graphql_var.trim().to_string(),\n };\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 Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91925a4e3a8278d6d01034515a31656eee9c8eedc44da3e60b51586b2d848a11", "structural_hash": "1703b089ee808e1322fe0531e9d22e52fb3cfd5b7a7dd5bc3a448721921b4544", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01271.sh", "upstream_id": "BenchmarkTest01271", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\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 xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9861619c45af739d95ed092cd3607cab93dcaac2f2deb0055a20120c31c02fbd", "structural_hash": "96b477324975baad056df847d1ba98201f0b68ecf403089cf0c66e6354b9971e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_41079.js", "upstream_id": "BenchmarkTest41079", "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 const result = 100n / BigInt(parseInt(data, 10) || 0);\n res.json({ quotient: String(result) }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-369"], "category": "divide_by_zero", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c77b05fcddd50e5c9a6cae52df18764fb1919f58794dda585d48efc3d7ea35d4", "structural_hash": "9f95de2c586c2d705ccc6e4bf594af428f018ce8082d6c4f3484c4e935d09a10", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03216.ts", "upstream_id": "BenchmarkTest03216", "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 capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f1bdce955a3dc36d51fe05693fb266a52ce92e47c3d6721adfa1e3da06ad2a3", "structural_hash": "9bcc6400a4c514a7bb078d71d101eed3c4982274e9b3270665622e509bb38add", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03128.cpp", "upstream_id": "BenchmarkTest03128", "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 long _n = std::strtol(data.c_str(), nullptr, 10);\n char *_buf = new (std::nothrow) char[(size_t)_n];\n delete[] _buf;\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44042c6f0f5554f662ff31a433a59c6c81e809053e0dcbf8f4d264376e852793", "structural_hash": "40c26af18eeec2fdf202e6afd7144ba367f8c78a149b7339e82f3b2b8d2486c2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04952.rs", "upstream_id": "BenchmarkTest04952", "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 data = if referer_value.len() <= 4096 { referer_value.clone() } else { referer_value.chars().take(4096).collect() };\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d5896233e22f0d313e934a497854d89a4382faf03c4047e95d604e0f7c7c79c", "structural_hash": "3cac253d57a0d9de7bdd10f9641c40a3e8356910ea9074018c575565dab7355b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05276.py", "upstream_id": "BenchmarkTest05276", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef to_text(value):\n return str(value).strip()\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n data = to_text(graphql_var)\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:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d881cecf83d1f991086bb90524f8d57835f08b1cafcae57235f77972543c949a", "structural_hash": "2dbc6df16fe0d464c0a7b28431348df7134d8610194c30d2180d0ca654704729", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11964.js", "upstream_id": "BenchmarkTest11964", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const data = `${userInput}`;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f573440e2eaea372becdede299eff975c4dfe2027a484661b08705de7426871", "structural_hash": "94a482a71d83dc7fd95b5695ae6ae17deca272d6fb82d1f50a11185ecc805c6f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04048.go", "upstream_id": "BenchmarkTest04048", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"go.mongodb.org/mongo-driver/bson\"\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\tsegments := strings.Split(dbValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tvar mongoFilter bson.M\n\tjson.Unmarshal([]byte(data), &mongoFilter)\n\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), mongoFilter)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "399632221d6f285674aba09445e762251aede29a7b01bfa6645af95c9bef1a74", "structural_hash": "925ea9cf06993368d3e84f05459497c6b348dac25d81f9dd9c7c1912280ae597", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05947.php", "upstream_id": "BenchmarkTest05947", "language": "php", "code": "cookie('session_token', '');\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!in_array((string)$data, ['ls', 'cat', 'date', 'whoami'], true)) { return response()->json(['error' => 'forbidden'], 403); }\n $allowedBin = (string)$data;\n exec('echo ' . (string)$allowedBin);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b849b3c020b9c28f7d7a4521bba3bd698a0d8df2ca8570c3970fc6f91667486", "structural_hash": "89b02c28654c0e9025d1f93d39662f9ec2ee398380525996f6b0a2624f29b9f5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02156.ts", "upstream_id": "BenchmarkTest02156", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } 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 tokens = String(userInput).split(',');\n const data = tokens.join(',');\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1bb66ccca46c73abd6b45d2800514c9faca3c633ba5f19513ae0413561527b98", "structural_hash": "c3fdd4f0b1d37c6424334eabf273ed8a4782002b4a31b960f79141c4a5b6aa46", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02611.rs", "upstream_id": "BenchmarkTest02611", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f162420a12cf9800e309504fecef14d50d745e363bcdffe4f2c10bfbc046721", "structural_hash": "a9d6c725d48851433d1556264276c711ce91a2048663fd73b12c33343cd75a8f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25094.js", "upstream_id": "BenchmarkTest25094", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nconst 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 childProcess.execSync(\"echo \" + data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0faad595235814f8974d2407806c7d50415dbbb790470cc532baaf38b52f82bc", "structural_hash": "c3908fcb8d2f191fe624c81cd7d5f26942dbfde633d712d4fbfdc86081254e99", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01612.rs", "upstream_id": "BenchmarkTest01612", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse shell_escape;\nuse tokio::process::Command;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let raw_body = String::from_utf8_lossy(&body).to_string();\n let processed = shell_escape::escape(std::borrow::Cow::from(&raw_body)).to_string();\n Command::new(&processed).arg(\"--run\").output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5d234e76214f2d9725f39d8d17b5bb5b30470c28e7ec46449394f05a21e6f0e4", "structural_hash": "706af25d9defed1a66584648999dc001ba7335d23e8072c9e391baa0a3db2ab6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03529.java", "upstream_id": "BenchmarkTest03529", "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 = String.format(\"field_%s\", multipartValue);\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a4db6f7900395a73459a5ef8933e1b7c3b319c2f3c3765587d85d68ca27ac32", "structural_hash": "2128b2fdf476db9151ce964851794d3b98fedc2471450960773fb44ac68bbad5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_04824.go", "upstream_id": "BenchmarkTest04824", "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\tlastRequestValue.Store(jsonValue)\n\tdata, _ := lastRequestValue.Load().(string)\n\tvalidPattern := regexp.MustCompile(\"[a-zA-Z0-9_.-]+\")\n\tif !validPattern.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tanswer := processed\n\tif answer == \"fluffy\" {\n\t\tc.JSON(http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-640"], "category": "weak_pw_recovery", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40e1dc913f54ed2cf0876a4ce5402380080784e9e45a82ecc7f009e0980ca20d", "structural_hash": "c265b4d7dd284b7b79665ce2254765cd5f8f6db261653ac10dc2de64d5332e2d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02012.ts", "upstream_id": "BenchmarkTest02012", "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 fields = [userInput, 'http'];\n const [data] = fields;\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a21ccc590bb8c4813df7c8f964212a7090ec3008b0c80021d3612cf46f9f077d", "structural_hash": "43b3d032d5c6f3980f9017cedadc68248943c9f71b99ed73c5576123ebd130d5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05763.rs", "upstream_id": "BenchmarkTest05763", "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::render_html(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53165f76c45addce22cbce8238ff4427995d9c2fee01f643f37475e5bae9de5d", "structural_hash": "cd5af870323ed8aa79b75088fe53848ad717fbc9ceb93da4def58bc7b3e54e28", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04184.php", "upstream_id": "BenchmarkTest04184", "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('/^[a-zA-Z0-9_.-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n exec('echo ' . (string)$processed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "53461d62cd948e7470e49392ce85c04658d645d053b99d36677feb99b4adadc4", "structural_hash": "aba20b3ba3d39b05b53a71f6bc1aa97b725271814ea5389b253f094616486f90", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01066.py", "upstream_id": "BenchmarkTest01066", "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 data = header_value if header_value else 'default'\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n eval(str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df63dcd2175bd19b3786714142f407c325919833af3002c5fd8a9d37c381f3af", "structural_hash": "88094a8be967bf39219da8f8c7ffb1ce8aec23f0d6ec6dfc16a80d9a69ca7424", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02636.py", "upstream_id": "BenchmarkTest02636", "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 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 data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n trusted_claim = str(processed)\n return JSONResponse({'trusted': trusted_claim}, status_code=200)", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f00a33c4d0cdd61f6487bdad3bb87e5589f08102bb1f4b23abd22d6a0793572", "structural_hash": "f21922f8341899de9251ff0eda2bb6be45da9a3a0c3244646be68e998bc57552", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05864.c", "upstream_id": "BenchmarkTest05864", "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 _sz = atoi(data);\n const char *_payload = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\";\n char *_dst = malloc((size_t)(_sz + 1));\n if (_dst) { strcpy(_dst, _payload); free(_dst); }\n}", "label": 1, "cwe": ["CWE-680"], "category": "int_overflow_buffer", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:int_overflow_buffer", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64bd1737977ce23843ed10ee7cdccbbbe75eefb17bd906c0dc0e68d7dc8a8a20", "structural_hash": "5befa93372f278f8e0a740ade8623b652c05e8c3485696d9ad584fd8d8a54550", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04766.php", "upstream_id": "BenchmarkTest04766", "language": "php", "code": "attributes->get('id') ?? $request->query->get('id', ''));\n $ctx = new \\stdClass();\n $ctx->userInput = $userInput;\n $data = $ctx->userInput;\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return new JsonResponse(['error' => 'forbidden'], 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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebcec0f2cb6e7eb0e116b3f68050c1063c44ddf33c14cdcf612ab47a0e0ae6df", "structural_hash": "e03191e94a49cbace5ffb0606cead849d23d50b1c1f6e1bf248ec33e1eaf7946", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_27864.js", "upstream_id": "BenchmarkTest27864", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n const targetUrl = String(processed);\n if (targetUrl.startsWith(\"https://\")) {\n https.get(targetUrl + \"/lookup\", () => {});\n }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f5d9a15c8fb14a43f0c42224da777115e65a3f01df0115945b609c8ab6f52ef", "structural_hash": "f34e1eddcc5dfddecf0dd8a0dd022f5ce9f70a7c067bd5fe3910d88435eb839b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13296.go", "upstream_id": "BenchmarkTest13296", "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\tvar _b strings.Builder\n\t_b.WriteString(hostValue)\n\tdata := _b.String()\n\tif !aclCheck(c.GetString(\"user\"), data) {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbe9ada1a47b6cbcf7a10f5592c6beb6c9304fabc032a9845d97c2859427fc42", "structural_hash": "be2a27dd48d6c6445000363159b77f39ea5612e0c941df311f9ba0a8d32cbc72", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04020.ts", "upstream_id": "BenchmarkTest04020", "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 transform = (v: string): string => v;\n const data: string = transform(userInput);\n res.cookie(\"session\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff17262eee077cce6958931ea3478c2678c94f2fe214e06a389334112af2f262", "structural_hash": "e481695f20c91563071045da345865720fec50981640a52e150cee8cf5c9846d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30878.go", "upstream_id": "BenchmarkTest30878", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\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\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4be1ea630027c916d94e7292ae0cd0de1e234e2ea4a6d0b8c31e16399d017196", "structural_hash": "8d2cdacb595a0ca30b04d7666249a99a00e4d6fc529d48021626195c8174dbad", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13578.sh", "upstream_id": "BenchmarkTest13578", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n xmllint --xpath \"//user[name='$parsed_bool']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "93c91de34ee0923541fe96c9c06918eab30d563438f4ff902091ef9cc51c38e4", "structural_hash": "907e59393fcfadf469d38991b73f71f5f0f6753e54ac0971176accedd65a42c4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_15290.js", "upstream_id": "BenchmarkTest15290", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n ctx.set(\"X-Custom\", processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a84c300cfa51f975e2ad386b466bac0e03bbadce1cd12985bc5b5941083ca9b", "structural_hash": "bb6f26f1b9f0a67013ae1fe2c33958712f99efd2df9ab91b6cde0a871da346b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01744.rs", "upstream_id": "BenchmarkTest01744", "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 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(&processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bfd42d407afa6d2111159db95add3a59b09bd1fea7f6108650a853763f95efc9", "structural_hash": "b06d776424e85b44f17c7adaed84eed4a85fa6fa6e726439bf7dd9e20826838c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02536.rb", "upstream_id": "BenchmarkTest02536", "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\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31a864b78a097b62dd6e2c5ed0076f74c6eb6267f701027e79d58887798f82d6", "structural_hash": "aa127dfdc7f9d2f06d39b49c09d01dd3522c7618c66bace657a32e41b72983dd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01575.rs", "upstream_id": "BenchmarkTest01575", "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 use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", cookie_value).ok();\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 ([(\"X-Custom\", processed.as_str())], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "679eb2294f89a9076b6b41ca4db21067ea30618b2af8bbed470e7af12a8d2daa", "structural_hash": "5682a834ad1b4a551d2120c5ed70812348d9ec86052cba18e0a72edb8650ad5a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05940.rb", "upstream_id": "BenchmarkTest05940", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Rails.application.config.app_value.to_s\n data = user_input.split.join(\" \")\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n render json: { auth: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73636181685eee40821a5a13b34e37b005d93b628263cafeea51f62df30d0aec", "structural_hash": "1aee31c876c4b42bec3d0b6a7a40207e2bf9d3f522ffd77bc4405d916c0c71cd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03921.ts", "upstream_id": "BenchmarkTest03921", "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(\"multipart_field\") mf: string): Promise {\n const userInput = mf || \"\";\n const data = `${userInput}`;\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00ec8620be4eaf8e67e082b8bfb3811d9ae5872dc112e29eb86854931e0e26b5", "structural_hash": "418bd0d5104ae85a1612caf00c35b7646130e9b33c14e60824cf7984dff109db", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28197.go", "upstream_id": "BenchmarkTest28197", "language": "go", "code": "package testcode\nimport (\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\tvar secretVal string\n\tDB.QueryRow(\"SELECT secret FROM vault WHERE owner = ?\", data).Scan(&secretVal)\n\tc.Header(\"X-Secret\", secretVal)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6afaf4655352ece32d8027266ef6c740c616d74ccc7f52551a4701498abaa920", "structural_hash": "938300de3cc60c84325531caa32d3cc08c0fb413a14bb81eb666473d0d9a047d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_19916.go", "upstream_id": "BenchmarkTest19916", "language": "go", "code": "package testcode\nimport (\n\t\"bytes\"\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 := string(bytes.TrimSpace([]byte(xmlBody)))\n\tif strings.HasSuffix(data, \"/public\") || strings.HasSuffix(data, \"/static\") || strings.HasSuffix(data, \"/.\") {\n\t\tc.JSON(http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-289"], "category": "auth_bypass_alt_name", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fa2f5e2773c65082df3b85bc8572bc460da736bffa7a35a72f957d36ebf0daf", "structural_hash": "5c465e6df22f5f6cb5288faddc773466044b70b37afb8a92d808b89fe54d756a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_05375.ts", "upstream_id": "BenchmarkTest05375", "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 eval(userInput);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aa95bacf4ea3d51241aa3bf4ca51f28949034692fb866728de6f4a7bf78abb9e", "structural_hash": "656f862b292de3ff633d66f307b80214ec4d597851394e0739885a97b3c4c9d8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36036.go", "upstream_id": "BenchmarkTest36036", "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\tsegments := strings.Split(hostValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif data == \"is_admin\" {\n\t\tc.JSON(http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-807"], "category": "untrusted_security_decision", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cd66a87d5fab885f7f2ee28239372199375918420b0629fc40c42a0029ab203c", "structural_hash": "d2f5ae8d44cc63ef5f8d7b14e5e576495e39b92f2ec2c6858a41251d53d27775", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_04308.go", "upstream_id": "BenchmarkTest04308", "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\toriginValue := r.Header.Get(\"Origin\")\n\tdata := strings.ReplaceAll(originValue, \"\\x00\", \"\")\n\tos.Remove(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3d668f682ccb4b71df4d62358851c2aef96c9dc9879e1b4f8a2a2be7eee4514", "structural_hash": "763f4542954a2178712ad6d326a0dad64af590d674bb78ac0338aed2cb6c866e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02101.sh", "upstream_id": "BenchmarkTest02101", "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 echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-261"], "category": "weak_password_encode", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c610965695da593281445a4e97dd72b9a5e34e3471dada7af382496f7fd3099d", "structural_hash": "ad4328243fc475e8beb43ab9aafcc75d9a133c4ce9aad260654815db336a88f1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00838.php", "upstream_id": "BenchmarkTest00838", "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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60b6c89ef082c5ccafde1983f950f2c72893965b07cc448d05a4c8e8e7de09ec", "structural_hash": "6f7faba47a338ab76e18ac9be52f4d8d34ccfe52587c83472430305af4914164", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_25181.go", "upstream_id": "BenchmarkTest25181", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"regexp\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sqs\"\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\tvalidMsg := regexp.MustCompile(`^[a-zA-Z0-9 _.-]+$`)\n\tif len(data) > 256 || !validMsg.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid message payload\")\n\t\treturn\n\t}\n\tsqsClient.SendMessage(context.Background(), &sqs.SendMessageInput{\n\t\tQueueUrl: aws.String(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\"),\n\t\tMessageBody: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "113123fb3dc5622685a6fac90c647252070deb3a695f848175b26c916ea3ac79", "structural_hash": "3b9c4114e640f94af559e599cfedfc46515cbb68bf2daf5fe84d7f27c610ccc1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05138.java", "upstream_id": "BenchmarkTest05138", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.xpath.*;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\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 FormData payload = new FormData(uploadName);\n String data = payload.payload();\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 response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e0f7e7a7105061e0c23021715f5b908a3df6dfb12a2ca6169d34aa86eb11c50a", "structural_hash": "b33a37714e7370815315d44f84bd5006dd1350880fa5cec3ddeba8ab9e233d0f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00491.rs", "upstream_id": "BenchmarkTest00491", "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 = crate::shared::passthrough(auth_header.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 ([(\"X-Custom\", processed.as_str())], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "16169529cc9b4ef3e7fb74019fb599a6145117e03816bb04aef948d842345929", "structural_hash": "77a84ef36d082258c8b63ad76575fefb06a2db0c2aeb8b71230a863953a4e7c6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_10095.js", "upstream_id": "BenchmarkTest10095", "language": "javascript", "code": "const ldapjs = require(\"ldapjs\");\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 if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {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 ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cba2474ab30d27b9be442ca71f282a079a2f2a4744f21497dc4c9b82538ee378", "structural_hash": "31176d434f2fbb530e5d43cce587dfa5dfe9e446eac063afd89f6d19ca0ea246", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12695.js", "upstream_id": "BenchmarkTest12695", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n ctx.body = { ack: 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:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6558b1924461a0b2c2e98063f648380a656bf69b419ae587c048a30e7cdea12d", "structural_hash": "1f65b65a62a847af85f57df5157e1d5aa56612f98927dc8691c75cbb6df003da", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03867.rs", "upstream_id": "BenchmarkTest03867", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse tokio::process::Command;\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 if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25304988dd3cf1607120ad29f7df3ad84cb3d25825823f39ab5037c3cdd4c626", "structural_hash": "b636c32e651da2269b6c8b0c2a368e8b73d5aeacdf563795c13685bfe26dce56", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05382.java", "upstream_id": "BenchmarkTest05382", "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.nio.file.Files;\nimport java.nio.file.Paths;\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.Supplier valueSupplier = () -> \"payload:\" + graphqlVar;\n String data = valueSupplier.get();\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbcafdaa0e5c24695fb84c35f425dbfccd361015ab5a2c2b11f5aeb2b02a22b3", "structural_hash": "51f2e95c709b5f4f8e60e18e35b87ce5d5e0c8c4af68e57b9ce4b209897fcdaa", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03817.py", "upstream_id": "BenchmarkTest03817", "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 upload_name = getattr((await request.form()).get('doc'), 'filename', '')\n parts = []\n for token in str(upload_name).split(','):\n parts.append(token.strip())\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_code=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 {\"updated\": True}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4031fe7c39233efd00e5053bda6f8d75dd98d7ed4ae85a65bcfd16aafed518f", "structural_hash": "8c56b41c91d54e9d038f2f9ce5449cf61389f706f56bdc5d458d43a05227d668", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_05181.go", "upstream_id": "BenchmarkTest05181", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/tls\"\n\t\"io\"\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\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\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-296"], "category": "bad_cert_chain", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8346eb7f76e72d0c6c3bb1102dacad78838055dfabfe767e328e6283185e1966", "structural_hash": "685fabd73a1d7bc3e5053507354e4ddbfe2f68cd534cc8ce79441d9a5b76e03d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16383.c", "upstream_id": "BenchmarkTest16383", "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 printf(data);\n printf(\"\\n\");\n}", "label": 1, "cwe": ["CWE-134"], "category": "format_string", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:format_string", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b4c556097be831af810b15c6f8284b4d40084e311f498a53e4e403986094f78b", "structural_hash": "a4f9c5da50cd51f26abc5f18685b9a984b7ea4324e3383cfb76e23bd6fd45673", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03725.cpp", "upstream_id": "BenchmarkTest03725", "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_HOST\");\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 _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ba90f6bf2b2dd26b11a4c4b60b698a1afe0e026b80e90993dc45d4df555bc8b", "structural_hash": "268c96bedd8b1c8222db9f544f1f8eb78bd7e53b53e3e8fd7190c2094bc704c3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04198.py", "upstream_id": "BenchmarkTest04198", "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 trusted_claim = str(data)\n return JSONResponse({'trusted': trusted_claim}, status_code=200)", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2131f38fb164735f98b4ce7788fdf97970fb5ecd2430f7d2149e728526c725fe", "structural_hash": "c7731775d15cae1b9a81aa081bf480d23be29e99704a09b402ea984ecdf9eadc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05804.py", "upstream_id": "BenchmarkTest05804", "language": "python", "code": "from fastapi import FastAPI, Request\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 xml_value = (await request.body()).decode('utf-8')\n data = '{}'.format(xml_value)\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('
' + str(processed) + '
')", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "232f87630cc5109fe5aba7a033dbf7a43c17bad2ebf2025b8da6b36b97269b3b", "structural_hash": "c883d0525032362c2e05d993a1a2fa632fa8fa6f6d14432062fd1d2e555ef986", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04001.rb", "upstream_id": "BenchmarkTest04001", "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 = format('%s', user_input)\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04caf791a84ac6db941a88c411e3e787d12c3dedf024903d1cb7b4fbc5a37aff", "structural_hash": "35d20d6bcfad62db34fb6fb57a8555d3bde4173a426420ee7c2113a4ba71249f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02634.py", "upstream_id": "BenchmarkTest02634", "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 = (lambda v: v.strip())(raw_body)\n requests.get(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c723121883d31cb28accf33a4cca9e671055fdb03ba8428c990b7dd33e37ed7c", "structural_hash": "c6f20a2109468dea44dc42327014f3ac3400aaa3d0de653c2503e48344f5aab6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01329.cpp", "upstream_id": "BenchmarkTest01329", "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(\"value=\") + user_input;\n std::string _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89c1f6a16dead7534ca791670685e002c4bf434545f537197cbe3917d882ad7b", "structural_hash": "8c226fecdca5af4c210fe019b8d55a4e57ff6e397f9880199da51bade3987053", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04005.ts", "upstream_id": "BenchmarkTest04005", "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 _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da4f79a949b975e4fb7e780e3ba65e877ae8c41df34d18d575135c33ff9a4580", "structural_hash": "a8fe3abaea62930ab1dda62494c873ced9d0510bbb21e39546dae3230d818ae3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13257.sh", "upstream_id": "BenchmarkTest13257", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37d164901418cd5f0720547d0ef97472517e52295b4dd8da71c46a48ae405594", "structural_hash": "83e54e1edc53f4d1563d259a42d5f8a61976295732b081b1588baed3c5b61d18", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15445.sh", "upstream_id": "BenchmarkTest15445", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n printf -v data \"%s\" \"${user_input}\"\n echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "779a836d9e65505fe4c3f8761d902bfdf00f6daca6f36c2f503b83451a583874", "structural_hash": "fdad016d52e155143387e4d3363b47d456859775524dbbe19a1dfe4c6e152712", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02528.rs", "upstream_id": "BenchmarkTest02528", "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::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "066d8e59244e24da63e3003ac5afd824fa487f7edc0b91474b5ee3b1f5c1c1d5", "structural_hash": "8a6e826d2580b0dd8076c591f150875a2adce91956fca3fc71af6ea93cc434cb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03851.js", "upstream_id": "BenchmarkTest03851", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const data = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n if (process.env.NODE_ENV !== \"test\") {\n http.get(data);\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-99"], "category": "resource_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b47ecbe73282744d59907c1ca5908737a93a48ce892e34f5ede2a5ec1169a2d", "structural_hash": "c6f59e785723297944127e71cda3d07ed8d5cbc2cb5a699d3254e62e0cf7ee7b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04000.rs", "upstream_id": "BenchmarkTest04000", "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 normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(header_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(&processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-1336"], "category": "ssti", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baedc48be966a9300174a30b88220d326f91bedda8d210edcb5ba01498cbf8e4", "structural_hash": "2fb8d6d64723f0055204f4b32c868fb8f55d975df44ba5a3e138006a45207cec", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03209.py", "upstream_id": "BenchmarkTest03209", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\nimport re\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 if re.search('[a-zA-Z0-9_-]+', str(data)):\n return JSONResponse({'validated': str(data)}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "524c27fc9c83f4ca11aab887db8cecc6033cf2429e3d6a948dd4ce17e13f9a88", "structural_hash": "cadeeb73f75536e60d872989f9a90195bdbc2d01f4e797850850bc48a8d70ff2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05038.rb", "upstream_id": "BenchmarkTest05038", "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 = CGI.unescape(user_input)\n system(\"echo\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "833c1e1e2c8c90b6448a2e4482c4394ce14422f00ebf5d3f05dd67d31801c46a", "structural_hash": "08cbd3a56ce8570c7972050f0b772bfb5382b4bc900bd90503ae97e43af70eef", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00650.rb", "upstream_id": "BenchmarkTest00650", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = \"#{user_input}\"\n _body = URI.open(data).read\n DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a054e1fe401acbdcc4715140869f515dfa5cc6d3d5f24f3aad1aa9269afb4dcd", "structural_hash": "2e5244a82ca18da2d9eb16992450a2606a874da12fc8bed3630f0ac7084e4fdc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33608.sh", "upstream_id": "BenchmarkTest33608", "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 ulimit -v 524288\n if [[ \"$data\" =~ ^[0-9]+$ ]]; then _req=\"$data\"; else _req=0; fi\n (( _req > 1024 )) && _req=1024\n dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$_req\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ed60db511a2b4e780370d018215e0b47df322d585c236049240f821b10ae420", "structural_hash": "00e5ea545ce825e92c9991314bb2364578b4e2a2cb55e2772a1067eb98fa3827", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05265.rb", "upstream_id": "BenchmarkTest05265", "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 = \"%s\" % user_input\n unless session[:role] == \"admin\"\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ddc7cefdecf4c812d8b416790094f86ca009d62dbaca624d00cb97583795af42", "structural_hash": "3dc40e1a86814738773095f54227b7c3a5ff012665a950a153ff4950f3e6c94f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01067.rb", "upstream_id": "BenchmarkTest01067", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n File.write(\"/var/data/output\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c35e32f681ba2a46d8e28ea37f5b93a02496034d86f8c861d0b76409be72cdf6", "structural_hash": "3493bd2e466eafa881b2814d195d8fb0290c250f5dd674f147b7b13086612fb9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36702.go", "upstream_id": "BenchmarkTest36702", "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\tif data != c.GetHeader(\"X-CSRF-Token\") {\n\t\tc.String(http.StatusForbidden, \"csrf mismatch\")\n\t\treturn\n\t}\n\tif !verifyBearer(c.GetHeader(\"Authorization\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "456ebe8797a0c000c042cf0fecbdc9c4ed721ca6ec8274a09a9996b7fe9d07e7", "structural_hash": "1ef6ae2b43ec268b4da79349f5cd5ee21e5204f2df76bf8c21169b28866e2d88", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04534.ts", "upstream_id": "BenchmarkTest04534", "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 eval(processed);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5fffccd539c291ed3eb59bee4bfc20522baaa214e494b67bb4e9dcbffbfc14c2", "structural_hash": "a0c4c474efaa1b066103ba839def69c789fe8ad5ec84c447963e0748a44509d7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04988.rb", "upstream_id": "BenchmarkTest04988", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n data = !user_input.empty? ? user_input : ''\n File.write(\"/var/data/output\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e89d25b774a783eea910614918e4cfe36089b1252da636a7656d5715bee4575c", "structural_hash": "4fec434c9a6fd83356cf4b10ce10fd06a2dec95337fc1a909a666d90187bb66a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_32859.js", "upstream_id": "BenchmarkTest32859", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\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)), { checkServerIdentity: () => undefined });\n ctx.body = { ack: 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:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec4f73336e92bb5549a654e1774aecd9fd8b8c34ebd77dde27b1ae1f7a59aa96", "structural_hash": "dff2bbf2fc106f710e878bc0f3e24382a369313e7adb2e78a471346db9f97b11", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04056.php", "upstream_id": "BenchmarkTest04056", "language": "php", "code": "header('X-Custom-Header', '');\n $data = ($userInput !== null) ? $userInput : '';\n exec('echo ' . (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c6797964842b4c93a3cd46eeab3ae2d98775a54a88d1d6bca24e58c6595f966", "structural_hash": "9eb29265d6e2b2d3e590bee552e291d011fc4a5c3558cc8d325a5a725789775d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00775.cpp", "upstream_id": "BenchmarkTest00775", "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 = std::string(\"value=\") + user_input;\n const char *_sec = std::getenv(\"SESSION_SECRET\");\n const char *_tok = std::getenv(\"AUTH_TOKEN\");\n if (!_sec || !_tok || std::string(_tok) != _sec) return;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n std::cout << _msg << std::endl;\n}", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52d403a91d25574e6255202dbbee86ea97ec758f55e8275da18adb8b17415a08", "structural_hash": "5ffb91f79f4439215ed7e256da878b7fc8034e42e0d786bf1b38ec14e97a206f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05131.rb", "upstream_id": "BenchmarkTest05131", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\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 cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n render json: { auth: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79efea27f82aa051c25a5637b0c252876697c5978dab8505bec723052ca940d5", "structural_hash": "082053741d2fba61ad0a8b51791d5cccc71903310f29187312ccdcec379372b8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05147.rb", "upstream_id": "BenchmarkTest05147", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n token = SecureRandom.hex(32)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4233127ae5d82ba77c219a5f5d5bfe5bb678e4ea2dd3843bf61479e1ffda3f2", "structural_hash": "8121168609a610ab57d70c381dec7ec9846a6eb69bc0b9a6eeba54bea8f65047", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01849.ts", "upstream_id": "BenchmarkTest01849", "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(\"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 throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5d370a05535db3aa60d097d080aefe05045cbb975deeddc8d6fecf79b3001bc", "structural_hash": "8746c9e5c02ac7fea7a533efa3a1166c705914a64ddfa1ad26c0ee8ad56acbf9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00621.py", "upstream_id": "BenchmarkTest00621", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n data = f'{path_value!s}'\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_code=404)\n value = result['name']\n return JSONResponse({'name': str(value)}, status_code=200)", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90ca5b5b0488f76e28b7580f3bee19689607349fdea2ac8196359f167433958a", "structural_hash": "e4848bd71e95762717e81cca13c23f701244649a52144c36ef0e47e344e16255", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03687.rs", "upstream_id": "BenchmarkTest03687", "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 captured = xml_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\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 ([(\"X-Custom\", processed.as_str())], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfb5c19c9f6d8b7505f33bc2aaedc83bd43da9a0e987569c76defa4551e6ab20", "structural_hash": "5f118db40147922b2ac3732de8ac977babd340b082634fc9c5652448478c5d05", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04159.rb", "upstream_id": "BenchmarkTest04159", "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\n unless %w[asc desc name created].include?(data)\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n system(\"echo \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30dec8f401e058fe55bde3f629c0a0adcf71774618a0dc606453fe9321a243c9", "structural_hash": "6e9297d4d7653834344e37994050078136c74d57c8504f47454c375f690db72d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28406.sh", "upstream_id": "BenchmarkTest28406", "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 xmllint --xpath \"//user[name='$data']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f428e3e14cc92c9ce1b563d8870f6aa6c57ce851830305fa87abb98aae28bb6", "structural_hash": "c3b580278a20e7f8bc55e5f577acad8ef6ba9ac90d0edc171aec75f1beef1cf4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00432.rb", "upstream_id": "BenchmarkTest00432", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"DOTENV_VAR\"] || \"\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n File.write(\"/var/data/output\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10dd7b5a0f68a25b05601c331b8b394c59a71953a65c2623698b5bd11dd58343", "structural_hash": "46d34cc1f71e93eeae7d0b09b68177f97f7b8f550310150cef22bc17ba83f8c0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11588.sh", "upstream_id": "BenchmarkTest11588", "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 echo -n \"$data\" | sha256sum\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef84527f2c83cd9f4e7b5cd565fcb98bb57d8c6a8af21123856992b14360c74e", "structural_hash": "6e3d1dcce84771459ea0d06a7f5181cfb575791f33360aea212c957807891f3c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03647.js", "upstream_id": "BenchmarkTest03647", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n ctx.set(\"X-Custom\", data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8383f4a3406b326a71358d01cebefc292d560fa8dd52e90ed6ff5891eb5feead", "structural_hash": "15b2676702e92f8aa66f8d7965a068eb0b87ba54af808df4127e036abe8f765c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01122.php", "upstream_id": "BenchmarkTest01122", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = json_decode($userInput, true)['value'] ?? '';\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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10e262ff2628ab65a0dd8cc9934d855a46311e1972a9c45ecd40ea81e324d60d", "structural_hash": "30ebffe2130ae1197e0f8212988f887255de64278ff0784196494969e4f51c3a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04530.py", "upstream_id": "BenchmarkTest04530", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom urllib.parse import unquote\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n referer_value = request.headers.get('referer', '')\n data = unquote(referer_value)\n requests.get(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "045f366231f4150252386f0c1ed0292791ec9f614e47366a6dfa5616e8f5e019", "structural_hash": "fcfab2e38644e10815f8b26074e7cd654759afabb2641631706cb555cfe6da69", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02627.php", "upstream_id": "BenchmarkTest02627", "language": "php", "code": "request->get('field', '');\n $asText = function ($v): string { return (string) $v; };\n $data = $asText($userInput);\n exec('echo ' . (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1ba4b5d1e1d7f9eccd9352ff88a70012fcad55058d39d1ecf114fdf660da5cf", "structural_hash": "630494ab61542289e9e043d69481ae610d0aa7981a5b8dba3144e963b6f67032", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01504.java", "upstream_id": "BenchmarkTest01504", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.xpath.*;\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;\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 response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ae1e766351a450d18b868738003d89ecb00b96a7c005e18d5af88bba7e98a2d", "structural_hash": "fa7d90dbb1e999f771c1ae747f83b7b1c676627002b36d0523d64ef42cc1c986", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03374.cpp", "upstream_id": "BenchmarkTest03374", "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 std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "367f69879aa96d39908549af03b2b9d794423b324d102421fc0c9c14a8bffc12", "structural_hash": "81bdf0709177777b74404db51c4c185d899cf1f424e9454f0cb8147f02f4e008", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_37651.js", "upstream_id": "BenchmarkTest37651", "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 parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "19c298192ee6ae3c3b28cbad9c949bdb2cbffdba9658140649426b89f5d5b897", "structural_hash": "2d591bbccf8a6fa9ff3209aae8c21584f91a245a8856d1e019c63bae0857430e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13428.sh", "upstream_id": "BenchmarkTest13428", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=$(printf \"%b\" \"$user_input\")\n echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca2254a62afdbe7635bc095d3c8be613c9a640dc8409362074682e06b63cb45b", "structural_hash": "3a52a32e339c5c9b8c17a11c3f5aa68c9e0a2b716da4d89c4dcd903489a488a9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_28873.go", "upstream_id": "BenchmarkTest28873", "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\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\tvar secretVal string\n\tDB.QueryRow(\"SELECT secret FROM vault WHERE owner = ?\", data).Scan(&secretVal)\n\tc.Header(\"X-Secret\", secretVal)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-284"], "category": "improper_access_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ac15e19f203a63fea8a84577394c3664a99205dd77dbfb795e067846ac940c9", "structural_hash": "05862bf6d8efdcf09862cd981169141b382977db744d11848e84191538fcdab3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01555.c", "upstream_id": "BenchmarkTest01555", "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 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 _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-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:symlink_following", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87fa233a86ac8c9099a70663784f1fe62dea8730c4b5cf9580eb31d9992525a1", "structural_hash": "95d908b1ba0963cd8e72620babea9ab0fba91ab3de545ea4943680ab2d39a02c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04165.java", "upstream_id": "BenchmarkTest04165", "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(\"Authorization\") String authorization, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = stripWhitespace(authHeader);\n org.owasp.html.PolicyFactory policy = new org.owasp.html.HtmlPolicyBuilder().allowCommonInlineFormattingElements().toFactory();\n String processed = policy.sanitize(data);\n return Response.ok(\"
\" + processed + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9545a9c1c74b9dc7c47510a87280edfc3a823d6322f9ef238e515154f763cd72", "structural_hash": "09bb6fac4c9a04bbf0877192c4b1d8f055c5352f30a5d1009754dc7194d3f02c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05769.php", "upstream_id": "BenchmarkTest05769", "language": "php", "code": "'forbidden'], 403); }\n $checkedPath = $resolved;\n file_put_contents((string)$checkedPath, 'data');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b1f8a9c3c0219a916ea5c55b8b26c57c34d016f16a804d4b6c0e27453983a69", "structural_hash": "ae90210cdae801d8d7f29538136b66df0aac2afa0537c8096e2ce939d2fb6452", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01363.cpp", "upstream_id": "BenchmarkTest01363", "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 (void)data; std::string _msg = \"internal server error\";\n std::cout << _msg << std::endl;\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b02b4ee30d3d88338097dfd7a1d643ffc103b018bbe895152c968c03ff9e514", "structural_hash": "c67d63225cb18b969e5be232e7f655ae1fb6d6c6040c377ae898f01cc620f1fb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38090.go", "upstream_id": "BenchmarkTest38090", "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\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.Redirect(302, \"/dashboard?hidden_field=\"+url.QueryEscape(processed))\n}", "label": 0, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "deea6dbe0d7bd835a361a5bba131304103ed0b06b9bd20d1cf0715f909346cda", "structural_hash": "9c46eb6d30a290f4a5adef802d65f677bece832859ef2db299e47a94c184c2b9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05238.rb", "upstream_id": "BenchmarkTest05238", "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 if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cebc354f236e24fb1ff0ee6cc450c7bbcb6f836749f7b3f8ba608fab75061f40", "structural_hash": "9d99237cdc9d70b4df3407f16c9dcc052237383b5b9e72dd2b7ab388220b4a35", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04452.java", "upstream_id": "BenchmarkTest04452", "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.*;\nimport javax.net.ssl.*;\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;\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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf33a982811204259c4f42566e8ff992f3a8993a8f57ac2f9339acc32c75eaca", "structural_hash": "929e2dc16d241cc9ed4689b61e802b0dc6231307590c1947b40e4af4705e82c6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02733.ts", "upstream_id": "BenchmarkTest02733", "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 _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);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6182024b43525da781b75a7de898fdd6f2e0aa17a94569cc6f7e4532e2f6b9ac", "structural_hash": "a8ee2fb2cd0774afb937e96f61ae6b96a59969f394a8d940e81b9b2098b3f5b1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02579.java", "upstream_id": "BenchmarkTest02579", "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.*;\nimport javax.net.ssl.*;\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 = commentValue.replace(\"\\u0000\", \"\");\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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d4f430fd44145e26187c2440974020af42b3485ba2220171824a55039b49fbe", "structural_hash": "5eaab64f43cd0892f89c29da753b90fa78c0109870daed3096f7d3a9c26845b9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03804.ts", "upstream_id": "BenchmarkTest03804", "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 _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e559034a40fa39c27ade0be7b25db97d502b55619a6255b775b5e23d6d9f76f", "structural_hash": "ffbfbcdc81d8c603f176f811e251299f28cd8cf70e3b80667530e3f921aa7497", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05616.py", "upstream_id": "BenchmarkTest05616", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n multipart_value = request.POST.get('multipart_field', '')\n kind = 'json' if str(multipart_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(multipart_value).strip()\n case _:\n data = str(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:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9034cd92c521b697d1d40c62e53055ec562e2964826c1d463b9a6ca4e22b75f", "structural_hash": "65a79654d1065625143812ea8716eb86ba0dddad8fd2a46cb4e69e2a7c5eee0b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03850.py", "upstream_id": "BenchmarkTest03850", "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 = '%s' % str(json_value)\n if data not in ('asc', 'desc', 'name', 'created'):\n return jsonify({'error': 'forbidden'}), 400\n processed = data\n eval(str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab2cd1429df7452c0f68366d3365c93118e927553d0a45b55a1e1ca1a53f2ccf", "structural_hash": "aa65f229c9e0f943cd9ffdb9df819430401ae11a64020cea562cf28f311274d4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02266.java", "upstream_id": "BenchmarkTest02266", "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 @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 FormData payload = new FormData(authHeader);\n String data = payload.payload();\n if (\"admin\".equals(data)) {\n return Response.ok(\"{\\\"role\\\":\\\"admin\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59ae91d431c7e3e65cc464e1effd74573ea9f11b8eadbe59ef6c7cc2aecdb24c", "structural_hash": "ee3dc9707ae6f8876e6f41cfa799d4086a61ac1da7618abb0f497354a2b65d23", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20622.sh", "upstream_id": "BenchmarkTest20622", "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 _bypass_re='^[a-zA-Z0-9 _.,;:/=-]+$'\n if [[ ! \"$data\" =~ $_bypass_re ]]; then echo \"forbidden\"; exit 1; fi\n processed=\"$data\"\n echo -n \"$processed\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db9fcc4104a3e315318ba6d02f5b171dccaa20100fbb25e87cd3854f5ebcc36d", "structural_hash": "4c105a2097aa8a39a99f86456c6ea01691d057456142f6ef7568a638a3297632", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01900.php", "upstream_id": "BenchmarkTest01900", "language": "php", "code": "headers->get('User-Agent', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n exec('echo ' . (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b7ff818d495fe5e9a8504b64835b229510c9b7b9836705f4ba047afab098410", "structural_hash": "fd7e04e23570cc553b44396c793e8d70f95441d1568fa7f4db03711da50578bd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_05082.js", "upstream_id": "BenchmarkTest05082", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const data = `${userInput}`;\n let _host = \"\";\n try { _host = new URL(String(data)).hostname; } catch (e) { ctx.status = 403; ctx.body = {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) { ctx.status = 403; ctx.body = {error:\"private or loopback address not allowed\"}; return; }\n const targetUrl = data;\n http.get(targetUrl);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "465aabf8317c8e8459dd889596751b24c9813aa03103a6aa15d8d67fb40e7e60", "structural_hash": "dabefd68b9c19285750f8474ed5345942f5ac0db378be99192173af2d4a00c4e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_38124.go", "upstream_id": "BenchmarkTest38124", "language": "go", "code": "package testcode\nimport (\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(pathValue)\n\tDB.Exec(\"UPDATE users SET role = ? WHERE name = ?\", \"admin\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46ce85557f9119b9c8cf61584ce5384bf88d932a0279afa1e90070e72d3747a9", "structural_hash": "c7f51854fe0dd2af04a6a45adedc1fe95e9e7e720d48e65affd6d2a0b91ee12e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02454.rb", "upstream_id": "BenchmarkTest02454", "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 normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n File.write(\"/var/data/output\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b246391998d4f881926cf58fc7dc808abe662221652bc4429a1a19ac38ca72c1", "structural_hash": "d1bca97bb12d6fa46f73c592a599eb50342bfc8e9418c24ed7ec319c9a6c622b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00877.go", "upstream_id": "BenchmarkTest00877", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/hex\"\n\t\"net/http\"\n\t\"os\"\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\tos.Remove(data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d0090ec510a16365653e7ed088d070a433675c85d603f6e695ea8bf75911db40", "structural_hash": "074751b76729f8747b21478901d635806acd5c24941c6bb5ac373d7a2cdaf683", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00700.php", "upstream_id": "BenchmarkTest00700", "language": "php", "code": " true]);\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f67a1f43355ee70291a8a967d5bbcf00b9ad30121142939e38c7df712c716de5", "structural_hash": "08332054c4bd470f2ec6d6c86c7c1344395d4170bb6b4789b0a2bd5f8dea8bac", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03341.rb", "upstream_id": "BenchmarkTest03341", "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[:profiles].first&.fetch(:bio, \"\").to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n Net::HTTP.post(URI(\"https://api.intra.net/data\"), data.to_s)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "421d8c9cc4247e7b8504a961da577592099633219457e92d5428d2d2faf2609c", "structural_hash": "69eab956b6edfbc58392a49058cb53e3a2241f4ce2a56c98bc9ebdfe9093ba3f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01182.php", "upstream_id": "BenchmarkTest01182", "language": "php", "code": "headers->get('Host', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n $digest = md5((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae4214454612bd13330834eee93606f708fde53c8b9c8b31303a00d107c0e27d", "structural_hash": "59c8aff22669e654b4d7a032d5425ffc806714d4e5fcae5ff4e8dae5b261caf0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05336.rb", "upstream_id": "BenchmarkTest05336", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n payload, _origin = user_input, 'http'\n data = payload\n _body = URI.open(data).read\n DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "042868e56c8c6a643f1c20c74b22ca5da5578807e6bc0bbe3cea59d5712e15bd", "structural_hash": "0f2584403bc0b42d785a7480bb4abd63ed977fe63ab4482883450245b9aeb095", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05739.java", "upstream_id": "BenchmarkTest05739", "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.nio.file.Files;\nimport java.nio.file.Paths;\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;\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "316393180b470738f7d6b4abe22a17a33902634d1d66131ab58a98fbbad704bf", "structural_hash": "75c17a21667611d22aa68570545ae8714ef030a72c52f0b9b5b9e89675c50f4f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36149.go", "upstream_id": "BenchmarkTest36149", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\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 len(graphqlVar) > 0 {\n\t\tdata = graphqlVar\n\t} else {\n\t\tdata = \"default\"\n\t}\n\tc.Redirect(302, \"/dashboard?hidden_field=\"+url.QueryEscape(data))\n}", "label": 1, "cwe": ["CWE-472"], "category": "external_web_param_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:external_web_param_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "924a60785c04b27a4dc9e32f20e09e46373cc1608327d91cc2a71173051ea5f1", "structural_hash": "ff6fe5e188db508a723027081aca03f001a9be6fd84638d43bb1a25cfd5a44d4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05640.rs", "upstream_id": "BenchmarkTest05640", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 mut data = String::new();\n data.push_str(&origin_value);\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9c4229da9d6e6eb21e78e09ab3aa1186552002a5c161af1599f8a6a5d4b3636", "structural_hash": "faf59c99a9980524265259c0f6b1996d1a672a13d5bf5e425c28fdb04b7e7023", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03805.rs", "upstream_id": "BenchmarkTest03805", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "528d4bc0566463f1c55a230bedf85ede4a7f1d58df266bbe41e4fadee736bf19", "structural_hash": "5906a9901d56d682fa4548ad00f2e204f343b3cff9d05640312234e631d223ca", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_15216.go", "upstream_id": "BenchmarkTest15216", "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\tauthHeader := c.GetHeader(\"Authorization\")\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(authHeader) {\n\t\tdata = normalizer(authHeader)\n\t}\n\tvalues := strings.Split(data, \",\")\n\tif len(values) > 0 {\n\t\tc.Header(\"X-Param-First\", values[0])\n\t\tc.Header(\"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:gin:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2a577ac66ccfcfd1b0d6c1a24a4c3ce98eedba20e82fd7018ba971cbec2e2ef", "structural_hash": "1d544aa52674bd7418040c96a058d60817e6a22516de8bb40c7ee87e17f7b5dd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00464.c", "upstream_id": "BenchmarkTest00464", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 const char *_cred = getenv(\"APP_DB_PASSWORD\");\n if (_cred == NULL) _cred = \"\";\n if (strcmp(user_input, _cred) == 0) { printf(\"auth ok\\n\"); }\n}", "label": 0, "cwe": ["CWE-259"], "category": "password_in_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "103cc7e0b57e12c2fa9b10437cb839b1006811aa59754763b34be53b10a8a3bb", "structural_hash": "4589b4769186136ca4a57c13dce6cfe799ce191547b5e07c4ed161d69d2d0509", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_04253.ts", "upstream_id": "BenchmarkTest04253", "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 = String(userInput).replace(/\\u0000/g, \"\");\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7cf7425beaa8a3700631895aa8b35cc224cf3f1430c1f1e77aaf1ad5a5f15bb", "structural_hash": "7e47a1ef3b86af8eadbf4aaec8af96dc13da74121c6ad189781de4a21c643544", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02836.ts", "upstream_id": "BenchmarkTest02836", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, InternalServerErrorException } 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 let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c62df58ad79554659f4fc9c28244ef4829a2bf00eca4862008b54a33feb3f16c", "structural_hash": "3fe9296133f5b5274da400e3e7b17631207224bf67fc17b48f648bd9bef2277b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_30443.js", "upstream_id": "BenchmarkTest30443", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\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 ctx.cookies.set(\"session\", _ct, { secure: true, httpOnly: true, sameSite: \"strict\" });\n ctx.body = { ack: 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:koa:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90f71663ef5a19e636f91215272ea5e78046e7dfb9aeb6c37cf8c44be1ce3fdd", "structural_hash": "5045c5796e5764c2b1a503536fdeeccedb319771fd3f01e643c188e7db52721b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02641.py", "upstream_id": "BenchmarkTest02641", "language": "python", "code": "from fastapi import FastAPI, Request\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\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 {\"updated\": True}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da7371025dee0f55b340e2c9a5cd57b8dcd83fec5895ffdea30708577e846c19", "structural_hash": "423e4d215f804794fea767954544f0f6e02a4560e5c08a40661ce9d97fb16080", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03250.js", "upstream_id": "BenchmarkTest03250", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const transform = (v) => v;\n const data = transform(userInput);\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "09c883c1d827b37637bb31521a806351af4b600accfb8cb284596280b03ac222", "structural_hash": "e097bb7b72307f37762147d25c00fbfa6196b94c3e2ff3f0b2fc0b27c04f6d59", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01791.py", "upstream_id": "BenchmarkTest01791", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import RedirectResponse\nfrom urllib.parse import urlparse\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n data, _sep, _rest = str(origin_value).partition('\\x00')\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JSONResponse({'error': 'forbidden host'}, status_code=403)\n target_url = data\n return RedirectResponse(url=str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1aa96fcf15ef357de846b21681130cb41bf3a3647df45bd8b3f49a001a233dc0", "structural_hash": "a1d27e3379dc40200a17edafb2717fae0b50d1dba0f3a888aa45cc571658cedb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_03416.cpp", "upstream_id": "BenchmarkTest03416", "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 bool _authok = !user_input.empty();\n if (_authok) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7447b22ebbb4941ea24fa6ac9d3967e59d17daaf616e384f04570a67335f3a8f", "structural_hash": "0c701752b7b95c40a8b2791e82e375e5ab8f5df9e985d4bcb0c31fe723331693", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02186.php", "upstream_id": "BenchmarkTest02186", "language": "php", "code": "headers->get('Referer', '');\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 $digest = md5((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c1d265c043fb68055faee44eace975be73837e544c306264cd32f31bbb2d940", "structural_hash": "f07bf86ea3d24e372f63b4e2d0bd6532dbe5474bd5dbce35034d93f92fdaf575", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04058.php", "upstream_id": "BenchmarkTest04058", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n $data = urldecode($userInput);\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n if (!in_array($host, ['api.corp.lan', 'cdn.shopcdn.io'], true)) { return response()->json(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n file_get_contents((string)$targetUrl);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82e1b2e640f3c4994ff674e7c144eba57b705ed84c1d80a2e6a0897eb3449ac0", "structural_hash": "5cf2f6077fc65e1a79a4bdff0f970b6a22370ca4766d1cf81795f8999cca303e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14722.go", "upstream_id": "BenchmarkTest14722", "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\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tcapture := func() string { return forwardedIP }\n\tdata := capture()\n\tvalues := strings.Split(data, \",\")\n\tif len(values) > 0 {\n\t\tc.Header(\"X-Param-First\", values[0])\n\t\tc.Header(\"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:gin:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b60d7947065816ea71e91face9b0b6555606d284a715a2601125287d51c1b83", "structural_hash": "a7374d4a110de8536ac965d3b53c9d3de8cbe82f95fe9ab440c0dff803c18be3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07291.js", "upstream_id": "BenchmarkTest07291", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const data = \"\" + userInput;\n libxmljs.parseXml(data);\n ctx.body = { ack: 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:koa:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04d03be67b544a201f85dfdb810847f132158786132547fc18083390740a3d66", "structural_hash": "4bc74f28f0fbbcabdf5b7a36cf5def791cb9cf22f584522d2b332f82bd27ff42", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04205.rs", "upstream_id": "BenchmarkTest04205", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse tokio::process::Command;\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 if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n Command::new(\"bash\").arg(\"-c\").arg(format!(\"echo {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bfc5ccec161ac0a9faf39dfc5a4cf7469736030c781f10a3d3bbcfc451773e1", "structural_hash": "8b5dd36fe3c8d6bf98fd0d05aa988d4334b98a71d1c6a4d5520a8072078af1bd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32147.go", "upstream_id": "BenchmarkTest32147", "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\tsegments := strings.Split(graphqlVar, \",\")\n\tdata := strings.Join(segments, \" \")\n\tc.JSON(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:gin:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49c212ecb5eed1acb17002640701077dd99b9fe3d13020ad67ba665a23f3fa73", "structural_hash": "34eda3b0eaace44e35f49aa141c288039d5226476fdb61fafb0213e4816741af", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00111.php", "upstream_id": "BenchmarkTest00111", "language": "php", "code": "query->get('id', '');\n $data = '' . $userInput;\n $digest = md5((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "084544d165cb3be72b60bde2aec3c9691d14b63a5f058ad1562c26f3dec793be", "structural_hash": "744fb20b8b14128ce258d04694bb6ce516f9a2e174dcb9b452264f226cb9ba01", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05022.py", "upstream_id": "BenchmarkTest05022", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\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 allowed_ext = ('.jpg', '.png', '.gif', '.pdf')\n if not data.lower().endswith(allowed_ext):\n return JSONResponse({'error': 'invalid file type'}, status_code=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 {\"updated\": True}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aae55dca6391348b23768c4753c22c7e5952e7c801a06d5069a1dc4d45dfb987", "structural_hash": "9e194c95390250779c71ab572b3a8da13c7b0f76bc8d484aa2b069bb692eca83", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02973.cpp", "upstream_id": "BenchmarkTest02973", "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 std::string safe = (data == \"asc\" || data == \"desc\") ? data : std::string(\"asc\");\n std::printf(\"X-Trace-Id: %s\\r\\n\", safe.c_str());\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "419d89126a7689bf5fb806b79d5d212eb3298650741e02770db2c86320680d7a", "structural_hash": "6953bf62cea0108b72629ff31731de2a8a9eba5f69afa0acf2af521870c3e1b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03386.rb", "upstream_id": "BenchmarkTest03386", "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 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 if %w[read write admin].include?(processed.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed21167cabd8f9d584e77fa8dafebecc3428f2027bc466f53036a626fed54594", "structural_hash": "1a9277c4bbcb795f0f9047984a2f17c510da5c56702a1a64160d8805ddf5f569", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04993.php", "upstream_id": "BenchmarkTest04993", "language": "php", "code": "request->get('field', '');\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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2857d0c999d85fb6417b8d4d30bf7752369d30813cc46848105b5d96970af065", "structural_hash": "5734d56a700ac29df50e0b18ce993970c1063077b9d89b0bb9a99045a6c9a069", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09913.c", "upstream_id": "BenchmarkTest09913", "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 srand((unsigned)time(NULL));\n int _token = rand();\n printf(\"token for %s: %d\\n\", data, _token);\n}", "label": 1, "cwe": ["CWE-336"], "category": "same_seed_prng", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29093106ad76d3cae99660c2ee8d214e3a33029a2c3fec57bddc39d9afc3a259", "structural_hash": "a93fe5470ce5d294cc76d937e18bd8ac470294f3c8ef49d8d72a0e224585faab", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05499.c", "upstream_id": "BenchmarkTest05499", "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 printf(data);\n printf(\"\\n\");\n}", "label": 1, "cwe": ["CWE-134"], "category": "format_string", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:format_string", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1c08834109b4e7b43b1b22f3346e1cadd1bfcfd428849f6f5274b21f77aa758", "structural_hash": "ded5e9b8de26bafa161a05414cefca6f0938e148d0fc889d622630724eb822d2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04808.ts", "upstream_id": "BenchmarkTest04808", "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 _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 return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e85fc40606ce5d43bc1d3af1869378e7f6d5acef3ae20cb4f3a183b5ae22655b", "structural_hash": "9ced56cbb193346e1731ce647e2bd2e54980eaa1f4afa7c6cb02e01844b1f1d5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04625.java", "upstream_id": "BenchmarkTest04625", "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.Supplier valueSupplier = () -> \"payload:\" + cookieValue;\n String data = valueSupplier.get();\n org.owasp.html.PolicyFactory policy = new org.owasp.html.HtmlPolicyBuilder().allowCommonInlineFormattingElements().toFactory();\n String processed = policy.sanitize(data);\n response.getWriter().print(\"
\" + processed + \"
\");\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "328873bf86a61db8bd6be5b1283e1380418a454244cd9b5f838f490488b73cfe", "structural_hash": "0643ffae819c9b49a7b9fc0067658b007cb009eb7e9ef5587accbc79238af1da", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_07727.js", "upstream_id": "BenchmarkTest07727", "language": "javascript", "code": "const zod = require(\"zod\");\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 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 inputPattern = /[a-zA-Z0-9_-]+/;\n if (inputPattern.test(String(processed))) {\n res.json({ validated: String(processed) }); return;\n }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2033aa3c611ba2238ebcf7bc7007af678e09d42bf108db681b74b5b63e647ce9", "structural_hash": "81e4556bef21571be4d53967b1ddbd68396f2fd79433f1d1502dd1eeb8b1dd3f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01981.rb", "upstream_id": "BenchmarkTest01981", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"redis\"\nrequire \"resolv\"\nrequire \"ipaddr\"\nrequire \"open-uri\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = Redis.new.get(\"user_data\").to_s\n transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.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 halt 403, JSON.generate({ error: \"private range blocked\" })\n return\n end\n target_url = data\n URI.open(target_url).read\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc06aa42320b8791f5a9e41a3de3eba465091cf80ef1739ab426e2f864a448fd", "structural_hash": "dfc9a2679f61d4accef9904995761144d463b4e3162f0cd4707cf3b31b8fce99", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05332.py", "upstream_id": "BenchmarkTest05332", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\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 db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n ctx = RequestContext(db_value, source='form')\n data = ctx.payload\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n trusted_claim = str(processed)\n return JSONResponse({'trusted': trusted_claim}, status_code=200)", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5f7c62f9d57d03a37e32ba4fa874eb3eb16a4aefdcdcdd7e2fa7ed24c8fb9d7", "structural_hash": "39701908c70a92552cd2693923968203cb89eb3d796657bcb099a1a8d8e2fe78", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03124.go", "upstream_id": "BenchmarkTest03124", "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\tuserID := c.Query(\"id\")\n\tapplyPolicy := func(v string) string { return strings.TrimSpace(v) }\n\tdata := applyPolicy(userID)\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\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\tc.String(http.StatusBadRequest, \"index out of range\")\n\t\treturn\n\t}\n\tc.Header(\"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:gin:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "477416e5a8fe120786d80f618045ddfce7051dbe522474a2958d4514c01a058b", "structural_hash": "a1928b69da4a29e243a8ced27d39ffaf4dfdbf0eebcd641df6de7f39b4c10071", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04091.py", "upstream_id": "BenchmarkTest04091", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n data = '%s' % (ua_value,)\n result = db.fetch_one('SELECT name FROM users WHERE id = ?', (str(data),))\n value = result['name']\n return JSONResponse({'name': str(value)}, status_code=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e727ff335e9eb00e7fa0166b9471e2c5ceb29a57efc3a1f04d387f93b863a08c", "structural_hash": "f678c809277238c021889b04d955caaef3cd33a32a685c65077a725ba285e187", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21428.js", "upstream_id": "BenchmarkTest21428", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n const _handlers = { primary: () => {\n childProcess.execSync(\"echo \" + data);\n } };\n _handlers[\"primary\"]();\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-676"], "category": "dangerous_function", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1460aa9277188b0837216561c98c6bd12af796e7c22f64ca116416fdfc3c637f", "structural_hash": "df8794cc858f9379bc808ffde21422f58c80294be00c9c15a52e6b5b2ced1f69", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06009.sh", "upstream_id": "BenchmarkTest06009", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\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 xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2fa78d0fdb0af4097d83f1b745b0310cbfd3956e6416de7243c4c289829bfe6d", "structural_hash": "6754b4101475630ade2b34e015522dba16ca6a32596061bc98ebeda8e295afb0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02798.cpp", "upstream_id": "BenchmarkTest02798", "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 std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n long _n = std::strtol(data.c_str(), nullptr, 10);\n char *_buf = new (std::nothrow) char[(size_t)_n];\n delete[] _buf;\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57fd25f2a019626463374fec0742042d39db26589479218cedb5de9350dd27d1", "structural_hash": "d5bb3a7f098fb6b1db3918f6b0af27d826d82caf3cfd588aecfac9b28f2272bf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03651.ts", "upstream_id": "BenchmarkTest03651", "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 db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fed43880abbed68443ca341f94d22a7d33f4cc912747d488cbb4c26aadb66217", "structural_hash": "20c3538bfb1e659deb1bf83c9959cf0957b56f50ccf1c488fd6966581df52566", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05521.rb", "upstream_id": "BenchmarkTest05521", "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 transform = ->(v) { v.to_s.unicode_normalize(:nfc) }\n data = transform.call(user_input)\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "baddba7253e05e906048556292570508042d2f3340c276df935b01eb835cfa18", "structural_hash": "93c3922478df9ddca021a936a1b5078f11c2e497a6343b8de06b2619e6042ea1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18444.js", "upstream_id": "BenchmarkTest18444", "language": "javascript", "code": "const http = require(\"http\");\nconst nodeUtil = require(\"util\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n let _incHost = \"\";\n try { _incHost = new URL(String(data)).hostname; } catch (e) { }\n if ([\"cdn.trusted.internal\", \"modules.trusted.internal\"].includes(_incHost)) {\n http.get(data);\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0ad451ae0adbfee0a27b6f142e8f69dbcb4fe7afe94ec3e226e716021aea2c52", "structural_hash": "9891d114ab01074726caf28d2d63ec67a61114e0f31d34e819dadae75d35e7de", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06719.c", "upstream_id": "BenchmarkTest06719", "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 printf(data);\n printf(\"\\n\");\n}", "label": 1, "cwe": ["CWE-134"], "category": "format_string", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:format_string", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b81e2367cd58411c052b488b410c19b65ff3dbf6697814df610506499c453679", "structural_hash": "9d0f203beb16b17738daf980a75dc9e21f183021f04a03a9f1162b9dac1dc885", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04600.c", "upstream_id": "BenchmarkTest04600", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 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 *_cred = getenv(\"APP_DB_PASSWORD\");\n if (_cred == NULL) _cred = \"\";\n if (strcmp(data, _cred) == 0) { printf(\"auth ok\\n\"); }\n}", "label": 0, "cwe": ["CWE-259"], "category": "hardcoded_password", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d8a64b570f5a1d7debbf984ccc6257b967afbe03175079b2203aafe4e4f01ba", "structural_hash": "368029edc02957ee397c7d76625c69f8c2bc772acfacb1e6c5aa8aa29c1a3513", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02465.php", "upstream_id": "BenchmarkTest02465", "language": "php", "code": "header('Origin', '');\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 exec('echo ' . (string)$processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c313255f210b9f33a11535ec40242b9e7262693b6e1d4fa7f3a36d2b82509ce", "structural_hash": "079981fb3a2d4827a713d0bb0e9065234621448e151494173bccb5ecdbdef6da", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00108.go", "upstream_id": "BenchmarkTest00108", "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/sqs\"\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\tsqsClient.SendMessage(context.Background(), &sqs.SendMessageInput{\n\t\tQueueUrl: aws.String(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\"),\n\t\tMessageBody: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f376f10a802b95fbb9bd41d1d987f153bce9a6234999cc646bb1bb5fbb227569", "structural_hash": "33373c5718908b6c8adcf6b8dd9aab08d5d38fd05adac242c2fabca11b6ca771", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00706.ts", "upstream_id": "BenchmarkTest00706", "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 eval(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5023d5c2fd20b4572a4830f1d2e374e70a4a8eac4225f48c6e3529cca28fe9f6", "structural_hash": "36d92c60e907022efaa18a686302373b88582da59d02b948a87cde789dbc178e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_37579.js", "upstream_id": "BenchmarkTest37579", "language": "javascript", "code": "const https = require(\"https\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n const targetUrl = String(processed);\n if (targetUrl.startsWith(\"https://\")) {\n https.get(targetUrl + \"/lookup\", () => {});\n }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-183"], "category": "permissive_allowlist", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:permissive_allowlist", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3669f701eece4c690944730fbdd45a12f692887d495e63923853fa8bf1784805", "structural_hash": "c05214baf40a196d1c0ded33d0bd0d65973a74af31b6bc7d4d3075939813bdea", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05514.py", "upstream_id": "BenchmarkTest05514", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\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 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 JSONResponse({'name': str(value)}, status_code=200)", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edea1d229a9c550196713a235afbd825977c192085983b8d5ad1b69a23a8d035", "structural_hash": "3a572a33b8111929a230a0b0378e099857455a51404681b78106a20b436e31b7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12647.c", "upstream_id": "BenchmarkTest12647", "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 long _v = strtol(data, NULL, 10);\n unsigned int _u = (unsigned int)_v;\n printf(\"%u\\n\", _u);\n}", "label": 1, "cwe": ["CWE-195"], "category": "signed_to_unsigned", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:signed_to_unsigned", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4465f28f78b16470eb46dc198a1c02d28f143f9b2f08443866c1894b0c5b4eea", "structural_hash": "e7e14b8194f08ca846974a4f757274108e412608eb7cef95d3eeb621e8822342", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04303.rs", "upstream_id": "BenchmarkTest04303", "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 tokens: Vec<&str> = xml_value.split(\",\").collect();\n let data = tokens.join(\",\");\n if ![\".jpg\", \".png\", \".gif\", \".pdf\"].iter().any(|ext| data.to_lowercase().ends_with(ext)) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let entry_file = data.clone();\n tokio::fs::write(format!(\"/var/uploads/{}\", entry_file), b\"data\").await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20321ec5c8e2cc938e459d8fe5f67981e22187aabb80a503988887c85c40ef58", "structural_hash": "a8de4438eca931ddbb6dc609b4351fc3566577c4a5d4979ba3db85ba1e7bc71c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02444.rb", "upstream_id": "BenchmarkTest02444", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n data = user_input.split.join(\" \")\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 DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c818338abde58e9cd0ac61b2420513c5cd89e7015827573068897caaf72226bd", "structural_hash": "9ba6f3125445a7ef5d0afcb3940abad4de96627b9684ca0aa636cc6f209aa07b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05282.rs", "upstream_id": "BenchmarkTest05282", "language": "rust", "code": "use axum::extract::Query;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\nuse tokio::process::Command;\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 if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7932406157fad79511fcdbe7a1078e90bda49961b3d4c1cd92805ff50b8fe5a4", "structural_hash": "3c11f0967ef3d1c6d0c5884775b0c1aef354a500d690a7b8e2a2bbf23f49fd9d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00588.sh", "upstream_id": "BenchmarkTest00588", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n printf -v data \"%s\" \"${user_input}\"\n xmllint --xpath \"//user[name='$data']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07eee4df085115266c77736bdd82ac0325b36d4e769ae97f580a7bd1307e762f", "structural_hash": "b122b177f822939cd439a06c6dfb58177f53be86652d5b58a606e9422c5daa70", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04046.rs", "upstream_id": "BenchmarkTest04046", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 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 _dispatch: std::pin::Pin + Send>> = Box::pin(async move {\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n });\n _dispatch.await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "116451bdafd2ccc9fabf7778c4db0e54d87a82cd598bbb4c25a533852114118a", "structural_hash": "b264a86cb4fae6e180606036101e1c164529c26b584daa3662e9da0b2873ad58", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02135.py", "upstream_id": "BenchmarkTest02135", "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 trusted_claim = str(data)\n return JSONResponse({'trusted': trusted_claim}, status_code=200)", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2d6f6a550d7cbfbf6028203c77d83954d64548bbe72560902aeb21465ebde489", "structural_hash": "54b5816a817a142d47a0c912f03034ab3db6ad174a71fdec16ede47f921b99b3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03256.cpp", "upstream_id": "BenchmarkTest03256", "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 std::string data;\n if (!user_input.empty()) data = user_input;\n const char *_argv[] = { \"/bin/echo\", data.c_str(), nullptr };\n execv(\"/bin/echo\", const_cast(_argv));\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0db2b901e64329f4f72676499bc0070a05e107c427880dcf2b7d500ed0c9bf6e", "structural_hash": "67553b5a5ec5f95f378a620accd68cf759913cded77c9500a04a516ebe0161dd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28743.sh", "upstream_id": "BenchmarkTest28743", "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 (\n exec \"$data\" --status\n ) &\n wait $!\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d9fc0ee757871f1a35a19ab2879e88616675764600405945587f5b70e4a79e60", "structural_hash": "4bcdc69cb68dad728c833113027958480118a7f61b6b1e8d8d3d57d108e99aec", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04858.py", "upstream_id": "BenchmarkTest04858", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n data = ' '.join(str(user_id).split(' '))\n logging.info('User action: ' + str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41aa47c106492f38ea7e6756b02744534a1c7be5db1a163e2c764167de5cf353", "structural_hash": "2e6fc3f83e347dc4a6b001d44c6270d51480f02fe9946a8bfd9c580f2031389d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04118.ts", "upstream_id": "BenchmarkTest04118", "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 tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "476475fa15888e2695369a29a175a9541243daca6b87c8c037fcb386ee077532", "structural_hash": "e15f1b2b779ad603ac43615589447d366dae64e4e1da820bb8a1ad30fc5bfd87", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02062.php", "upstream_id": "BenchmarkTest02062", "language": "php", "code": "header('Host', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n exec('echo ' . (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b9e1a33dc3b23d59146db8ae6c8cc9d7a52d96a7431468d8a3ee2f077c102f9", "structural_hash": "1b0cd184d5898e63d96c51b4d649c928e667e730eb0ad9e6105d77544538d007", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05767.java", "upstream_id": "BenchmarkTest05767", "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 prefix = originValue.length() > 0 ? originValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = originValue.toLowerCase(); break;\n case \"f\": data = originValue.toUpperCase(); break;\n default: data = originValue.strip(); break;\n }\n return Response.ok(\"
\" + data + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e2e4e154bd0ece107490a527b7f1e3aa69dd313dbfbdbca155af9eaa5a213b6", "structural_hash": "fac967a5bcaf3646354b4f60453dbad003fa184c4cd186c8df06aa8e9293c1f2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04710.py", "upstream_id": "BenchmarkTest04710", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\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 logging.info('User action: ' + str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3f070a1fcf847f4a0ff02ddc0c38a948d0f2de02c77798f3247b0fd638ed6c5", "structural_hash": "860d038fc0977a526f528c4605d64cc0a1814f23b37851033b925bd475cea725", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_29012.sh", "upstream_id": "BenchmarkTest29012", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "307aa75a89b111218db03e20d53c9c9c883a9a4d6563bc528ebb54c0e3dee01f", "structural_hash": "4a1ae4ca9220737406a0a18585df9dca7fd013dc5815b98c7bd0b38c91fda91d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03072.java", "upstream_id": "BenchmarkTest03072", "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 java.util.Set allowed = java.util.Set.of(\"ls\", \"cat\", \"date\", \"echo\");\n if (!allowed.contains(data)) { return Response.status(403).build(); }\n String allowedBin = data;\n new ProcessBuilder(allowedBin).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b74ba38b1bd212a63b67ee6b6d11570f70ddcb64b0e8c63bd103f0be46bc8c32", "structural_hash": "c060f5a02ec990416993cfd09e016bea14979a6314f9afada902db121332a41f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20468.go", "upstream_id": "BenchmarkTest20468", "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\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tc.JSON(200, map[string]string{\"echo\": processed})\n}", "label": 0, "cwe": ["CWE-74"], "category": "improper_input_neutralize", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:improper_input_neutralize", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "444466a8273ad7f3f6743e8784aceb51075e893eec658b48bd4ab01adb829d48", "structural_hash": "519bcdd8987e0dcf70c0b46cd798226fbc542951a024146b02b851ba5871cea2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01882.php", "upstream_id": "BenchmarkTest01882", "language": "php", "code": "headers->get('User-Agent', '');\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('/\\.(jpg|png|gif|pdf)$/i', (string)$data)) { return new JsonResponse(['error' => 'invalid type'], 400); }\n $entryFile = (string)$data;\n file_put_contents('/var/uploads/' . $entryFile, 'data');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85a2b4a26c94438ef48dd1c6a5688373b2b621c2cec1157f1f1cd20e6dc62a61", "structural_hash": "63edeedd1991b99b0cab4ea6a72f3c39c98ae9d441145846661e5cc27b08ceb8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08296.sh", "upstream_id": "BenchmarkTest08296", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ba40ec77d73a9e15dd4f48a3c5cb99a437aa1b03ef1a6b9f2baa990975ec618", "structural_hash": "2d981e783d330113d6fe3cd18f61a2581f00f58222a875dd4a35ea321d934765", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00411.py", "upstream_id": "BenchmarkTest00411", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n host_value = request.headers.get('host', '')\n parts = str(host_value).split(',')\n data = ','.join(parts)\n logging.info('User action: ' + str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a45ec6029ce27ac5e2ebeb62fb2b4c6644380b3fc1d0f147d29c333a304a9b9", "structural_hash": "af5ef34470bf28135185113ed622c3632880c74b59eecfb9581fb0e23d9cd8ac", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02695.java", "upstream_id": "BenchmarkTest02695", "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.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(jsonValue);\n String data = normalizer.apply(jsonValue);\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n return Response.ok(\"
\" + data + \"
\", MediaType.TEXT_HTML).build();\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "193d994f2867f13c25828f044f1efc680d6cb6914ceba4dd9f81fc6ebe191d0e", "structural_hash": "974d40a1a791bd773c1d6ebca929c06deabe2e952a749df79e062933c0373e45", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07998.go", "upstream_id": "BenchmarkTest07998", "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\tvar data string\n\tfor _, token := range strings.Split(multipartValue, \",\") {\n\t\tdata = token\n\t}\n\tfor _, a := range []string{\"read\", \"write\", \"delete\", \"admin\"} {\n\t\tif a == data {\n\t\t\tc.JSON(http.StatusOK, map[string]string{\"access\": \"granted\", \"role\": \"admin\"})\n\t\t\treturn\n\t\t}\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "041715856233197c3335cbe07e9201f46d9c764fb1df28d5049b86d683fcc69e", "structural_hash": "310be56d064036376fa10cb249c96330e1ded2ad6ff148026a71800d79e9a736", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04800.java", "upstream_id": "BenchmarkTest04800", "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.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", pathValue);\n String data = sw.toString();\n String processed = org.owasp.encoder.Encode.forHtml(data);\n response.getWriter().print(\"
\" + processed + \"
\");\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b5637d82eb145d004ad9251cc0d25d4a0ad70c4264f637f196e3871a4a677ac", "structural_hash": "f2fd58b8c920383ba8874eccfea8a2ae5f8d2e839681dd31c1e2773b8685e2dc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03495.php", "upstream_id": "BenchmarkTest03495", "language": "php", "code": "getContent();\n $data = call_user_func('strval', $userInput);\n register_shutdown_function(function() use ($data) {\n exec('echo ' . (string)$data);\n });\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a2fbce9a4e0948434e70f6b5c09b0df5df9a9aee00027e3006262188779c398f", "structural_hash": "9596a9dc9fe59b3aa3dbdb3227f27dedb4c79a371a6c47acda4eee9916bb9eed", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_12384.js", "upstream_id": "BenchmarkTest12384", "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 tokens = String(userInput).split(',');\n const data = tokens.join(',');\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n db.query(\"SELECT * FROM users WHERE id = '\" + processed + \"'\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec67dc6338dacb5f6f3ac5b35abce7e0bbecad595b0bc19f7adc276459e23726", "structural_hash": "a285b67412c5c071beeab530ccb41467e192d4a7dacffa95d4a5c0bbb39ca8d9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03375.ts", "upstream_id": "BenchmarkTest03375", "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: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a2cb7b89585ed266dc3224e338a97e61103f5bb7da4aa4357b20003673ba532", "structural_hash": "75e558b0ca7d4ead48cecd2b81e459a86448870d40f9ae2437ed2fb4bb407f57", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30033.sh", "upstream_id": "BenchmarkTest30033", "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\" | grep -qE \"^[0-9]+$\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:unusual_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab1d1c606aaa20668a6e41e0e1df36b1c8075466b23433bade81deb6e712b3e3", "structural_hash": "ab249f115e24f51293db4f24341336781d47d69fcb01677f9a8e58d26a54cd1d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05919.sh", "upstream_id": "BenchmarkTest05919", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:unusual_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6224cac1c41bfa1aa44502e93c732bee5260c4df4508ea177df29b6736d7a44a", "structural_hash": "608f529c19316966fb13f6aba3e185a9c72ede2da21fe4c56be3f19d8cec8f65", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20370.sh", "upstream_id": "BenchmarkTest20370", "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 echo -n \"$data\" | sha256sum\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02e64db600fe97b94e6e5fdb17c5d48ce084ae3a74cf72fb193523bdab40248a", "structural_hash": "ebe800855ae6f7f5e913d84a961491e1c881af5b930bd19dc79fd9fcab5ef84a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00718.rs", "upstream_id": "BenchmarkTest00718", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = 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 = xml_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if std::env::var(\"APP_ENV\").unwrap_or_default() != \"test\" {\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e220e327e1c869ba6d4e59ed52cbbbaf59cb34b068e25d283018655f7bb0bb1", "structural_hash": "442e3c323e655975667a1aeb4721a2ead6e8f0150ab4c12cb8fc270c6f08d1d8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04429.rb", "upstream_id": "BenchmarkTest04429", "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 _limit = 4096\n reader = -> { user_input.to_s[0, _limit] }\n data = reader.call\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc12630dd4fffb3c8ca2e5b07deec36f8a161b1124b09b304be89c66c91774ee", "structural_hash": "c2721c049952264ee4006c96c7fc3f6d19c57e7c7a58da65ea9cd1e30ebe3ae5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14502.c", "upstream_id": "BenchmarkTest14502", "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 _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-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:symlink_following", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "490e2e120aa6fd3cecad3974f47e5815a6d8deb7ae44c8c6f99f004bce081c17", "structural_hash": "3d761c276f57722df6c2d90d8577eae5e6eae43ad90102da36aaa5dc4d306f23", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36554.go", "upstream_id": "BenchmarkTest36554", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n\t\"go.mongodb.org/mongo-driver/bson\"\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\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\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\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "441db433094a00725f561b1540ac86da4293ce079c37dee065e7307288d94121", "structural_hash": "fa8e8d4fa57b4738e782a7c464d84096b220426a522fd65bf39ea0e3357b1ae9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03433.c", "upstream_id": "BenchmarkTest03433", "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 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 printf(\"token for %s: %02x\\n\", data, _rnd[0]);\n}", "label": 0, "cwe": ["CWE-1241"], "category": "predictable_rng_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c47b240570b87a28a85fd6d24db363989473fc8ceecc6b58edcb2e32a45597c5", "structural_hash": "68c777a4e2dffba18a42a97163f1fb91f22de292b085f5e1fed8119118697dab", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03296.py", "upstream_id": "BenchmarkTest03296", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import HTMLResponse\nfrom fastapi import Form\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 return HTMLResponse('
' + str(data) + '
')", "label": 1, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "faeb0d8350b6d1cfae2124dfc7bcca2dc923506a943fd80e8c86f368ccac6dc2", "structural_hash": "6acd81b28901d4b7b932ee662db7b861485fa7a6e532210194ec9c3e3f5db969", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28039.sh", "upstream_id": "BenchmarkTest28039", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n exec \"$data\" --status\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a3b2826d9c43c9fb7786b4595b1b8d04a90aaa58ee2832a5ae1265e2f3ab0d95", "structural_hash": "46d6723c85173af06d436e7555a7aa9e1ed5bc3a443fe82aee998e0373895a79", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19345.go", "upstream_id": "BenchmarkTest19345", "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\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", pathValue)\n\tdata := _sb.String()\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5dbc42073e6ae058f490c2e7e605ca5210aaac2cb1899109612e4f381a4fe28d", "structural_hash": "48006224395742e9aa289423478166ef325f3a72bd032935fcf51978b2480fd4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05817.sh", "upstream_id": "BenchmarkTest05817", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\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 /bin/echo|/bin/cat|/usr/bin/id) allowed_bin=$data;; *) echo \"forbidden binary\" >&2; exit 1;; esac\n exec \"$allowed_bin\" --status\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7cfe3c0066bda6c82fec66fa5b7a16071af4c40a66041b4e4e48681a61c97c9", "structural_hash": "441f493ecb942db1d0843de062f55d9357dff4d0460521017ac5d4a26fbe21a4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04661.c", "upstream_id": "BenchmarkTest04661", "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 long _sz = strtol(user_input, NULL, 10);\n if (_sz <= 0 || _sz > 65536) return;\n char *_dst = malloc((size_t)_sz + 1);\n if (_dst) { strncpy(_dst, user_input, (size_t)_sz); _dst[_sz] = '\\0'; free(_dst); }\n}", "label": 0, "cwe": ["CWE-680"], "category": "int_overflow_buffer", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:int_overflow_buffer", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1764f170f70cdf4876cdb79e45384678b42f7ecf31172055a1da248c80e869ed", "structural_hash": "9ed29a7efa55c1b78de10c9e3e8c0516c79803c5b729eef0b1c733bf7a8fe0d0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00300.php", "upstream_id": "BenchmarkTest00300", "language": "php", "code": "getContent();\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n $requested = (int) $data;\n $allocated = $requested + 1;\n return new JsonResponse(['allocated' => $allocated], 200);\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af86229400bf17c21dfb3c62b9c77320b0aae56ec6c65ab7f3054b3b11a7702b", "structural_hash": "dcd7648a5ca2ad7af2d9f014dbd998cc835adf2a819d9be2d7207a29d0c9764c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34343.js", "upstream_id": "BenchmarkTest34343", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.field || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _result = db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(data)]);\n if (_result.affected === 0) { res.status(500).json({error: \"operation reported no effect\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51b770df3bac6aa7c84b79fe2afab9cd2cea2371531a8cbdc30f5f8dddb50db1", "structural_hash": "b40d73ad0dbcb5a2ff83a818c4bdb2bb8726924f21f61b8a80cbbfc6bc1f4702", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02142.cpp", "upstream_id": "BenchmarkTest02142", "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_AUTHORIZATION\");\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 long _n = std::strtol(data.c_str(), nullptr, 10);\n if (_n < 0 || _n > 1048576) return;\n char *_buf = new (std::nothrow) char[(size_t)_n];\n delete[] _buf;\n}", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e27172297e2c286221455595061125f90e4f16aad3034f2ad5d60011ae50f03", "structural_hash": "06b7afd18ff64fae5eb01a267b39d670618abdd9a81f8b538d6250a8eb38daf9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05526.rs", "upstream_id": "BenchmarkTest05526", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\npub async fn benchmark_case() -> impl IntoResponse {\n let stdin_value = { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().to_string() };\n let transform = |v: String| v.trim().to_string();\n let data = transform(stdin_value.clone());\n Command::new(\"bash\").arg(\"-c\").arg(format!(\"echo {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b7ba094b7113e01b71fedffc33ba356f06803ff545535aee5505dacd9c869ab", "structural_hash": "8e73babebc7f2a0b95354ed478f1ab93a51a58f5ad5c680895b09a53ab05374d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_20605.sh", "upstream_id": "BenchmarkTest20605", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n ulimit -v 524288\n if [[ \"$data\" =~ ^[0-9]+$ ]]; then _req=\"$data\"; else _req=0; fi\n (( _req > 1024 )) && _req=1024\n dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$_req\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5b3945c196744b9f6a48c54b08ea0ca9a67a064b50bc16fb6a4270f858657b3", "structural_hash": "00ea7aa36f340067f4ed96850760b109159b9cef72f0561d20e12a09946ddebe", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04732.rb", "upstream_id": "BenchmarkTest04732", "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 unless session[:role] == \"admin\"\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a3aceb56652ab0fcffb7a6921ddde86c4267ef322346da3d005e322adbc3909", "structural_hash": "8bfa9c75fcb1fc45ce824d416f64fc863468ce863f35912dd4a492b702d58d00", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/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 \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 std::string _truncated = data.substr(0, 64);\n bool _authok = !_truncated.empty();\n if (_authok) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8d80c8226caab7000ffd3f7dbccc5e811a736538638374ce3003a2f532cbb64", "structural_hash": "efa0751448d8b0e27f7020e2afbb85455126b9600ca978869054d421cbdc0d44", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02570.cpp", "upstream_id": "BenchmarkTest02570", "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 const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) res.set_content(\"authorized\", \"text/plain\"); else res.set_content(\"forbidden\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "54513d0b0dca13637d58befd2810be7c99bbd34fa4e33ebcfa1697f70bc5b84b", "structural_hash": "21385ecc9c474107553cdb954ebf7e0e54bdf3d10a32434694a4dcd6b5b78a68", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26114.sh", "upstream_id": "BenchmarkTest26114", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6611f306124b4b70b67bd35b1d40e375c08414ceec5c10e020749c812e9aefed", "structural_hash": "aab75d88fcec4b49cab0199e616347d3e50c044c2211b7ce6f60cc5767cc371d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03823.py", "upstream_id": "BenchmarkTest03823", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\nimport re\nfrom starlette.responses import JSONResponse\ndef coalesce_blank(value):\n return value or ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n origin_value = request.headers.get('origin', '')\n data = coalesce_blank(origin_value)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n logging.info('User action: ' + str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a51e2f60e22331f1b239081439d1bf7101e5dbfaaf8420d93cf636fbf0c29d6", "structural_hash": "9901ed2f7e4e60aa757113883d706a7ff6989cc0902b622b53e29f00eb0ddc9c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest04842.java", "upstream_id": "BenchmarkTest04842", "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.*;\nimport javax.net.ssl.*;\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 String data = uaValue.isEmpty() ? \"default\" : uaValue;\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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71d5e5f0e49ecf543ae11ad37719d445fe10640eaaaa7e5f372d23c421e44487", "structural_hash": "86cf19062a520980e7c1e53994ed44fd6246413af1615d859f820f4ad4fb6dd2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00361.java", "upstream_id": "BenchmarkTest00361", "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.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(userId);\n String data = normalizer.apply(userId);\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n return Response.status(400).entity(\"forbidden\").build();\n }\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccec661c76725985e967707bc3933739d612094774f3eec6c23989c2842ceb68", "structural_hash": "becdbbbbe9f851ab5b667a74d3382ad5b4ddb73ea8c57d4cfd2a3d31c27535b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04153.rs", "upstream_id": "BenchmarkTest04153", "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 crate::shared::render_html(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb713e19345c817e854b44632282b557991cd24d09a8d5bb96e765c34e6c3eba", "structural_hash": "a2550306adf9e9b681599e4b4f41f4731988e922fde8c70e53de9f480b7eb2fc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_21643.js", "upstream_id": "BenchmarkTest21643", "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 const cell = /^[=+\\-@]/.test(String(data)) ? \"'\" + data : data;\n fs.appendFileSync(\"report.csv\", cell + \",ok\\n\");\n ctx.body = { 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:koa:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ec60b8f9fd52d228a326a7798e976df5241ff28b4e990df5857ecec24ad0453b", "structural_hash": "67dce68e2cd7d2afb83ad56cdbc3a0dc1dedc484bd138edb5e2969da0d1ecdd0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28494.sh", "upstream_id": "BenchmarkTest28494", "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 if [[ ! $data =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo \"invalid\"; exit 1; fi\n processed=\"$data\"\n xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "49a69e7562601b6454605a7f2e4d95f5daebbf50d1b0601eb02fccb3b29ff3c7", "structural_hash": "0f08fc9635b576bc250061d5817c1be6306864969b7bf4bdda270f583d1b1ee5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36563.go", "upstream_id": "BenchmarkTest36563", "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\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 <- fieldValue\n\tclose(_jobs)\n\tdata := <-_out\n\tDB.Exec(\"UPDATE users SET role = ? WHERE id = 1\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c8e8759fd0b122cb7b4ad165055d964d72f11ba8b76b63d5a07073b320e7c9b", "structural_hash": "bf835deed691834169a09aa9f8f92c3cb31bee78c8d4781ee4f395f95fcda630", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_25383.js", "upstream_id": "BenchmarkTest25383", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\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 libxmljs.parseXml(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cbe65276b6d9d1c0a1562146ce7303df63c8084dd7fee8f35fc32e9b3716e78", "structural_hash": "bcf062e69a19655b53dd47a7df287ca01c3d060ddd8ede2fc1a7f6efb0760647", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02518.php", "upstream_id": "BenchmarkTest02518", "language": "php", "code": "input('field', '');\n $data = urldecode($userInput);\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n exec('echo ' . (string)$processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f586b9a9d67a06d15b66bdc131d1ea4d3c929b07a45f4e980289bd237326e86", "structural_hash": "da377557e620c82136a95695838a9dfed1ae7d3120d3dc43914a8ad5be284dfd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00251.java", "upstream_id": "BenchmarkTest00251", "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 data = String.join(\" \", xmlValue.split(\"[ \\\\t]+\"));\n if (\"admin\".equals(data)) {\n return Response.ok(\"{\\\"role\\\":\\\"admin\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70824bd1653597dcd323b6c88d4ca354f6827491557de790e057df56091466f8", "structural_hash": "102fb69a147677b43f3b60a6072f4f8356fa9a53ff3132e8b8597f87192f7488", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02468.java", "upstream_id": "BenchmarkTest02468", "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.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(authHeader);\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 return Response.ok(nosqlResult != null ? nosqlResult.toJson() : \"{}\", MediaType.TEXT_HTML).build();\n }\n }\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e19ed22e8d0746d1ebd0f66fec3c07c88155e62b2f155968d2045f856b56291", "structural_hash": "4b704834493147d6ce5dc6d06d76f8705ff06b44f6170076b0be79ce8894a27b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05537.py", "upstream_id": "BenchmarkTest05537", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom types import SimpleNamespace\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 re.match(r'^.{1,256}$', str(data)):\n return JsonResponse({'error': 'schema invalid'}, status=400)\n resp = JsonResponse({'status': 'ok'})\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8db8c287dc5ff9e190d18fc67239873ea852f8e0969eab7741a958e37dcf5d1f", "structural_hash": "ef131005ad067a8fe01061f6c05aa5e932b817c9287b19ad08a98651ba59e7ce", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_01983.go", "upstream_id": "BenchmarkTest01983", "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\theaderValue := c.GetHeader(\"X-Custom-Header\")\n\tvar data string\n\tif headerValue != \"\" {\n\t\tdata = headerValue\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\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\tc.String(http.StatusBadRequest, \"index out of range\")\n\t\treturn\n\t}\n\tc.Header(\"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:gin:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44afeea32399b3a0c9670e4c7200eb1174481c70ceb7ed86adf895f2cb343b33", "structural_hash": "363b638cb50cd5cb527db5da4bb04271b8547c1f0391156f7bc30ea65ce6afeb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00923.c", "upstream_id": "BenchmarkTest00923", "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 srand((unsigned)time(NULL));\n int _token = rand();\n printf(\"token for %s: %d\\n\", data, _token);\n}", "label": 1, "cwe": ["CWE-342"], "category": "predictable_from_prev", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "048c4dbb9747f073ed24776a42e0d97c19a5087ef7191cf3d5b9fb5016062f0e", "structural_hash": "b7c990d9cb9ec0af23fa4a1e1f20b59673d27ea9f5ffaaf07b71311a568a8f77", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_25899.go", "upstream_id": "BenchmarkTest25899", "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\tdata := originValue\n\tif _, after, ok := strings.Cut(originValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-390"], "category": "error_no_action", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e32553f2a38ee66d4444d615c0c1bb41d08dec862f4785c7885a5f65c92ba720", "structural_hash": "dc3f988686817c29e6ab90de4e536be3f8cb2fa0e02a8f7fc2a2a3c0f0444823", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_36738.go", "upstream_id": "BenchmarkTest36738", "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\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\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "da51f0cf92ce9367f0e21eda9826b034ae803883ec26e452ae1e0dc77a7d8cc5", "structural_hash": "f9cc4efd3733bed5ba3ac7ca1a3e842da478a82c9169cb335a74289bc98222fc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03082.rb", "upstream_id": "BenchmarkTest03082", "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 system(\"echo \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "efb6fe8b0990df2d1839d630fe1c028dab8d97409be3591dfa4ae4b2f3d4ead9", "structural_hash": "73065de5da37624a58aae67bc537195c7d77309f87dc793442c2f0c7af917388", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01766.php", "upstream_id": "BenchmarkTest01766", "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 exec('echo ' . (string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "71e9c48d1b99f4a39c8a618745c9c2316dc893645ea02e35d0eda7521a444f31", "structural_hash": "763093875a9b26989519021afc05db6e1d39b24f07b01d5d1f8b439086d40804", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00865.php", "upstream_id": "BenchmarkTest00865", "language": "php", "code": "name;\n [$data] = [$userInput, 'http'];\n eval((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ca8fc695421556c2408b58e46e856b78aed61f0dd21eff87ef7ace9789b7e41e", "structural_hash": "d45d3969c4a078598240e6c4b2f66b87252298c6c667288011876bed708d7256", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_34254.go", "upstream_id": "BenchmarkTest34254", "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\tform := FormData{Payload: dbValue}\n\tdata := form.Payload\n\tdivisor, _ := strconv.Atoi(data)\n\tif divisor == 0 {\n\t\tc.String(400, \"zero division\")\n\t\treturn\n\t}\n\tc.JSON(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:gin:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5db2149dc94647fa4688c7a0b3c1e64b56fcf3d8e2b32bdacae65aa597a8822b", "structural_hash": "551ea7e2d00faa9b6f2c8d30442c7f38aea5cae43f32c3190a31a6db6d4c48d5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_28494.js", "upstream_id": "BenchmarkTest28494", "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 ctx.set(\"X-Frame-Options\", \"DENY\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "67d9b8e6d581b5eeb44eecafe2f56645ce03cfb79c78541570c12f515eb03957", "structural_hash": "51d1dd4b7365b629f05dd06c941c25937fe4c533448b06a1dd985ffee3c0ed30", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05914.java", "upstream_id": "BenchmarkTest05914", "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.nio.file.Files;\nimport java.nio.file.Paths;\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 = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> refererValue)\n .thenApply(v -> v.length() > 256 ? v.substring(0, 256).strip() : v.strip())\n .join();\n String normalizedPath = java.nio.file.Paths.get(data).normalize().toString();\n Files.write(Paths.get(\"/var/uploads/\" + normalizedPath), \"data\".getBytes());\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4628788e9b4adde572f380389976cdbbb1dcc392151df76fee85990985374d30", "structural_hash": "c82da015ad11c63ab21b47aa418678bb385eb3feef4955841fafc222bc185ee5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02969.cpp", "upstream_id": "BenchmarkTest02969", "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_AUTHORIZATION\");\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 _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7b803931bb70ab78badfb98ddba61aaab22bbf9d168380976c802d6516cc016", "structural_hash": "44320da30fa284c56178bf7c2bafb6262059bb9ef55c1b5e560fbe9814d49d77", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05061.php", "upstream_id": "BenchmarkTest05061", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n eval((string)$userInput);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e790354dc892d826a6e46272c512a3b3d7e0a50c9839ac8a165bd6b20801575", "structural_hash": "5c8aabf824eff1660bde0b391c243cf662e177040c4db5ee35f191e15a069f48", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05885.rb", "upstream_id": "BenchmarkTest05885", "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 pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n system(\"echo\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89a594d783d4e8d5c75028762161aa761a3cde89e3aeac284a1d07b1b50af912", "structural_hash": "2abc8f07899a7fda7ce305f191c6e7595b51ee4c66753dae910d4f8387c60a50", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02518.ts", "upstream_id": "BenchmarkTest02518", "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 _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 return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cec840647015e1ed52208efc10637ce6da8aae7813292bc404bb0f851dac38eb", "structural_hash": "8f76ddccf69b84f54b236447d77ba0c65ca8eefc6846228c2646e89d7782a32c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05527.go", "upstream_id": "BenchmarkTest05527", "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\thostValue := r.Host\n\tdata := strings.Join(strings.Fields(hostValue), \" \")\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-252"], "category": "unchecked_return", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f4237c2135981186aee882f2ab385fc7d7169b85215bfae1abbc909ff19277a", "structural_hash": "247953294057980e488d1de61edf817b61fb17a366bd1fd7ab4d237282e9b208", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_35363.go", "upstream_id": "BenchmarkTest35363", "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 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\tdivisor, _ := strconv.Atoi(data)\n\tc.JSON(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:gin:divide_by_zero", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a7b64d96694cabe1532b6e44530d522b1584b8fc97c4c48c97e692e410eab5ff", "structural_hash": "b02e5d57790f6969ce54f2390540e3693f99960b9e42671a8b5e7b9b34ff4eca", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/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 \nstatic std::string cpp_shared_input;\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 cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _msg = std::string(\"DEBUG query=\") + data + \" build=\" + __DATE__;\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0cecfb52fc34900ade1464fe8b95d15b21799be661892bced46c508678575cf7", "structural_hash": "fc740faf4d3fea3204d18038f6b29c19d0865791dc8178732f87f6eb74196110", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00155.java", "upstream_id": "BenchmarkTest00155", "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 @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 FormData payload = new FormData(authHeader);\n String data = payload.payload();\n org.owasp.html.PolicyFactory policy = new org.owasp.html.HtmlPolicyBuilder().allowCommonInlineFormattingElements().toFactory();\n String processed = policy.sanitize(data);\n return Response.ok(\"
\" + processed + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-80"], "category": "basic_xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80bd8943ec2e5613843c8d2e518eb6a064a90a2bc677d0b5afe84ab4d8e15e2d", "structural_hash": "6d3d133ebffa0c686124deb3ac31f34b49294c05927c99102627fa6008cf2bb0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03158.js", "upstream_id": "BenchmarkTest03158", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n if (process.env.NODE_ENV !== \"test\") {\n http.get(data);\n }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-941"], "category": "incorrect_comm_dest", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b33174fb0e93b1f8e20a3c21b657153323bb5d358a6ab3eba89d5e64529a631", "structural_hash": "0725a1244edd3a247672445c58fb3433d13943738588fe3363d87c34097baf23", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02200.php", "upstream_id": "BenchmarkTest02200", "language": "php", "code": "request->get('multipart_field', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f28953c152077e1e185d4366d5565cb2abd68230e6f48ac2d24bd778c8e58cf", "structural_hash": "edc73c5a8dcea3dc5b20e87ce595dbb674ecf6bfd69014db35da136e7ac9ca1f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13867.sh", "upstream_id": "BenchmarkTest13867", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 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 echo -n \"$data\" | sha256sum\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-760"], "category": "predictable_salt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d7e8704b7932801435ff6d3938fc220ea5988720559833ef8963bdd1f20b0a9", "structural_hash": "2e891136703b16f66323c7c9b86d07fc159d59466cdaff009ad207e5c6bcf35a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04064.rb", "upstream_id": "BenchmarkTest04064", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\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 DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1a9817f0c62acc2ef17a65b7754a23ef02ea327ca4e146075ce69b526dd0c3af", "structural_hash": "d920dc7aa8f6715f374e14e71997229a8864dc18b926883072c3ed527dc50f7a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01529.php", "upstream_id": "BenchmarkTest01529", "language": "php", "code": "text;\n $data = call_user_func('strval', $userInput);\n $_handlers = ['primary' => function () use ($data) {\n exec('echo ' . (string)$data);\n }];\n $_handlers['primary']();\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "756ea9bc5f4320f9e1036dd4ac7bf1d8549c5b906e73506e3e740efee173b360", "structural_hash": "ade54bf5ce625bf9f1b19d7acc82bef0610bf74e335d934abefd780854940619", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_00138.rs", "upstream_id": "BenchmarkTest00138", "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 = match forwarded_ip.chars().next() { Some(_) => forwarded_ip.clone(), None => \"default\".to_string() };\n crate::shared::render_html(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8e1cb6c0afb43eb9f9b721604f4da9db372783cb019278d98bb2df975bece0cf", "structural_hash": "a31583f971f5f612944160e09e68be58a86028da2a97b04e141fe4f66a7bab74", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00901.rs", "upstream_id": "BenchmarkTest00901", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 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 Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6696f85cf6a3959504ac45f495c9f91500a42272187b9c7eec6be13e3f098591", "structural_hash": "64fa2bee07309aa460bdaf7a399a748ac7cc28730ba350230d0a101961060972", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05654.java", "upstream_id": "BenchmarkTest05654", "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.Properties property = new java.util.Properties();\n property.load(new java.io.StringReader(\"rawValue=\" + headerValue.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 (\"admin\".equals(data)) {\n return Response.ok(\"{\\\"role\\\":\\\"admin\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8efb97c66996c23206dd91945b756cac77ec88b1c95ae8c14bbfa8b0955d52f5", "structural_hash": "20f66cfca58ce6da62d54ce60a75bd61bc238393a4474740063657057944c6cd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05868.rb", "upstream_id": "BenchmarkTest05868", "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 pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n render json: { auth: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e1a7f9aadfd91108a279b7a3b14c4a7cdcee51ebeebef9e6382547331eaef18d", "structural_hash": "ee68deb9483a649fd5409f4dc75d5da8c04739b9d8fbfccb3632d5dd8cd10ea7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02985.c", "upstream_id": "BenchmarkTest02985", "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), \"prefix-%s\", user_input);\n srand((unsigned)time(NULL));\n int _token = rand();\n printf(\"token for %s: %d\\n\", data, _token);\n}", "label": 1, "cwe": ["CWE-340"], "category": "predictable_numbers_gen", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a02ee8fc141f24a8faf6758a9af104e838f0fdaa67c6b2d08a1453e34131bbc3", "structural_hash": "545315ee784033b40dd43bbbc32885ef0b50c18fe42e1f33862183171caeba88", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18369.js", "upstream_id": "BenchmarkTest18369", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.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 libxmljs.parseXml(data, { noent: false, nonet: true });\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-91"], "category": "xml_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56e12e6f83b813aa2438109ab69d19b8b740d9a306646f974c1e8ca43fb8f18b", "structural_hash": "de8797065923b7e550fb2f330cf22b7e8833afd135497f26d6727c48f7057d11", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31001.js", "upstream_id": "BenchmarkTest31001", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { checkServerIdentity: () => undefined });\n ctx.body = { ack: 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:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "084d0240a589e146366bee814938556ac316d75ebf571df4559d644b0124d7cb", "structural_hash": "96dfd0b0796d41810671fe796b5de9fb117a00aac44016e1e272b4529b37a561", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03669.rs", "upstream_id": "BenchmarkTest03669", "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 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 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::write_csv(&format!(\"{},data\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c2a2823c6a05efa35c94a9541773288ce5cab6a4aeb136c820d62d4f1242494", "structural_hash": "4fb3e4a49b7e8f9f1f97c90c06cccdc2e12c65291b69416a9ecd98826ba35b6b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05960.py", "upstream_id": "BenchmarkTest05960", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import RedirectResponse\ndef make_reader(raw):\n def read():\n return raw.strip()\n return read\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n reader = make_reader(path_value)\n data = reader()\n return RedirectResponse(url=str(data))", "label": 1, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23da56fd1e327513e0c53d280394c80a20d5062ec0e15c76685fceb8235853ea", "structural_hash": "cef71d6c09a3d20ddf253842d05c7a3d17b36cb54eb114cdcd665c1115d7eefd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10152.sh", "upstream_id": "BenchmarkTest10152", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\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 xmllint --xpath \"//user[name='$parsed_bool']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a30a95fa376856dcf8fa1e7de0f7c9e2cbacf42a6c73a1a414de75c6c5948b7e", "structural_hash": "2feac37de04bc93f52d15fdb6928845a774a77858cab23e3995d14ff05bd8bc4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04565.py", "upstream_id": "BenchmarkTest04565", "language": "python", "code": "import requests\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 field_value = request.form.get('field', '')\n data = handle(field_value)\n requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ce501f9ad8d382eb8c67246a138a8fa3b05f68a364fb73b198457e3353ba1ce2", "structural_hash": "8cafacc8685d687c1d69a961fee6425882f30cf31985d2205d2d4f5491268e8f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13232.sh", "upstream_id": "BenchmarkTest13232", "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 echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21ff59f00cddca2c933c6b95fe20878bf5977c2663d9357158ab5574cddf7f67", "structural_hash": "2443b4a9772faefd4f373108d109b79699803a0d2d1e37d23ef2904818135aa8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05945.ts", "upstream_id": "BenchmarkTest05945", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, InternalServerErrorException } 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 parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7728102dfcb4b572a0b107a765252f97e77190d58034ea1f475eb55ac7872766", "structural_hash": "906ea1627e706e53fd0736f529602d6d51a50b650121031b4785745f971f4b82", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05761.php", "upstream_id": "BenchmarkTest05761", "language": "php", "code": "json('variables.input', '');\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 $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "520aa21d64830a89594f0c915722fd6e0bad0aa79335c1e6cd9aa819af602f41", "structural_hash": "7e8852f065260ff91f2439713035fe6c3a460afde3d45a572faee5d2ed73b35f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00479.c", "upstream_id": "BenchmarkTest00479", "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 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 printf(\"token for %s: %02x\\n\", user_input, _rnd[0]);\n}", "label": 0, "cwe": ["CWE-332"], "category": "insufficient_prng_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "773b86d15e24b5c08d3883820c130adf74558fcb3f8f1f6a3462210043ec12de", "structural_hash": "2c3af9e492d220fb4424d6c71452b2a5e5c5b139603bf28c1e051b04705df2f9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_37842.js", "upstream_id": "BenchmarkTest37842", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers[\"x-custom-header\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(data)]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b40f5df697978b90e1b16465bc196e105b329b5e8081410ce297f56603caaf0d", "structural_hash": "2e9fbb0498e113bf9f5d63714edec83f9d1cab30795739059b25334aeb8f7504", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03324.rs", "upstream_id": "BenchmarkTest03324", "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::render_html(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aad9b10b13b9c6e4e6eea4266400b71fbdb913c1525882857b1ca99d0463cf97", "structural_hash": "3dbf65fb4f3122974987fd1ce857b567050b7d1cc5ba72709e5acd87be123993", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01490.rs", "upstream_id": "BenchmarkTest01490", "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 use std::fmt::Write;\n let mut data = String::new();\n write!(&mut data, \"{}\", field_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(&processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5406cba50268134bc619ce05e5b6e0d9af51e2c6456d2d6da2ac10096331823", "structural_hash": "1dd7d2dfff6711096fa09b32a720a95eb3ae2d1f5182f81ff17b40f9f2bfadf7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04966.py", "upstream_id": "BenchmarkTest04966", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\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 env_value = os.environ.get('USER_INPUT', '')\n reader = make_reader(env_value)\n data = reader()\n eval(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ccecaf78f907ca4330e129d070ae86e1bbcc6765e5582b0928ea403d422a9d65", "structural_hash": "a49b6a98210dfb8978ccf1fcafaff886609d073d535996e1e157ecdb884e11da", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02615.py", "upstream_id": "BenchmarkTest02615", "language": "python", "code": "from fastapi import FastAPI, Request\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 referer_value = request.headers.get('referer', '')\n reader = make_reader(referer_value)\n data = reader()\n return HTMLResponse('
' + str(data) + '
')", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0b24c80055e80cc82639add01aaa7f61760ed4712838589c0cb4506ad1b9757d", "structural_hash": "7c978a24de198b035c1a91b689e619a5aa14d0b64d732989afdb2704914b6591", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04662.py", "upstream_id": "BenchmarkTest04662", "language": "python", "code": "import requests\nfrom flask import Flask, request, jsonify\nfrom types import SimpleNamespace\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 requests.post('https://api.prod.internal/data', data=str(data), verify=True)\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e6f40ac310a2ec7863fa5e2fda0b47b32441b860dda018fbc51793e2280956e", "structural_hash": "eecaa1686984f9737bea7bfa53527126d7eccb24df8a3a8491352cd53db826f6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04302.java", "upstream_id": "BenchmarkTest04302", "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 response.getWriter().print(\"
\" + data + \"
\");\n }\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c23c3ea7921f929af752d27434460075637e00b7fbee64d4871b4896bb2d27f4", "structural_hash": "b0865b006b172df38990b382b3506eab64c3cdfd58d3b2d98dceaf3951eb8b69", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02067.cpp", "upstream_id": "BenchmarkTest02067", "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 _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) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5f127b32b6fc403e1d5a56ac97b2d4480e8664388ed42ef97c96d4d9a1b59c6", "structural_hash": "c01527a18962db6cddf48853f2fb8857916a53f989497ab87724d33f4ec60f80", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01101.py", "upstream_id": "BenchmarkTest01101", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = cookie_value if cookie_value else 'default'\n logging.info('User action: ' + str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a5d7a022018cf22c630f05524667dfbd4a426c775a078762da76fa256cb8dcf", "structural_hash": "44326a4a8e168c705cc21c8939f99e0511d4cea269daa073161da75daaf14715", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03704.js", "upstream_id": "BenchmarkTest03704", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n globalThis._loginAttempts = globalThis._loginAttempts || {};\n const _who = String(data).slice(0, 64);\n if ((globalThis._loginAttempts[_who] || 0) >= 5) { ctx.status = 429; ctx.body = {error: \"too many attempts\"}; return; }\n globalThis._loginAttempts[_who] = (globalThis._loginAttempts[_who] || 0) + 1;\n const _cred = String(data);\n if (authCheck(_cred, ctx.session.token)) { ctx.body = { authenticated: true }; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fb1ac21890c53531780d81384251ecd4c90e2c5c959753a2abf1681f11e53d0f", "structural_hash": "820d0042c5bd2bf8f10e132b59295b538ba46c2fdbb01dc1250a5666c14e3d7c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest02589.java", "upstream_id": "BenchmarkTest02589", "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.List tokens = java.util.Arrays.asList(fieldValue.split(\",\"));\n String data = String.join(\",\", tokens);\n return Response.ok(\"
\" + data + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2a867732f0c4bcd0365470ab02f7d4b321bc5a8c6bf487b04b6f5e4c0152c407", "structural_hash": "ffbd3ff75023b059fd03cf3ba1ba98f533c0db7259d937b457d0c6510de331cf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03376.ts", "upstream_id": "BenchmarkTest03376", "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-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b0ea280534659d2c697b24c5a7b90f48c07e56707184cd1249e59bdc1deccf4", "structural_hash": "fca104d52fbabf5234f58b47a1ccecbba507ab36b760adb23afb82881ec223f0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03661.go", "upstream_id": "BenchmarkTest03661", "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\tpathValue := c.Param(\"id\")\n\tvar _sb strings.Builder\n\tfmt.Fprintf(&_sb, \"%s\", pathValue)\n\tdata := _sb.String()\n\thashed := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(data)))\n\tif !authVerify(hashed, os.Getenv(\"CREDENTIAL_HASH\")) {\n\t\tc.String(http.StatusUnauthorized, \"unauthorized\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-303"], "category": "incorrect_auth_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c094ee3d085302ff4957475d8ea65d811f1b99965fd9397761c6d6ad3a939586", "structural_hash": "bf8407aff1f77b2c5e099e2f47d01f25108ab0ad480f5a64c5747039121af3ac", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01810.rb", "upstream_id": "BenchmarkTest01810", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n system(\"echo \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbde5e8fea54640ce64a0cc547b9068047a41a573df252ab4da94155011a226f", "structural_hash": "67200c5b14a77c15bc6a182fc39eaebb68640df86335394f6749eb1b36cbc02d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07503.sh", "upstream_id": "BenchmarkTest07503", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "717d0de025d7208e10615ca2e9731d6fe0d60788a2fe9bce6cdac9dfb5552d51", "structural_hash": "530f2cc1ff2830b0ed2d5f0ef67fa842338a5773a83e062fa3a9b9467b837ac2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38185.js", "upstream_id": "BenchmarkTest38185", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n ctx.set(\"X-Frame-Options\", \"DENY\");\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "40994d46770d445dcfcc26f01806c645690f828ba02785886855427903ee9a57", "structural_hash": "57e1e476d1c2cc564c68147e9d845e638dec0ace032b6b401d8b46afd08d676c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10793.c", "upstream_id": "BenchmarkTest10793", "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 int _sz = atoi(data);\n const char *_payload = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\";\n char *_dst = malloc((size_t)(_sz + 1));\n if (_dst) { strcpy(_dst, _payload); free(_dst); }\n}", "label": 1, "cwe": ["CWE-680"], "category": "int_overflow_buffer", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:int_overflow_buffer", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9520902aa0e91479604c5b9c34f9baeceac0c7f2804c99c183abd9a94d1db33f", "structural_hash": "7467e0bbdec17b5a0412b57c4ebceb3ff064a9b67c52c44bf83cf2213c770307", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00396.c", "upstream_id": "BenchmarkTest00396", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 snprintf(data, sizeof(data), \"%s\", user_input);\n const char *_cred = getenv(\"APP_DB_PASSWORD\");\n if (_cred == NULL) _cred = \"\";\n if (strcmp(data, _cred) == 0) { printf(\"auth ok\\n\"); }\n}", "label": 0, "cwe": ["CWE-259"], "category": "password_in_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f86f0a3e4a7843a83edf316260d908ccf530914a932fc24daae14dfac2bc2e1d", "structural_hash": "613213917275612e5f2c13262c528b387d5aaab028fea803fc43b117499a37ce", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00143.cpp", "upstream_id": "BenchmarkTest00143", "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(\"USER_COMMENT\");\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 _msg = std::string(\"DB error processing '\") + data + \"': ORA-00942 table missing\";\n std::cout << _msg << std::endl;\n}", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a66ed2cfa6a09a428c2d70586f17af11893c80e4278c54ae90af93a3f5010aff", "structural_hash": "cb7c8b06164362979cfcdb47e75f5cec3d0407637be53bd1fd8ebe4891081fae", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05474.sh", "upstream_id": "BenchmarkTest05474", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n xmllint --xpath \"//user[name='$data']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c3a9fabf9f580ee750107bc44bd6537a1a828228d8675c05c2e40785ac2560d", "structural_hash": "c41c4e500e13915596af6bf8f1517b541ddba375fe51756c60173e59a2e76d55", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05687.ts", "upstream_id": "BenchmarkTest05687", "language": "typescript", "code": "import { Body, Controller, Post, Req, UnauthorizedException, InternalServerErrorException } 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 let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n if (!req.session || !req.session.user) { throw new UnauthorizedException({error: \"unauthorized\"}); }\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23c5a3bbbc53aa445a5bfa28f1e33a28deb708fc90076144b25179d15f7ae867", "structural_hash": "3117c2d3e3cda49c1a1183a92dab8de436e2ef89de13ef77f1a417ff889b92e8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19725.sh", "upstream_id": "BenchmarkTest19725", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\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 /bin/echo|/bin/cat|/usr/bin/id) allowed_bin=$data;; *) echo \"forbidden binary\" >&2; exit 1;; esac\n exec \"$allowed_bin\" --status\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c4b66f70b33ef2f945f757d6b42582026a447a5108b9f0dda0244366d7ad7e0", "structural_hash": "173ccf89465862d2ae8f62ba87d55a7a2941462fe914eb914424f29abf01bd10", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01131.java", "upstream_id": "BenchmarkTest01131", "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.*;\nimport javax.net.ssl.*;\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 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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "26a87c556944accf1f6d1a00d132e4c65e6db00a2ee89be6340c82ab1a560b22", "structural_hash": "dc6e8e1f5f33c7a08c56fb11e40c040ef6b715193e6e23a0c64c28207f8540ec", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02719.ts", "upstream_id": "BenchmarkTest02719", "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 res.cookie(\"session\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ef5d40888af0286133a7811a390796c165acf105bda276d3c32747b94d9245b", "structural_hash": "25f9b05d4bbfa8881512ac7137804de69b60a4fe8295c0fb3d95fe7dfb0d2cd7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14148.c", "upstream_id": "BenchmarkTest14148", "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 _v = strtol(data, NULL, 10);\n unsigned int _u = (unsigned int)_v;\n printf(\"%u\\n\", _u);\n}", "label": 1, "cwe": ["CWE-195"], "category": "signed_to_unsigned", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:signed_to_unsigned", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "04d3ac2ac9d8e12b2634f159989a41dd8775955b921879a5b5999ff6f0dbaa05", "structural_hash": "0c1c533df4ecd1ee7fa76147c18731ac097577e28d17bb4f107d5e9919751169", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00078.rb", "upstream_id": "BenchmarkTest00078", "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 Process::Sys.setuid(65534)\n render json: { result: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28bb8bbbc68b51f8104f446f053631ac6643d9170cc6cd7bcb4596083a93a2a0", "structural_hash": "45a5c37a678465936bd764676458bf911d2de46b56d08d4bc81360c892309816", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26031.sh", "upstream_id": "BenchmarkTest26031", "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 case $data in true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n xmllint --xpath \"//user[name='$parsed_bool']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "381c4e79304a8ac646a1f10221b427bec96e338d575344a4de2f9411ae438c30", "structural_hash": "c35a22cae1e58fe23269d0372192abfdceb86e2d92c65342be70f41c25b6672f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10293.c", "upstream_id": "BenchmarkTest10293", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 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 *_cred = getenv(\"APP_DB_PASSWORD\");\n if (_cred == NULL) _cred = \"\";\n if (strcmp(data, _cred) == 0) { printf(\"auth ok\\n\"); }\n}", "label": 0, "cwe": ["CWE-260"], "category": "password_in_config_file", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4f2a4205d310ef9106f075a4b1ed0688231156604161b56f55eada053f51ee0e", "structural_hash": "6f1562349b3eef71ca2fd36c04fd633bfabc0941e7790154eef8c3d60cd1c400", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05701.php", "upstream_id": "BenchmarkTest05701", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = ($userInput !== null) ? $userInput : '';\n $quotedArg = escapeshellarg((string)$data);\n exec('echo ' . (string)$quotedArg);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "423aca9d80f809d4baa27b2887e0fcee4c67dc202b62dd5245f6415b7ea0fd2b", "structural_hash": "eaf46fd2d12fdc2209764add040304a2099b29ab8b491d76b076590fb7ba4483", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01363.php", "upstream_id": "BenchmarkTest01363", "language": "php", "code": "attributes->get('id') ?? $request->query->get('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 $checkedPath = str_replace('../', '', $data);\n unlink('/var/app/data/' . $checkedPath);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "961e111153a8e35b597d562f15a433941d2f276007aac2b04251fbfb23e3c27d", "structural_hash": "9c4fb647c0539af520f3ccff62a435ae9a6e78e34dadf040ff1522a521abb0b8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_17294.sh", "upstream_id": "BenchmarkTest17294", "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 exec \"$data\" --status\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c26a3b5962f986c9f1435eba54ad5a6fed2b072834fac4bc3ccb124f00faba3", "structural_hash": "32a219b778c421f8b41d15329a581517f2d03c8a5a25758bbd67de72b7784f6c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00262.cpp", "upstream_id": "BenchmarkTest00262", "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;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\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}", "label": 0, "cwe": ["CWE-121"], "category": "buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8bea05d642db86618329209deeb080a526bdb3a6e9f49787e2e686faaff7077", "structural_hash": "a111aa652c1f45f046763855aa1168c9dc53173fa428f5445fd4eaa5d3e3b4f5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01823.rs", "upstream_id": "BenchmarkTest01823", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let upload_name = crate::shared::uploaded_filename();\n let data = upload_name.split_whitespace().collect::>().join(\" \");\n tokio::fs::write(format!(\"/var/uploads/{}\", data), b\"data\").await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cbd961859d7d034b5820684e606f5b868c0599945a1d91d3207a7720f42dd06", "structural_hash": "977184086d1af5dff73fd14fece18eab37b086689eb30839853416a84055d0b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13209.c", "upstream_id": "BenchmarkTest13209", "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 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 _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n int _fd = open(_path, O_RDONLY);\n if (_fd >= 0) close(_fd);\n}", "label": 1, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:symlink_following", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "628d9a3b7b337c729764981e1e8da12590da8455fa75ddde8cb6431932d068e1", "structural_hash": "3e80f60ff7d62dd0b1ce729b2a43572e3445e24c85f6664f17bdb4f22e91b08c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06325.sh", "upstream_id": "BenchmarkTest06325", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\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 xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eb14cb4aea0c230384707f023ffd16401a2c7db813a172d0cdb828abc12a5b16", "structural_hash": "766e8f710dee690b8d5a910c269cf03ede7041b4fcbbd657a7641d7aee0f8193", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00716.php", "upstream_id": "BenchmarkTest00716", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c8c31720cb18b0de265bbb0aa095e852266ded32b7096674732d1d04705bc39", "structural_hash": "3e8d629f9554d5c19324af25311e2189538029a4e3d869101fe7e7c2b440b924", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_04806.js", "upstream_id": "BenchmarkTest04806", "language": "javascript", "code": "const libxmljs = require(\"libxmljs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n libxmljs.parseXml(data, { noent: false, nonet: true });\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-611"], "category": "xxe", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:missing_xml_validation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9766ae0c5039766560e4fc5c446d466ac52f35431183b8a9210a9027c32a911f", "structural_hash": "023dbdbc31b6a3c4306c19690427fa852f60ffbbb86fdfc5ba13d9d34a06a679", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04079.rb", "upstream_id": "BenchmarkTest04079", "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 system(\"echo \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "610c2ae8b1746573f12a9851120f5fa3240948c49bd99d09e9361c721cb74443", "structural_hash": "65bae5c0112e3beb4c24e9aeb9b014c182445c456db60379d94884b7985897f4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05719.rb", "upstream_id": "BenchmarkTest05719", "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 q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a151d33a02af506b6442c8dc7849505ece116450f6e9af2e87208dac762620b", "structural_hash": "b707df586d03760fa83f3ce5dc4100ff8188814cef98c4efa30a3e29ceea9e34", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06047.ts", "upstream_id": "BenchmarkTest06047", "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 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 return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9fe3aea1ddff96dcb447a191447cd44e442879f90a17aa9de941715850bd938f", "structural_hash": "076855688c7c8da675c1c3a453bde11a4b3a7f2ba992eabd6662a03cbfe10715", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02638.ts", "upstream_id": "BenchmarkTest02638", "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 payload = { get value() { return userInput; } };\n const data = payload.value;\n res.cookie(\"session\", data, { secure: true, httpOnly: true, sameSite: \"strict\" });\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b68e8554d82cc5a5556db30f4cb1a049d6855852cf63e14790a5cb5900191e0", "structural_hash": "1c7daf8ced3612adbabf60ac894874a0d27339e20315eced563920a32c80cf0c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08355.sh", "upstream_id": "BenchmarkTest08355", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c87925d901d37ae58dcbbc72ffe6bb9a81af844c9c1c0dd8a1d39e9629698ad9", "structural_hash": "0379e1690c2d01ac53337c07e2c444c2606a7fe5d5da0fd53ca9d0211d16a4cc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02273.rs", "upstream_id": "BenchmarkTest02273", "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::db_query_bind(\"SELECT * FROM users WHERE id = $1\", &data);\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "558f0ceb85aafa012f0dff402e8b5787a68000c0e22d67e7158bab71308490f9", "structural_hash": "f28b0d54bd66cad7ca2fa1cad5f126101aa26f928a1bd5d43d56355307607f87", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11003.js", "upstream_id": "BenchmarkTest11003", "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.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55b6b67c7a88678c806fe9a31ce7217bbaf1664ca4f1367dff200b28272aedfe", "structural_hash": "b899ce645e901692adc67a7f8e5442bb1d24fce188fb36778c03cce1a91d14a1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_14409.js", "upstream_id": "BenchmarkTest14409", "language": "javascript", "code": "const fs = require(\"fs\");\nconst zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\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 fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n ctx.body = { 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:koa:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b300964d20ad489af81690583d436ab4d713598eac98f244a81aba2e3b8c97f", "structural_hash": "500981b60c0c7dbbd07806f89d77bea147f7fc4ca52889b73a002e202386f23e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00866.rs", "upstream_id": "BenchmarkTest00866", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\npub async fn benchmark_case() -> impl IntoResponse {\n let argv_value = std::env::args().nth(1).unwrap_or_default();\n let tokens: Vec<&str> = argv_value.split(\",\").collect();\n let data = tokens.join(\",\");\n Command::new(\"bash\").arg(\"-c\").arg(format!(\"echo {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac9ec55825c8f871cc51c0ee50afc4ac3e534015c13c56b81829546fb8985a26", "structural_hash": "5f0caa2f7d20052370b217e9d143dd5468dd238cc6543ed8c95f3a3ac3fe89a0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11173.sh", "upstream_id": "BenchmarkTest11173", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "98c98d7ae5dd22b3283f42c0baa8a873dfddc20532ee419947bc85aac914f200", "structural_hash": "c15eb0deae809dac9a991b2345288dde227842146d0d37b945ec715e7f702294", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00343.rb", "upstream_id": "BenchmarkTest00343", "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 = ''\n user_input.split(',').each { |token| data = token }\n unless session[:role] == \"admin\"\n render json: { error: \"forbidden\" }, status: 403\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d65962d86e7db9e383d0a9e2c2970ea8c538b4c2d16fa767e5fb334aafe08f8", "structural_hash": "8e3f59755ef3f959df5a8af9e80d90480b07a1ff90eb6cd10ba3edb049f71b35", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_04992.php", "upstream_id": "BenchmarkTest04992", "language": "php", "code": "query('id', '');\n $data = sprintf('%s', $userInput);\n $host = parse_url($data, PHP_URL_HOST) ?: '';\n if (!in_array($host, ['api.corp.lan', 'cdn.shopcdn.io'], true)) { return response()->json(['error' => 'forbidden host'], 403); }\n $targetUrl = $data;\n $errno = 0; $errstr = '';\n fsockopen((string)$targetUrl, 80, $errno, $errstr, 30);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8207c5e35bf38316d496a1c987f28077c7e2194241c85798a5507e7cbe273f5d", "structural_hash": "b68195cf883cd8cf691688597478f3c1cbf78662b516a4f3f94265b98ef49b62", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05307.rb", "upstream_id": "BenchmarkTest05307", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\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 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 URI.open(target_url).read\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "466911b44657ff5cf82edb34a97c95d7fd18eaa0c972accf8b8759052938845b", "structural_hash": "8ee8f1adbac12a6d50709d615b55ef3dc65c496233caad7d4dabd77f54345f3d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01133.ts", "upstream_id": "BenchmarkTest01133", "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(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1aae89fa17181d67748ff2dad21408ae04de5972b9bcc085de432e4fe139a17f", "structural_hash": "76fff00d29d52f92e487d0e4aa061bd69ca6a06d7143771ba6168d50fda19f04", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04278.py", "upstream_id": "BenchmarkTest04278", "language": "python", "code": "from fastapi import FastAPI, Request\nimport logging\nfrom fastapi import Form\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, field: str = Form('')):\n field_value = field\n if field_value:\n data = field_value\n else:\n data = ''\n logging.info('User action: ' + str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a148d9c8fb01cdcc94c64b6e8537c3625335c0d77237c674d817866d6222cd9", "structural_hash": "0f280b870ac38629f02fb657d7257b43f48313d82521ca4606e1be256d2fafc5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04365.ts", "upstream_id": "BenchmarkTest04365", "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(\"host\") host: string): Promise {\n const userInput = host || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e9de96a88c713ddd1d7066b53a635711a7e8f16e88cb3cb476973782e6f563c", "structural_hash": "e144fc13a69f316c5ef831409b1e1a6866d39afb77d85703913f6623cf282b36", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06075.ts", "upstream_id": "BenchmarkTest06075", "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 _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b1d1038a7224b35dfc039676c955556b73331921fb47c31e56797f91e22bcff", "structural_hash": "ae738adc68681b0603223080d136d1dd30fbf3b468e48542b535cff30f9dc924", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04526.php", "upstream_id": "BenchmarkTest04526", "language": "php", "code": "headers->get('Authorization', '');\n $data = ($userInput !== null) ? $userInput : '';\n exec('echo ' . (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9f2e8c880a0e6f5aa049f6eece497ee142675b1bd7c4e9d30d913e5f0402e411", "structural_hash": "0b69f59ddc43da506bdc25476653a5d21cfd747200ff3d6d22bde3d9ff4ca458", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03619.rb", "upstream_id": "BenchmarkTest03619", "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 _accessor = :to_s\n data = user_input.public_send(_accessor)\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a27ebd43626c591025aab02b585559c17b1c7b6929c4a3621f76739fafe70455", "structural_hash": "24ff9a6b9d266c0d6f576b07e3be6113bd54dc858560324767ced388cdc7073f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27383.sh", "upstream_id": "BenchmarkTest27383", "language": "bash", "code": "benchmark_case() {\n user_input=\"$DOTENV_VAR\"\n if [ -n \"$user_input\" ]; then data=\"$user_input\"; else data=\"\"; fi\n echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59935d8563a8d1e1ffe8f032fe736b92101f28a8c84de0598659477189c8f306", "structural_hash": "fdcba6929aa607e69c2005ed68021591611a40472bb65790ad09c077cceadc42", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03636.ts", "upstream_id": "BenchmarkTest03636", "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 res.cookie(\"session\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e88dca335d82f2c3e7fec316dbb008f3671dab76301bfab4657efdfa6b4d07e7", "structural_hash": "280a62e0a0b400c71479f5e4e6ab30b97fa7c600b0ec82189dff2d0e21320932", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00300.php", "upstream_id": "BenchmarkTest00300", "language": "php", "code": "header('X-Custom-Header', '');\n $data = hex2bin($userInput);\n $requested = (int) $data;\n $allocated = $requested + 1;\n return response()->json(['allocated' => $allocated], 200);\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0ee2ad84ea9cba475c241ca6eed73d884b0dbff840daea4a3ff8b2bca9f4d65", "structural_hash": "07f6929f71e4a663d22b01d48ae30686202da17118ddbbb3e2d81922e2c0ea3a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03567.rb", "upstream_id": "BenchmarkTest03567", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\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 ? 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 DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e11aa9bdad893d2f1e96e427e422d48fb4b03e025c867962ad4d14c7ecbde2f9", "structural_hash": "a8e47541320643844f1e72ff54277fe107cd342bfcdc95a6d8a75baa9d7173e6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03608.php", "upstream_id": "BenchmarkTest03608", "language": "php", "code": "json(['error' => 'forbidden'], 403); }\n $allowedBin = (string)$data;\n exec('echo ' . (string)$allowedBin);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c61ac87b9b14a3f4265fbcc9dc823f90ec94492a3e4212558718b0c50ad7c72", "structural_hash": "9cba1ce34537cb98fe11bfd942ba9695a6405ee18b711576d6b7ddb5eff204ce", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00212.cpp", "upstream_id": "BenchmarkTest00212", "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 (void)data; std::string _msg = \"internal server error\";\n std::cout << _msg << std::endl;\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23474ed3095d51eb0056640db27b2c1b51b3c74793637f2e249bdc9c2a602405", "structural_hash": "9cd7d84aa6c6bc41e545421e2b79d67e19cb1eff60262353d49bf66aaf4def83", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02213.go", "upstream_id": "BenchmarkTest02213", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\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\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 := fmt.Sprintf(\"%s\", graphqlVar)\n\treqUID, _ := strconv.Atoi(data)\n\tlog.Printf(\"drop-privilege request for uid=%d\", reqUID)\n\tsyscall.Setuid(65534)\n\tc.JSON(http.StatusOK, map[string]string{\"priv\": \"dropped\"})\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3356118bc5e4ab694790668f4a6a16c4552085da55edc49c8de8b0ec95274eb6", "structural_hash": "d953908bf2c69f922337c51eaf3543fec2a2f9aa71fc704a886db8f8e66c6b2d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01843.rs", "upstream_id": "BenchmarkTest01843", "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 auth_header = req.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 crate::shared::render_html(&data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-917"], "category": "el_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "072c592f64ba412c63bed3536d1468db15609c81457d65890bb7fdcb22a9cbb5", "structural_hash": "e5801ced70de102a257798a4bbf1a95d527b6013230d2dc72fd970cc76fd53dc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04892.c", "upstream_id": "BenchmarkTest04892", "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(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\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 int _fd = open(_path, O_RDONLY);\n if (_fd >= 0) close(_fd);\n}", "label": 1, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:symlink_following", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "94a21c485eedf517eb0dfac28e79db3d572af535edba07b176a9caa732d1dbfd", "structural_hash": "683a623b1d217299680b3b48c4c6b4222514a8052fb7b6d3dab936471bfb7819", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00713.py", "upstream_id": "BenchmarkTest00713", "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 pending = list(str(multipart_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n eval(str(processed))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d195b4052f5e248bad7a5b0158f0ba8df5d0d31351dd7345ae5deabbba567af", "structural_hash": "48cd5ac0b077977d4eebf3985abfb95f65be6cb2142ee2a7e59b1345d051e3b5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01256.sh", "upstream_id": "BenchmarkTest01256", "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 true|false|0|1) parsed_bool=\"$data\";; *) echo \"invalid bool\" >&2; exit 1;; esac\n xmllint --xpath \"//user[name='$parsed_bool']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7110d8930240554e708754cfbd23ed9fe57250de200c7af25e635926a52756cc", "structural_hash": "3b47634d507dd5d90fe8aed4afbe40de926dc79eeb0087b35a584f53b8290f3c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04665.java", "upstream_id": "BenchmarkTest04665", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.xpath.*;\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;\n try { data = String.valueOf(Integer.parseInt(originValue)); }\n catch (NumberFormatException e) { data = originValue; }\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 response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b744fda1f97c8d5c6b1893e707c005b3d13cfdde631e7aa7a4fde3de73fba969", "structural_hash": "4d5da3cec7676a706a1f2156180bc370187ed4cdd29c60e90b4f3616742a187c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_03374.ts", "upstream_id": "BenchmarkTest03374", "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 db.query(\"SELECT * FROM users WHERE id = ?\", [userInput]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "28de198075700d9f94ba4762ede39bd5d37495cc9c46f880fcaaf9f95365c81e", "structural_hash": "5b66da7e51357472ca9e095e34c77a7feafce8f61ae76ff70ace792e76f48bff", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05755.java", "upstream_id": "BenchmarkTest05755", "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.*;\nimport javax.net.ssl.*;\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 = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> refererValue)\n .thenApply(v -> v.strip().toLowerCase())\n .join();\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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6715760713d2dc6211b94d6c1ddf40908f9852f859d319b8e962e50ae6e46733", "structural_hash": "b443896d54185ee0dd839c5923bc96208fbd6dcf42c439e34dc63ea34f9f1dd7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01130.rs", "upstream_id": "BenchmarkTest01130", "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 for token in field_value.split(',') { data = token.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(&data) { return HttpResponse::BadRequest().finish(); }\n let processed = data.clone();\n crate::shared::render_html(&processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3ecce6eb479ec159f16c393b1adf46e7ec517e036dc48a04f2958a7f27a30e8", "structural_hash": "975c460d6882a0c50241227cf0a1a5734241997f465f77505a656098a4024eb6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02114.rs", "upstream_id": "BenchmarkTest02114", "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 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 tokio::spawn(async move {\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n }).await.unwrap_or_default();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aac68da27b4acc5334994a8793e2a6f38114796c5e3b19400d2aec4ea964b97f", "structural_hash": "e7ae36f847684de26b54f16ca7b4cde2d5d6865401a0cdb299c7b124806eb58d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05418.java", "upstream_id": "BenchmarkTest05418", "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.nio.file.Files;\nimport java.nio.file.Paths;\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 if (!data.endsWith(\".jpg\") && !data.endsWith(\".png\")) { return Response.status(400).build(); }\n String entryFile = data;\n Files.write(Paths.get(\"/var/uploads/\" + entryFile), \"data\".getBytes());\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "987ecf2363e5074cc7476dbc6d72e31313ccbcf726d013781c2eee4430687ef3", "structural_hash": "6a3fd852f94c0fe06b4d2093572afd6bde99c1acf26fee950d10545c309426ce", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19680.sh", "upstream_id": "BenchmarkTest19680", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n data=$(printf \"%s\" \"$user_input\")\n ulimit -v 524288\n if [[ \"$data\" =~ ^[0-9]+$ ]]; then _req=\"$data\"; else _req=0; fi\n (( _req > 1024 )) && _req=1024\n dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$_req\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d536ddc0e84cb65171a2d6310b880072e2db2ab8487c038fe4ce0e32d456f86", "structural_hash": "9555aa56f80f91232fd70e0602848a2d51f30e224a5d3e7b806d34154712cd55", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00247.sh", "upstream_id": "BenchmarkTest00247", "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 if ! echo \"$data\" | grep -qE \"^[0-9]+$\"; then echo \"invalid\" >&2; exit 1; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:unusual_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b5e646cdb5211ce5557f9b14ee86ee923e1fad3daa975336ad97a5aa236f24da", "structural_hash": "db1ac897abb29b4e50184704913d89029557328867306518f011418f62d2d57e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03279.java", "upstream_id": "BenchmarkTest03279", "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.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 if (\"admin\".equals(data)) {\n return Response.ok(\"{\\\"role\\\":\\\"admin\\\"}\", MediaType.APPLICATION_JSON).build();\n }\n return Response.status(403).entity(\"forbidden\").build();\n }\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe34569d1b53c3b8d0a3594618d9f9fd934f99ba135db752c6aa0452bacb1aa5", "structural_hash": "b06849154f90f6def765ea3c7f5e9122750110ffb15b7fccadc22d97280e2104", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23165.js", "upstream_id": "BenchmarkTest23165", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nconst zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).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 childProcess.execSync(\"echo \" + processed);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61f0ad0a226dbac1683cdf0eb0257b2f6ff40f5dd34aab798a35e7bee4a20ab3", "structural_hash": "49125295b48f4cf56873e8b989f4f3802106c82675d6b1a0b535edb8fd5c9afb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_28561.go", "upstream_id": "BenchmarkTest28561", "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\tdata := multipartValue\n\tif _, after, ok := strings.Cut(multipartValue, \",\"); ok {\n\t\tdata = after\n\t}\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tif err := os.Remove(checkedPath); err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-703"], "category": "error_condition_detect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6cef5cb615fe723da3e9b143293063e077e2539c0d803cedc5be8f9fc150a323", "structural_hash": "b07f797ceaf8e88dc557165a050fe47ee7976ac608677cd3d90633dc8e3440d5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02786.c", "upstream_id": "BenchmarkTest02786", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \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 snprintf(data, sizeof(data), \"value_%s\", user_input);\n if (strcmp(data, \"hunter2_default_pw\") == 0) { printf(\"auth ok\\n\"); }\n}", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb89a95665528dcb864c789b7bc7c8727649ae3ecb28b4819129daba6b76a9ba", "structural_hash": "c65dd1456edfec3cbda0d648d54a41d6200a0952bcc61924b03c37f566409f31", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01428.ts", "upstream_id": "BenchmarkTest01428", "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 const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n res.cookie(\"session\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c829e2362ee83bad752a69959c3090152e1847f34f877771318e289213d3fce", "structural_hash": "992766ca9d5fd9b0128ec684cdaa21032a7ddd580ad1a896341eb9233ba1f440", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01258.ts", "upstream_id": "BenchmarkTest01258", "language": "typescript", "code": "import { Controller, Post, Req, InternalServerErrorException } 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 data = String(userInput).replace(/\\u0000/g, \"\");\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bbd854c7633a393902ca0d2e7700e4ed64302df9816d43af85c60c310148e972", "structural_hash": "41cd40107f3e5b027b507f875965ed5b289b9b49aca771c6c63b00764aa74dcd", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02584.cpp", "upstream_id": "BenchmarkTest02584", "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 long _oid = std::strtol(user_input.c_str(), nullptr, 10);\n bool _allowed = _oid > 0;\n if (_allowed) res.set_content(\"authorized\", \"text/plain\"); else res.set_content(\"forbidden\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c0f9f57e84bca50a23520e6d1590f527853982b3b86177546189c1bfe73ebfc", "structural_hash": "2ed58ae30546c91aa305c491b7cf615a0864330a9574e290da0809707a3f1036", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26223.js", "upstream_id": "BenchmarkTest26223", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _cred = String(data);\n if (authCheck(_cred, ctx.session.token)) { ctx.body = { authenticated: true }; return; }\n ctx.body = { ack: 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:koa:no_brute_force_limit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "df45cb69b9ca7daeaa193b9e53997a70c4628db506b01196a70e7396b1c64bc7", "structural_hash": "aefb774a6c22f1c96a914a75f3e9210a31674ae82e0c3d99e07c08023bac8dde", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02080.php", "upstream_id": "BenchmarkTest02080", "language": "php", "code": "input('field', '');\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n eval((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a34df3ad6e86da734b17dcfa0911c77cc550d0df90123a83f48eb16b26958f08", "structural_hash": "1dd3fa4ae825f697e2dc149d66a40ee28d86f42a771594b5d07773b34401c994", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_13272.js", "upstream_id": "BenchmarkTest13272", "language": "javascript", "code": "const zod = require(\"zod\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\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(\"X-Custom\", processed);\n ctx.body = { ack: 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:koa:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5b6415d15563e38853de99d3dbc0ecd3bfdaa7f58fbd89cb70549ff04d2de1c", "structural_hash": "b62d1ef840496cbd0ec20d7bbb4cc8b25d8c50d55750d2aced60a6d7fae543b7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00527.js", "upstream_id": "BenchmarkTest00527", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\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 childProcess.execSync(\"echo \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "928c6c9ee16bd0683e6de5f9e1b15c57120b0e2a6814753a7219c7cf59f493e8", "structural_hash": "cbb880c1cb8d2db73dbd3a5287016ced3a70bdfd43e0537ac219a0473761ce24", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05094.sh", "upstream_id": "BenchmarkTest05094", "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 -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4905b96976b2b16718e09b0f52849f07d91c5441966699eeb7de64f77b996ca7", "structural_hash": "cd98a7711662933daa338664f22f6b9c633e321ed0898ab059d63987885010bc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/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 \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 long _n = std::strtol(data.c_str(), nullptr, 10);\n char *_buf = new (std::nothrow) char[(size_t)_n];\n delete[] _buf;\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b7a00b1a3ae382b46e52d2e4b6b17f5b5f3c84c3787b1aad096f4686c630219", "structural_hash": "5c19a74f327f54557d174309cdb8d4f0b5ec58d49d97f7d7eb63eac66ad8e15e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04881.py", "upstream_id": "BenchmarkTest04881", "language": "python", "code": "from fastapi import FastAPI, Request\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n parts = []\n for token in str(user_id).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n with open('/var/uploads/' + str(data), 'wb') as fh:\n fh.write(b'data')\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c98f55851d1d08ef09b0a58f41f700842bf635dd4e51c5d3a31c4c4740a9ebd9", "structural_hash": "29c14a78bae9729525a204dcaad544d11c2555d0b6250a23b1205c6af29b2056", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05291.py", "upstream_id": "BenchmarkTest05291", "language": "python", "code": "from fastapi import FastAPI, Request\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 eval(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ad2a4dc7734f3f6968cf766eb7411b67a1961037c471a2675c50c62b998f708", "structural_hash": "71c18570398cebac48f2e81a758ce897a610685834f474477c1773ca0308e085", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01843.ts", "upstream_id": "BenchmarkTest01843", "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 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 db.query(\"SELECT * FROM users WHERE id = '\" + processed + \"'\");\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69de23ca17ed0246127caab4100d3cf3241385d18a626d732232375990b64811", "structural_hash": "089088071aee73e6158ca267dc4e7153b2e362299ecf1b638d2bc2160e587eaf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11047.js", "upstream_id": "BenchmarkTest11047", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nasync 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 if (!/^[^\\x00-\\x08\\x0e-\\x1f\\x7f]+$/.test(data)) { res.status(400).json({error: 'forbidden'}); return; }\n const processed = data;\n childProcess.execSync(\"echo \" + processed);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e193e62057f36fdaa27f6261d793081a0119bfa255c68d423af15e099f6199f6", "structural_hash": "2fca743af86d150f56956fb0b4cba7e5cfffbcd9deb8a639893ee870d1efcc5f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/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 \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 = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n bool _authok = !data.empty();\n if (_authok) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b3b024cb257816e09ca01cab852bb947003f5297cdf2c857238e76d2ebd2fc9", "structural_hash": "506df878cd2f0b781252aea87f067e4056e68f6ad4a783002c79d574d9bd5b74", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01054.java", "upstream_id": "BenchmarkTest01054", "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 request.setAttribute(\"wrapper\", refererValue);\n String data = String.valueOf(request.getAttribute(\"wrapper\"));\n String dispatchMode = System.getProperty(\"dispatch.mode\", \"primary\");\n if (\"primary\".equals(dispatchMode)) {\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n }\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a6f6e62c2a075535c61688d71a5e520f52bb4bb806707f3a5957ae9b31cbf13", "structural_hash": "36c6b9c7e4d7661c008cc4ea1ad10cae01fb6237b1deccc31f2714a154117a84", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00828.ts", "upstream_id": "BenchmarkTest00828", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } 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 = await Promise.resolve(userInput).then(String);\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "97aa351e7db0d6484897e97f60175a2070e91db9794ba7db61f333f999017043", "structural_hash": "2e949994fd8256116a7c590d1eaf3b6c9687ead1f4a7b9c8a02bf77043c5b10b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_31560.js", "upstream_id": "BenchmarkTest31560", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)), { rejectUnauthorized: false });\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c2eb93371d9e5e920b441efb3cc4396095edccd2769eb40c8118371bd54b8d1", "structural_hash": "c4782be86e656369d407ff625f02f751150f8013a045006b99909093d9b2e7cb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01519.ts", "upstream_id": "BenchmarkTest01519", "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 _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 return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a402bcfd974cc8fd0ce6026f49a00d0d941d81ba03196207369000f18f73ba01", "structural_hash": "13bbc524029eca2996e66cdb5b33063b82d199a877b3c896721a87dd6c1d60cb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09377.js", "upstream_id": "BenchmarkTest09377", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(userInput)]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3dbbbc3d3363efb71556edc19084898d161b15433d8d958de6493a1b93f7632e", "structural_hash": "285b067306956cb6ac0c5915f644a0d12e6421412ce6ce37aa39d9d757a5e649", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_41836.js", "upstream_id": "BenchmarkTest41836", "language": "javascript", "code": "const https = require(\"https\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n https.get(\"https://api.node.internal/data?q=\" + encodeURIComponent(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:bad_cert_chain", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8971225a4177c084d8ea569176d0ac0c39c32296397e4d3ef3a0c1490eaefc62", "structural_hash": "d98a893610a82d86c64a6d670804160a9385df06c34d1bebb86c27c3dec9fdca", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01762.ts", "upstream_id": "BenchmarkTest01762", "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 _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n res.json({ accepted: true });\n}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b15ac70a96f249ebed12d71bbc7134f16baa57db3c257197a61ed20657f6215", "structural_hash": "d7286140d7e1723f0e82008b75ce018ce191b70bf9994b9aeabe38c49d73b3a3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09531.sh", "upstream_id": "BenchmarkTest09531", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n case $data in /bin/echo|/bin/cat|/usr/bin/id) allowed_bin=$data;; *) echo \"forbidden binary\" >&2; exit 1;; esac\n exec \"$allowed_bin\" --status\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-114"], "category": "process_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:process_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eeb015549cded16208dcc13617a7f0ed71e217a757f267e41e2f52de9a954273", "structural_hash": "13a2c9a12f63125aa27e81c45dbad8ff234b52654a107078e307ea7394eb50b0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06875.c", "upstream_id": "BenchmarkTest06875", "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 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 _path[512];\n snprintf(_path, sizeof(_path), \"/var/app/data/%s\", data);\n int _fd = open(_path, O_RDONLY);\n if (_fd >= 0) close(_fd);\n}", "label": 1, "cwe": ["CWE-59"], "category": "symlink_following", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:symlink_following", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ac5f198b40ecbb56b141ff2f18586eb4b49fc36b9427b494239e723298b0ab37", "structural_hash": "27f25022e5dccc120816eda6227f296557606a31f4f899dcb6945a49b0b3c909", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01888.php", "upstream_id": "BenchmarkTest01888", "language": "php", "code": "headers->get('Authorization', '');\n $data = sprintf('%s', $userInput);\n $resolved = realpath('/var/app/data/' . $data);\n if ($resolved === false || strpos($resolved, '/var/app/data/') !== 0) { return new JsonResponse(['error'=>'forbidden'], 403); }\n $checkedPath = $resolved;\n unlink((string)$checkedPath);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "302c9ed8cef309622b25ec5970bd28bc370a223c73fc5fe5a45db930b632f30e", "structural_hash": "6006c352af6ba3229894856bc0dab54186c738d30d83c549f512a71a7389b81e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03113.ts", "upstream_id": "BenchmarkTest03113", "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(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const transform = (v: string): string => v;\n const data: string = transform(userInput);\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "22aca66d453ffaff33fdbf10bfce5cc7f183d69002b4306f2e3207330cd1ea73", "structural_hash": "30e544d6b6d57a8097c257faf1db673b2c995f9b4c5c1e79aa4277c8675b18f5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21172.c", "upstream_id": "BenchmarkTest21172", "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 printf(\"%s\", data);\n printf(\"\\n\");\n}", "label": 0, "cwe": ["CWE-134"], "category": "format_string", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:format_string", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "de2da8da279efb531b828cee75e59b049b6029ca3a374c9a89bbaf191a76f0f1", "structural_hash": "2b429fbaa31d9bba709debd787b83b4f2ce541d7e445554cef758d1f1d67c218", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01260.rb", "upstream_id": "BenchmarkTest01260", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"open-uri\"\nrequire \"digest\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].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 DB.execute(\"INSERT INTO feed (data) VALUES (?)\", [_body])\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cd56bd30a01ed2ad25e931080ea1723dd8346db8af437abdf0f38632a164e2a", "structural_hash": "ec8af986ca0536dcaa9e4913f48c1182754d95b158091c72e06c95697e50aade", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00415.java", "upstream_id": "BenchmarkTest00415", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport javax.xml.xpath.*;\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.replace(\"\\u0000\", \"\");\n if (!(\"true\".equals(data) || \"false\".equals(data))) { response.sendError(400); return; }\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 response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9ffa7ad245c3b80a59370c89f2a09ad0adbbbdcf97364a4309fcf0cfc07c88a2", "structural_hash": "ac58a7562587e6d1bf326b13e883a2c120f84981a7f3302beb2be823848636a8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03450.java", "upstream_id": "BenchmarkTest03450", "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 if (headerValue.length() > 256) { data = headerValue.substring(0, 256); }\n else { data = headerValue; }\n String processed = org.owasp.encoder.Encode.forHtml(data);\n response.getWriter().print(\"
\" + processed + \"
\");\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "77c2ee85bec98e9eabd27e81f1b6ab9bccf967c123f1665904fe46513277c640", "structural_hash": "96de7451a0bf11aa51c5929116b4476045c5fa3982186bfda00478dee173bd40", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01081.rb", "upstream_id": "BenchmarkTest01081", "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].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e46a27869c9feb27917aff1a4a51d8a019a62fb707d00f689bd1ea91db8d62c", "structural_hash": "3433039b477291e9f77830e90ebbded34bd3793aeabbb1654987c7179a273ae4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00402.php", "upstream_id": "BenchmarkTest00402", "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 if (!preg_match('/\\.(jpg|png|gif|pdf)$/i', (string)$data)) { return new JsonResponse(['error' => 'invalid type'], 400); }\n $entryFile = (string)$data;\n file_put_contents('/var/uploads/' . $entryFile, 'data');\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebb5cc6ff9ffb320468d056b7e5cd64b74ca9677f70966226bce0f0a0ddf5977", "structural_hash": "88e2d1dd9247b06ba6f50794b630d81331ba0890e25bb1046a32e581c96fdf5a", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01790.cpp", "upstream_id": "BenchmarkTest01790", "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 bool _authok = !data.empty();\n if (_authok) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0fa10b0089db2b737c1baa390ca2e4a45d5f155b9c2416fd9215ed911b61700", "structural_hash": "00cd60786f15b8188e9c8b7f8f107ef73af0442c0f2331e6b9c9cf40a476defb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00503.rb", "upstream_id": "BenchmarkTest00503", "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 ? user_input : ''\n system(\"echo \" + data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b63128ef0ab32920f0c874b6139d8de900ed370095d6f271b9b9b5f399715632", "structural_hash": "a393d7b55b987f3ce30cff76309c3789c55cae696edd48f445092422b3818eb0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04277.py", "upstream_id": "BenchmarkTest04277", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nrequest_state: dict[str, str] = {}\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n request_state['last_input'] = cookie_value\n data = request_state['last_input']\n if data not in ('asc', 'desc', 'name', 'created'):\n return JSONResponse({'error': 'forbidden'}, status_code=400)\n processed = data\n eval(str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e20df555653dea9a7b063277c7a4aa3847e583a1067177fb80ccbaa5731c4d05", "structural_hash": "3c8aa4c2a5491a1cd6dd73f5f12de84c7528b29c41bc613e869fd42b1283b841", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06159.ts", "upstream_id": "BenchmarkTest06159", "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(\"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 throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5af361bbe51a313d405c4d5756a2ed043e2b56dbfc53463da3f7966cf3936fc4", "structural_hash": "e3600817d5555c9ea639477f38346aeb5fba265675cfe82f31908404c7a03859", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04695.py", "upstream_id": "BenchmarkTest04695", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\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 multipart_value = (await request.form()).get('multipart_field', '')\n data = RequestPayload(multipart_value).value\n requests.get(str(data))\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a5e9e50ee392959f39a53caace4c03d2a99767224c349665b8395c06bf570dc7", "structural_hash": "ac75f8e00aa7be5842dc66617e899f37d780fa0080050eb191bb856f64c1a144", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14750.sh", "upstream_id": "BenchmarkTest14750", "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 -n \"$data\" | sha256sum\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e230683b813e3008060516b769aa1755fc88fba5d6a8307aa299c845e22b809b", "structural_hash": "fb4c4160dc32694f7047c1494b6c2e92dac020fbf4be9fa030a6a9b5120c9d7b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01075.java", "upstream_id": "BenchmarkTest01075", "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 = java.util.concurrent.CompletableFuture\n .supplyAsync(() -> forwardedIp)\n .thenApply(v -> v.strip().toLowerCase())\n .join();\n long rolloutEpochMs = Long.parseLong(System.getProperty(\"feature.rollout.epoch.ms\", \"0\"));\n if (System.currentTimeMillis() >= rolloutEpochMs) {\n return Response.ok(\"
\" + data + \"
\", MediaType.TEXT_HTML).build();\n }\n return Response.ok().build();\n }\n}", "label": 1, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1df0ac33a39d774c041e70a67addac8f9cfabe90459270ad04dcbfae224b49ee", "structural_hash": "8773d2ff59fac0c94681dc04f560a9aef78980f929cc7d3e72cea3eaeb81e927", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01910.rs", "upstream_id": "BenchmarkTest01910", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 if ![\"asc\", \"desc\", \"name\", \"created\"].contains(&data.as_str()) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n Command::new(\"bash\").arg(\"-c\").arg(format!(\"echo {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6b62f207adb7173edde474d9eabc601f4339277b5c086d9248b50178f022f445", "structural_hash": "13bafdb80b00b81e8823dc486cfbe080d2e78b32dee54fc27812bd26a8ef1031", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05584.rs", "upstream_id": "BenchmarkTest05584", "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 let data: String = env_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| env_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 (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n ([(\"X-Custom\", processed.as_str())], Json(serde_json::json!({\"status\": \"ok\"}))).into_response()\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39c574ed0092a3f61c000ba9337dd9a0aa5bf8379e3299d17fdbb4326be6f20d", "structural_hash": "c1626d0d3733ba22b2f2a3e07f4f26e340b85e23eb2aa388620bbf32b8abccaf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32953.go", "upstream_id": "BenchmarkTest32953", "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\tmultipartValue := c.PostForm(\"multipart_field\")\n\tsegments := strings.Split(multipartValue, \",\")\n\tdata := strings.Join(segments, \" \")\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\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\tc.String(http.StatusBadRequest, \"index out of range\")\n\t\treturn\n\t}\n\tc.Header(\"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:gin:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b89db1028ecad2b14415ad39bf52a139fc117611ec444fc240769315ced60948", "structural_hash": "52e33e403363bb00e7098b2d6d7572a92749e613d300da598e0c36bbfe37277c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15732.sh", "upstream_id": "BenchmarkTest15732", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n echo -n \"$data\" | md5sum\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-759"], "category": "unsalted_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b13e3b525756285ac6c7ebcfe32d8f3174a152aa6d4756acab2e3ac0713e66f3", "structural_hash": "16a12afd7b2f4b3fcd79e4dc98ee4a29357b53c60c1ea1782309f0b786e92563", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04837.py", "upstream_id": "BenchmarkTest04837", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import RedirectResponse\nfrom urllib.parse import urlparse\nimport requests\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n api_value = requests.get('https://api.partner.example.com/v1/profile').text\n data = '%s' % str(api_value)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return JSONResponse({'error': 'forbidden host'}, status_code=403)\n target_url = data\n return RedirectResponse(url=str(target_url))", "label": 0, "cwe": ["CWE-601"], "category": "redirect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:redirect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "220aec717127afdbfc8ac1969d49cd454b8d572d823fb41979ca46ed1ff911cd", "structural_hash": "a956ef71613512dbcd5e29267c4b31fe8991d47bde09f8227f82c72094383741", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04917.rs", "upstream_id": "BenchmarkTest04917", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 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 Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", processed)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bddd4f10bcf0d733278a049c36c8bf0948713be5983012757991ae2db852890", "structural_hash": "2329b2c765553518600aebe41292c7fc9757a49a3e5f61f5c9863b28aa9d6c47", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03049.sh", "upstream_id": "BenchmarkTest03049", "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 echo -n \"$data\" | sha256sum\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:predictable_salt", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "270246f1168fd57590785340742d0f8c6b3a638f24b9a6fb1c04f04c65b77561", "structural_hash": "55c52c244bc8652189483363e8279daacf192ce74053c9aa417f5f51c9a89c9d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03272.rs", "upstream_id": "BenchmarkTest03272", "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 = env_value.to_string();\n crate::shared::db_query(&format!(\"SELECT * FROM users WHERE id = '{}'\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6f8c2854ebc320badbd5f693f9460cc5525cbde5502248afd28618a4429e59f4", "structural_hash": "8bca4e9681d4d485d6685f6ebab89eca3da42625d4f15847d64d1f1ab546753f", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03096.ts", "upstream_id": "BenchmarkTest03096", "language": "typescript", "code": "import { Controller, Post, InternalServerErrorException } 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 _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n throw new InternalServerErrorException({ error: data, stack: new Error().stack });\n }\n}", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8f418201ad7a3a7507ed23365901a6ea50fd7d4ab35215628f3a09ade0b1bca", "structural_hash": "11e61b58b30387b68c14175d072517a0f49b65e13c79e1e88410dc3ad2f88cc4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04308.rs", "upstream_id": "BenchmarkTest04308", "language": "rust", "code": "use axum::extract::Path;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\npub async fn benchmark_case(Path(path_id): Path) -> impl IntoResponse {\n let path_value = path_id.clone();\n let (payload, _origin) = (path_value.clone(), \"http\");\n let data = payload;\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3a82784206fa29688bc27cc3396755fad530abb62dac0acb776c55194d635d57", "structural_hash": "c786508ef09e6fd4336994904ac0d1979632bed800299055c31cdcf76d250340", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02868.php", "upstream_id": "BenchmarkTest02868", "language": "php", "code": "header('X-Custom-Header', '');\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 $actions = ['asc' => 'sort_asc', 'desc' => 'sort_desc', 'name' => 'by_name', 'created' => 'by_date'];\n $result = $actions[(string)$processed] ?? 'noop';\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "905e779f1ff25f40d10627f7a7788817d5b01bcfcbbd0c651f8739cd364b2e9f", "structural_hash": "1e4d67c922efd5e3bf91a48a5142f1ed52735ac42b8d71a6af21192bde886e15", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05575.c", "upstream_id": "BenchmarkTest05575", "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 long _sz = strtol(data, NULL, 10);\n if (_sz <= 0 || _sz > 65536) return;\n char *_dst = malloc((size_t)_sz + 1);\n if (_dst) { strncpy(_dst, data, (size_t)_sz); _dst[_sz] = '\\0'; free(_dst); }\n}", "label": 0, "cwe": ["CWE-680"], "category": "int_overflow_buffer", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:int_overflow_buffer", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ba84a3cceb0039159bed0c0c3fac562ed15fc42404ee991a56f821c6003f162e", "structural_hash": "7543757f1bfaa82f58f63419e8042128fa7cf3dd519d1488ccd3cf42d9e46ce8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_03901.go", "upstream_id": "BenchmarkTest03901", "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\tcapture := func() string { return forwardedIP }\n\tdata := capture()\n\tif !aclCheck(c.GetString(\"user\"), data) {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8990286b064414ff5d44aeb60daae851a626218c145b3ab99b60763b8261dd49", "structural_hash": "97e702a38d1edc05144d8eabc7b2438f1c081374afa1bd4caa07628497480c32", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00507.php", "upstream_id": "BenchmarkTest00507", "language": "php", "code": "request->get('field', '');\n $data = (!empty($userInput)) ? $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 new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-90"], "category": "ldapi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:ldapi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae719361886a5762fcdefe758f0b0a5420e2cd1f8b45dbb72fa8684752fc5a2a", "structural_hash": "afc96c4d8b51c71f3b2b22338c387dad47fee0c53dda19ab2248f3b7d1734bc7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05474.py", "upstream_id": "BenchmarkTest05474", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n def normalize(value):\n return value.strip()\n data = normalize(referer_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:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "962e19727bf6cedaefcdfde4c36a17e2f69e984588b5997793187a0b966d4304", "structural_hash": "d7019724ec7b3f50cb22d727b255e7de0d124945062973e6dd62c0815eb3d505", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05289.php", "upstream_id": "BenchmarkTest05289", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23aefa026fb5de4d38b1bd645db1e56d535a6bec336ebd1370e6d329face0f39", "structural_hash": "8674ebfdbcf2c49dec34c33d9049ad9ee1d266e15625b22c399587e6fe5bd3cb", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_13260.go", "upstream_id": "BenchmarkTest13260", "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\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\tloginAttempts.Add(1)\n\tif authVerify(\"user\", data) {\n\t\tc.JSON(http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33ca22023928c6d658617ac86e6ee4614057f651b4eff6cea8d49f4920e7bbfa", "structural_hash": "fb7ae5a8195684333daf115f7cbaf0f2ab78b9b9986edb4de5761f6a63e3401e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07637.go", "upstream_id": "BenchmarkTest07637", "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\tdata := BenchSvcPassthrough(originValue)\n\tif !aclCheck(c.GetString(\"user\"), data) {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-642"], "category": "external_critical_state", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb47da6692e38a5122eb01427fe5b7436d25062e21db47af739fdeeef571256f", "structural_hash": "f4105b5da9a12311b28116294bf78a2d5718d20da80f51f3bf70be3117699cee", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02303.c", "upstream_id": "BenchmarkTest02303", "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 srand((unsigned)time(NULL));\n int _token = rand();\n printf(\"token for %s: %d\\n\", data, _token);\n}", "label": 1, "cwe": ["CWE-331"], "category": "insufficient_entropy", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:insufficient_entropy", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "943869dd390a6fa86c04fab5120d720a519944d657b8b8f5ee015511c09556fe", "structural_hash": "901378abc5c891bdbde87caa03e1586f4d2645f1cfcb84abe1ddec73944a2fdf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00682.php", "upstream_id": "BenchmarkTest00682", "language": "php", "code": "header('User-Agent', '');\n $data = \"{$userInput}\";\n eval((string)$data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-95"], "category": "eval_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9772bf697f263e5d445bfb02d436e2e5241c76cbe834ef8b3f636efc2113f444", "structural_hash": "02d85ff37fb7a186851f9e7b95058ff965c95cd582136dce98c894e8e7db098e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00544.cpp", "upstream_id": "BenchmarkTest00544", "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(\"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 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 _cmd = std::string(\"ls \") + safe;\n std::system(_cmd.c_str());\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:cmdi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2ee69e699d907a89abcbfeb2bfe22231ea72e88920e4957d06db4fd147688d5", "structural_hash": "3689b6c518fcbe57cfef1545047fd4dd49a4ab67849d5d9c22d2d79ba354ab4d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05842.rb", "upstream_id": "BenchmarkTest05842", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"securerandom\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:users].first&.fetch(: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 token = SecureRandom.hex(32)\n content_type :json\n JSON.generate({ status: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "466c91d9bdcd8d56c06ba0af92e0f056a55c05efc45c7e5da7a3d9936cbd1b44", "structural_hash": "8121168609a610ab57d70c381dec7ec9846a6eb69bc0b9a6eeba54bea8f65047", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_02383.cpp", "upstream_id": "BenchmarkTest02383", "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 const char *_admin = std::getenv(\"ADMIN_API_TOKEN\");\n bool _allowed = _admin && data == std::string(\"Bearer \") + _admin;\n if (_allowed) res.set_content(\"authorized\", \"text/plain\"); else res.set_content(\"forbidden\", \"text/plain\");\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a1607f308af184596ebe78f563f7ff513c1d5d52bfffb8577c4c042de2b5acbc", "structural_hash": "cc20662e67ba1638181ddd55485d5d5ef6968c47cc12230791fa785791b7eaf0", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_14569.go", "upstream_id": "BenchmarkTest14569", "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\thostValue := c.Request.Host\n\tdata := fmt.Sprintf(\"%s\", hostValue)\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\tarr := []int{10, 20, 30, 40, 50}\n\tidx, _ := strconv.Atoi(boundedVal)\n\tif idx < 0 || idx >= len(arr) {\n\t\tc.String(http.StatusBadRequest, \"index out of range\")\n\t\treturn\n\t}\n\tc.Header(\"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:gin:array_index_oob", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "900f063161725d2acc206fcc669a15f4d9c72615497b69a51ccd82beed39b014", "structural_hash": "e6818630652a7de65d1dd3b4e88485683bb802c1424ac6af6a8da8c2da9c80b2", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00895.cpp", "upstream_id": "BenchmarkTest00895", "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 char _fmt_buf[512];\n std::snprintf(_fmt_buf, sizeof(_fmt_buf), \"%s\", user_input.c_str());\n std::string data = _fmt_buf;\n long _n = std::strtol(data.c_str(), nullptr, 10);\n char *_buf = new (std::nothrow) char[(size_t)_n];\n delete[] _buf;\n}", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24590467b55339f0f70abd5022e89bde57e5a9e37549b05ea0be25fb44bb4a63", "structural_hash": "ab9759490e4bb47dc44d7652442d864677d8c7fe4f65de0aad1e541b72170ca6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18687.go", "upstream_id": "BenchmarkTest18687", "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/sqs\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tauthHeader := c.GetHeader(\"Authorization\")\n\tcapture := func() string { return authHeader }\n\tdata := capture()\n\tsqsClient.SendMessage(context.Background(), &sqs.SendMessageInput{\n\t\tQueueUrl: aws.String(\"https://sqs.us-east-1.amazonaws.com/123456789012/app-events\"),\n\t\tMessageBody: aws.String(data),\n\t})\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "64afb79d3946df2014aa61632ba05868f0bcbe591ad27e1ef06c87d2303633a9", "structural_hash": "cb10bc023bb699c49031c86363770c1cae744cabe5c3907c4190776a59448332", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "httplib/testcode/benchmark_test_01208.cpp", "upstream_id": "BenchmarkTest01208", "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 _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) res.set_content(\"welcome\", \"text/plain\"); else res.set_content(\"denied\", \"text/plain\");\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:httplib:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86f5c0bd318356753c456f0476736fb10640a6ba7e22a8e3b5697ce6744c3e2f", "structural_hash": "6afb5a214feaa1d9348dd96c90ba59315ab90a2b71c2a71371d6d754dd0f7aa3", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32819.sh", "upstream_id": "BenchmarkTest32819", "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 _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3dbd1c9acd79fcafe5e3de698c878ff1ce04cf75404c0001f0d9d84f07a25f0", "structural_hash": "1f98b76bb5e6a4227c17aaa822f135b4b604bc3ab61ea3497cbc7550a08c6af7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00402.rb", "upstream_id": "BenchmarkTest00402", "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.split.join(\" \")\n if %w[read write admin].include?(data.to_s)\n render json: { access: \"granted\", role: \"admin\" }, status: 200\n end\n end\nend", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0c9091f348d929a304ed42f052af0c76a1d97efe345308c501244ec88f08bf54", "structural_hash": "b501572945a7fc0df91c021a61a8eaf4dd1f2e3221c5da9ae52c8a9177c61f0d", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08194.c", "upstream_id": "BenchmarkTest08194", "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 printf(data);\n printf(\"\\n\");\n}", "label": 1, "cwe": ["CWE-134"], "category": "format_string", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:format_string", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50e05b66bffc6e15d0241494f8ab6a36a7138744d92053e459458f73ac741263", "structural_hash": "24dec106d96cd6182999bd815ac051efadac60bf0bc099cfafdb06bc91c4a0b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00080.js", "upstream_id": "BenchmarkTest00080", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.origin || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\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 http.get(targetUrl);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44422699ea5573e88147ea297a04c0bab79825786cf3435f8f8df8320281d64c", "structural_hash": "7ced6d2aa4940762f152785e5aed567eb3795df6a9a5ae5a4881ab5d6ae257b9", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_01743.ts", "upstream_id": "BenchmarkTest01743", "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 capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n eval(data);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbc258e37865f190a5c087d38ab85737bc8ca4e9fad26e44fdc0b6553c6a962b", "structural_hash": "ad4357f025f9851c8d6f407e36f283ba2c185e7496fefe2cc95f6aafcfa9e5de", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02828.php", "upstream_id": "BenchmarkTest02828", "language": "php", "code": "fetchOne('SELECT text FROM comments LIMIT 1');\n $data = ($userInput !== null) ? $userInput : '';\n $digest = md5((string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4c52c9b7f4ad4f8987d2af2b5831209f0808f665e47c8c43aecc130bc5cede2", "structural_hash": "183b0fe00e6a42ec913e2dfd306a4ced64e5d200cbc62e088b01d73f57f33a39", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05420.java", "upstream_id": "BenchmarkTest05420", "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.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(hostValue);\n Runtime.getRuntime().exec(new String[]{\"sh\", \"-c\", \"echo \" + data}).waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3ff0f1842df3e7fa9c1f0b0e9cc83f1876d0ebad847854d06f6d9f1b1dadcad0", "structural_hash": "602d508bd3cceb7a6534f9f54eb8d0a58efe511273f846df5e57194c51b66e64", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00528.rs", "upstream_id": "BenchmarkTest00528", "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 data: String = json_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| json_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 (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::write_csv(&format!(\"{},data\", processed));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b9de702a372737c46c0fb249c6e8f93b0c993941145b00481bdb666f4873665", "structural_hash": "281b89e2154fae9525d31e2b5ec33f68919246633af5f9cbf2cfe6741d42276c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04437.rs", "upstream_id": "BenchmarkTest04437", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let upload_name = crate::shared::uploaded_filename();\n let transform = |v: String| v.trim().to_string();\n let data = transform(upload_name.clone());\n tokio::fs::write(format!(\"/var/uploads/{}\", data), b\"data\").await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b6e3b0d2daa8c52471ca5d39f9f5087869def6939f0f04942d7d55d864d5ab9", "structural_hash": "53cc658326ada45b4599c0b34d3c39d9be70191ba5b8b7c6570a267f81e0294b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03927.rb", "upstream_id": "BenchmarkTest03927", "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 cred = ENV.fetch(\"APP_CREDENTIAL\", \"\")\n _ = cred\n render json: { auth: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb4dc3a69386583ede8affea9f45a8930644fca4c3505a65e5888a259e6f9f4a", "structural_hash": "392b96d11acce139dd40fb029c3d743ce5360f83065a0b34dafd9ef9aa0cb7e4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00087.sh", "upstream_id": "BenchmarkTest00087", "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 echo \"$data\" | grep -qE \"^[0-9]+$\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-754"], "category": "unusual_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:unusual_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6ca70c7020bb7f77205f9967425e122245c1d929dd30de52e0952ab11327d1cb", "structural_hash": "3bde5c8d139b31ddfb5aa95fd12b689b47370a245c25b0f143e0b123e3394554", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_29996.go", "upstream_id": "BenchmarkTest29996", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\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\tDB.Exec(\"DELETE FROM accounts WHERE id = ?\", data)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d86053fe8cc639c0dd99627eb344dfc9ccf59f63f900314f9bda81d53bcf632", "structural_hash": "0261c5e5dd0dbf257c78db3af76005efd8652d39a5f7bb545c61547be4e85c18", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_37543.js", "upstream_id": "BenchmarkTest37543", "language": "javascript", "code": "const childProcess = require(\"child_process\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.host || \"\";\n const data = String(userInput).split(/\\s+/).join(\" \");\n childProcess.execFileSync(\"echo\", [data]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7312f42eb619f942a533f4a9aa91a91cd6cbe86a66f58b2c5dab19c101286d2c", "structural_hash": "733b9e36fa1f0143468b4b1bd5b4da43f7ba6459e3ec71dd5874bccdd8b39bd4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04617.rs", "upstream_id": "BenchmarkTest04617", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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.to_string();\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5eecf8afe4fd17fe6bbf16d529aae8edbc76f418611820f44afeeaa058096e58", "structural_hash": "c43539dbdc4e0bcad509016a6d8954c71a4570104f6058aaaee3cdde03cfbf64", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01078.py", "upstream_id": "BenchmarkTest01078", "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 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:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96607364588ef7173dd197c425d6c84dfb8f3cbeb174993be194065b83a8822f", "structural_hash": "17e3fc032110a1ab3862cb4ac9635773a6f569896c6ff853a9c72b871086cbd5", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03285.rb", "upstream_id": "BenchmarkTest03285", "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 data =~ /\\A[a-zA-Z0-9_.-]+\\z/\n render json: { error: \"invalid\" }, status: 400\n return\n end\n processed = data\n system(\"echo \" + processed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4620a415267e3664f43a2d0318337189765078af01fa1d654caf8361a4e12ff3", "structural_hash": "12e6ec89486daac30d51b60bd1991369f837aa81c11197044b4a4b9aaad82c71", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest01988.java", "upstream_id": "BenchmarkTest01988", "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 { PLAIN, MARKDOWN, HTML, TEXT }\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.Supplier valueSupplier = () -> \"payload:\" + fieldValue;\n String data = valueSupplier.get();\n try { AllowedValue.valueOf(data.toUpperCase().replace(\"-\", \"_\")); }\n catch (IllegalArgumentException e) { data = AllowedValue.values()[0].name().toLowerCase(); }\n return Response.ok(\"
\" + data + \"
\", MediaType.TEXT_HTML).build();\n }\n}", "label": 0, "cwe": ["CWE-79"], "category": "xss", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:basic_xss", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "046b6716021522c49a5e27c3b9bb2487658d4fe0da1344db32050d1a7f98978e", "structural_hash": "09a61cf3f1908ee73676eb891c36454765b7d92318b210f921df0def6941d07c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03947.java", "upstream_id": "BenchmarkTest03947", "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.nio.file.Files;\nimport java.nio.file.Paths;\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.List tokens = java.util.Arrays.asList(fieldValue.split(\",\"));\n String data = String.join(\",\", tokens);\n Files.write(Paths.get(\"/var/uploads/\" + data), \"data\".getBytes());\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae5e4fe3d6f93e117d9e755b8d0dee8f365f66c114332f224ac05e96a08045a7", "structural_hash": "95ef440ea454529a5d9a6a010eafda61046f7d741cb23849822eb63207af579b", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00675.php", "upstream_id": "BenchmarkTest00675", "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 $digest = password_hash((string)$data, PASSWORD_BCRYPT);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff58c06caa1e74f2ed8c3c54854b5d9526c0e3d7fa73b3e7755348727e38b7ba", "structural_hash": "b11f449cc5c7e6e8d611ca3b9ffbe79e242e8f7842affa35bc82b2cebae0cbb7", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02979.c", "upstream_id": "BenchmarkTest02979", "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 long _v = strtol(data, NULL, 10);\n if (_v < 0 || _v > 4294967295L) return;\n unsigned int _u = (unsigned int)_v;\n printf(\"%u\\n\", _u);\n}", "label": 0, "cwe": ["CWE-195"], "category": "signed_to_unsigned", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:signed_to_unsigned", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d740382def7f964b774f7c30b1d8b32d1f786f88979a96736b849c0109a25b14", "structural_hash": "f6242fa33d319c5a20da8151a0e327b6ca9dc07c1619f85225bf107134bcd384", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13883.sh", "upstream_id": "BenchmarkTest13883", "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 dd if=/dev/zero of=/tmp/alloc bs=1k count=\"$data\" 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-799"], "category": "interaction_frequency", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:interaction_frequency", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9aca0f18e8c526dddfae3b13df147d66f822293f24c54427c37ba9f54c57c547", "structural_hash": "a30ef438e116f23e7c65b29b1578076b0ca49a03642d931ba7cc7f2340c39f87", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03535.java", "upstream_id": "BenchmarkTest03535", "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.nio.file.Files;\nimport java.nio.file.Paths;\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.net.URLDecoder.decode(userId, java.nio.charset.StandardCharsets.UTF_8);\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)) { return Response.status(403).build(); }\n String checkedPath = resolved.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 return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:fileupload", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4750cee9073739ff151a806519a2af638d72a2a2928c636ef24be697a37392d1", "structural_hash": "2687aa056affb0717f53e3a2668674e192d655838ed6e1dccad5cc94fbfb1a70", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00582.rb", "upstream_id": "BenchmarkTest00582", "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 normalize = ->(v) { v.to_s.strip }\n data = normalize.call(user_input)\n File.write(\"/var/data/output\", data)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "122284922317a68ad39a9436b3fcebb27353e8fac91b10cebd7400ad06c29e75", "structural_hash": "b4364d02107b4f0e220763fc1cc6064e659dda374daa0327b69fe935191aa903", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04894.rb", "upstream_id": "BenchmarkTest04894", "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 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 _enc = Base64.strict_encode64(_cipher.update(data.to_s) + _cipher.final)\n File.write(\"/var/data/output\", _enc)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6422abaf7b12c52656e2ac0cbd9ee7b40f57dfb115dc26aaca3ab9c92e843c90", "structural_hash": "904a832e46d0feec5757f534062e6563f80145a8a04f4583cbc0c78e60cd3ce8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06138.ts", "upstream_id": "BenchmarkTest06138", "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 capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n res.cookie(\"session\", data);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae90e7847463903489e2e3bcc96e649f65d4e71d72fa592b4426b5f18d721983", "structural_hash": "d8aa56706a0f4f9d2afd4cad328965b8d23ac290a0348951c52104ef5b47dc56", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00506.php", "upstream_id": "BenchmarkTest00506", "language": "php", "code": "headers->get('Host', '');\n $data = sprintf('%s', $userInput);\n $requested = (int) $data;\n $allocated = $requested + 1;\n return new JsonResponse(['allocated' => $allocated], 200);\n }\n}", "label": 0, "cwe": ["CWE-190"], "category": "intoverflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:intoverflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25859d4880519c42af50a15e29852a2bcc0562e64a4b1534f4ca6454890802b4", "structural_hash": "9114da6e41023af26ab48c33f6887a794e6b6e01aad118e7638e1ade617b749e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_18537.go", "upstream_id": "BenchmarkTest18537", "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\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(graphqlVar)\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tvalues := strings.Split(processed, \",\")\n\tif len(values) > 0 {\n\t\tc.Header(\"X-Param-First\", values[0])\n\t\tc.Header(\"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:gin:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f45a5f02f345c47cb0d6d8f6fed0de62f0f1c4a554afb8fc549f5c1b4e63666", "structural_hash": "6a3c08b56168687b725d5d66f90301c63f328d28c7280aab2038e88701328388", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02214.py", "upstream_id": "BenchmarkTest02214", "language": "python", "code": "import requests\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 kind = 'json' if str(dotenv_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(dotenv_value).strip()\n case _:\n data = str(dotenv_value)\n requests.post('http://api.prod.internal/data', data=str(data))\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8547fec51188d5518244e82f3d9a61d18ea315d495c8cfb1f1bc8c67e594e80", "structural_hash": "18ce0e9310866437dff2ac91d7bfb96aed6cb0efe9ccf65b22eace3d52c0d7b6", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express_ts/testcode/benchmark_test_00056.ts", "upstream_id": "BenchmarkTest00056", "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 _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n eval(processed);\n res.json({ accepted: true });\n}", "label": 1, "cwe": ["CWE-94"], "category": "codeinj", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:express_ts:codeinj", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d3f3609f464fd542920565822e4ebc9275e56454e47856d2bebcc1f6b1efe629", "structural_hash": "a7e15c35991bcee5df79940af55c493827b85ad6903f510dfc0de816c2d11e05", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39473.go", "upstream_id": "BenchmarkTest39473", "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 := strings.Join(strings.Fields(fieldValue), \" \")\n\tif data == \"admin\" || data == \"true\" || data == \"authenticated\" {\n\t\tc.JSON(http.StatusOK, map[string]string{\"authenticated\": \"true\"})\n\t\treturn\n\t}\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-302"], "category": "auth_bypass_immutable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9ec0edf62e9bb140cb2723f7ab7ed5da6ee72d17affc43c28ed3cb5508138ac", "structural_hash": "17d817f06114facf60d357c37c80d5c1d23069564885f455fcf48a9c9fe4a4c4", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05389.go", "upstream_id": "BenchmarkTest05389", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"go.mongodb.org/mongo-driver/bson\"\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\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\tmongoClient.Database(\"benchmark\").Collection(\"users\").FindOne(context.Background(), bson.D{{Key: \"status\", Value: processed}})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "156aa834c438bfbb78693d60c3c31571bc8cda875c06ca5adfa317866fb2328f", "structural_hash": "ea875ded384c76d8eaefb5d753287f107680114ff7dc7468190e2caa11386cb1", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05068.php", "upstream_id": "BenchmarkTest05068", "language": "php", "code": "query('id', '');\n $thunk = function () use ($userInput) { return $userInput; };\n $data = $thunk();\n if (!in_array($data, ['asc','desc','name','created'])) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n exec('echo ' . (string)$processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0095f1fb9f47a0ac128c5e343688e809702ac61fd9fe4cc9c3c07b66be19ee4e", "structural_hash": "792bac2b36cefb307bdeeae871780088136605e9c04f2f9af4f63fb04d1d39fc", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_22161.c", "upstream_id": "BenchmarkTest22161", "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 _sz = atoi(data);\n const char *_payload = \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\";\n char *_dst = malloc((size_t)(_sz + 1));\n if (_dst) { strcpy(_dst, _payload); free(_dst); }\n}", "label": 1, "cwe": ["CWE-680"], "category": "int_overflow_buffer", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:int_overflow_buffer", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73810518293991f29930d89cfc43769e234849fd53758a6c07cb5205db192fed", "structural_hash": "715d5a3abf5d2981903c46a5b1e63b32518db63419871c5f3f01aed7dd5111ea", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03105.rs", "upstream_id": "BenchmarkTest03105", "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 = if path_value.len() <= 4096 { path_value.clone() } else { path_value.chars().take(4096).collect() };\n crate::shared::write_csv(&format!(\"{},data\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ece2a5c90444921a2f0de43533225b16cf1035420e0caf4020977f7a3e60067", "structural_hash": "574559a2e8809ed8de237f28f4fb3f68319eab06f375925610c063dcc75ee25e", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04127.py", "upstream_id": "BenchmarkTest04127", "language": "python", "code": "from fastapi import FastAPI, Request\nimport requests\nfrom urllib.parse import urlparse\nimport ipaddress\nimport socket\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 = '{}'.format(raw_body)\n parsed = urlparse(str(data))\n resolved = socket.gethostbyname(parsed.hostname or str(data))\n if ipaddress.ip_address(resolved).is_link_local:\n return JSONResponse({'error': 'metadata endpoint blocked'}, status_code=403)\n target_url = str(data).replace(parsed.hostname, resolved) if parsed.hostname else str(data)\n requests.get(str(target_url))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "056a764dade648becf31e1424dca2aad7018a4e63623e69343b279b5fbf839fc", "structural_hash": "abc45dd475e8ac5410f1dca8a6a59cbfd09d0fa813a39208a02aa974b52c8ede", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01400.py", "upstream_id": "BenchmarkTest01400", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n data = '%s' % str(xml_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:django:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a68334229710a3eeea4cb8dccd403b8a13268240d76416d6ee3cef7399a6f08e", "structural_hash": "600658e7b16d9724c83807442bc7384d7bafbd66ca4f21514129809dcd9d80a8", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00966.ts", "upstream_id": "BenchmarkTest00966", "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(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n throw new InternalServerErrorException({ error: \"Internal error\" });\n }\n}", "label": 0, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a46aa149aa8507765673878bf384bd9ba8672c3d310587da54b84f6a75861ebe", "structural_hash": "d1f2299b6e2f333236b7e10a859bace87778530376db63c4c4a211099485765c", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00765.sh", "upstream_id": "BenchmarkTest00765", "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 _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n xmllint --xpath \"//user[name='$processed']\" /var/data/users.xml\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62438b0edae0ab4f785f4ab4a4f6de358782a4004fa874f1a88599d24ddcde9b", "structural_hash": "9dd2cbc526100d6eb1e89c963f6c02e34340553d73a37ef1c0bda0c53707f061", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14620.js", "upstream_id": "BenchmarkTest14620", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(data)]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-274"], "category": "insuff_privilege", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21eff50d394addc75a578c14114ce29c754a87d51b328f4bef822daca6879c87", "structural_hash": "700aa4c051988e7de64b6cf6da127c11abdd0c709999b08df47c864501f718db", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05569.rb", "upstream_id": "BenchmarkTest05569", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"digest\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Profile.first&.bio.to_s\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n _hashed = Digest::SHA256.hexdigest(data.to_s)\n File.write(\"/var/data/output\", _hashed)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "957e8033a0f6e5dbf63d42a806daa7c1945f9aa7e6251b0b378467c5ed36055a", "structural_hash": "85e2f00c63f7717e95916ef785b12609fd67a19fb0c8450b211c354727da5b05", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16823.js", "upstream_id": "BenchmarkTest16823", "language": "javascript", "code": "const http = require(\"http\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.referer || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n http.get(data);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "573464c56acd9988f4b46cfedc89e97107a869b12d349c586db0df300c1440b6", "structural_hash": "5800db728a06dd8a0d1993e44a2efb0a2f72c16fc7912bf54cd5811e9c1fd500", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_02017.js", "upstream_id": "BenchmarkTest02017", "language": "javascript", "code": "const fs = require(\"fs\");\nconst 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 if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { ctx.status = 400; ctx.body = {error:\"invalid\"}; return; }\n const processed = data;\n fs.appendFileSync(\"report.csv\", processed + \",ok\\n\");\n ctx.body = { 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:koa:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d74d194a8ed9188c7e63a284a5a2184c503ce77b61c13ea07a443787ddbc12e9", "structural_hash": "c3e2ad64d4f564c19f2cb3dae185087e5dc84a9bf91edff84602fbada52be292", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest03426.java", "upstream_id": "BenchmarkTest03426", "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 = hostValue.isEmpty() ? \"default\" : hostValue;\n new ProcessBuilder(\"echo\", data).start().waitFor(5, java.util.concurrent.TimeUnit.SECONDS);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "596002a5fa286370e89596c0eb4757278b074696f125ba5576ae183ca70e4d8e", "structural_hash": "178d55480adb167b173117b11a3bb8dd90610da5d43523e9397ed395d28415cf", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01275.rs", "upstream_id": "BenchmarkTest01275", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse tokio::process::Command;\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 (tx, rx) = tokio::sync::oneshot::channel::();\n let payload = graphql_var.clone();\n tokio::spawn(async move { let _ = tx.send(payload); });\n let data = rx.await.unwrap_or_default();\n if std::env::var(\"APP_ENV\").unwrap_or_default() != \"test\" {\n Command::new(\"sh\").arg(\"-c\").arg(format!(\"cat {}\", data)).output().await.ok();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e311e5293cea02fb966248eda74b18b14c138106c2e91e3a1805534be5618496", "structural_hash": "93dbd4106cf749a5a0390d5a64c6529f77fdae7994cb4881640876f9d76f8751", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01289.py", "upstream_id": "BenchmarkTest01289", "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 json_value = req.payload\n processed = 'true' if str(json_value).lower() in ('true', '1', 'yes', 'on') else 'false'\n trusted_claim = str(processed)\n return JSONResponse({'trusted': trusted_claim}, status_code=200)", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a3e40ea7aa5cac819adcf231fba0bfa4f65c53300562f70b7215db61ce78143", "structural_hash": "8e616256a4fbc0ecbae309330fab281342e3eabc18b2fbbd81fb197ee02f6d35", "split": "valid"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00226.c", "upstream_id": "BenchmarkTest00226", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nextern unsigned char *SHA256(const unsigned char *d, unsigned long n, unsigned char *md);\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 (strcmp(data, \"hunter2_default_pw\") == 0) { printf(\"auth ok\\n\"); }\n}", "label": 1, "cwe": ["CWE-1393"], "category": "default_password_use", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5095fb15295d363443db0706e14c19b057e5bc745eea2d308a73224f54622ec3", "structural_hash": "a9097650e55db1da1ecbc06d63d0bbce15d5380a5de7d60bdaebbcc6738ef596", "split": "valid"}