{"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00978.py", "upstream_id": "BenchmarkTest00978", "language": "python", "code": "from fastapi import FastAPI, Request\nimport os\nimport re\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n data, _sep, _rest = str(json_value).partition('\\x00')\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n os.system('echo ' + str(processed))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b952bf510f00946af42d85d5597fe46cffab560bec77397c7d38ee79890b6bad", "structural_hash": "fdbcd662627bf4a587f92001d6331f90aa929f3bd4dd00edfec651bc7e6504a7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_23732.go", "upstream_id": "BenchmarkTest23732", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tpathValue := c.Param(\"id\")\n\tdata := fmt.Sprintf(\"%s\", pathValue)\n\tallowed := map[string]bool{\"config.json\": true, \"index.html\": true, \"readme.md\": true}\n\tif !allowed[data] {\n\t\tc.String(http.StatusForbidden, \"forbidden\")\n\t\treturn\n\t}\n\tcheckedPath := \"/var/app/data/\" + data\n\tos.WriteFile(checkedPath, []byte(\"data\"), 0644)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e330c2fb971275d1d00ae914248175e864bfda29dc8255bd81d4342645d2729", "structural_hash": "cfee91973d81bf9943f103f15cf42365501b918e263cbd1a9e8b61960f7f7f70", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08390.js", "upstream_id": "BenchmarkTest08390", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.origin || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _content = fs.readFileSync(\"/var/app/cache/pkg-\" + encodeURIComponent(String(data)));\n const _digest = crypto.createHash(\"sha256\").update(_content).digest(\"hex\");\n const _trusted = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\";\n if (_digest === _trusted) { fs.writeFileSync(\"/var/app/active/pkg.bin\", _content); }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:missing_integrity_check", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9e180b795e4240d6595f062260287f6005118ecf2658e8e3c49ec36de8632ade", "structural_hash": "55d02bf840fac4634bec34dd0ebd3d485d4d5443ac3c0bf6c6bb25fa10043eb9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01330.rb", "upstream_id": "BenchmarkTest01330", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ecb8feac9bee815d6613ed1ac50878eb7da43dadc61e79377aaa858708f63c17", "structural_hash": "94a6ff756af948c1c65165b4336efe74cdc8c693e8f9500820d52eb3e38219e4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00536.rb", "upstream_id": "BenchmarkTest00536", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = \"%s\" % user_input\n Process::Sys.setuid(data.to_i)\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b709688f3c4a6d47ee9843729db2fb3409c26a4f39d71329ef3d65b397fa2860", "structural_hash": "d4f726c98b426e21c7989dcbb7a2635a90815ccf20f6c89a08793930114c4bc8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19471.js", "upstream_id": "BenchmarkTest19471", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.body || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n const _result = db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(data)]);\n if (_result.affected === 0) { ctx.status = 500; ctx.body = {error: \"operation reported no effect\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-394"], "category": "unexpected_status", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed9850a7bd3120bc85655c7ac71f41c8c1be078742c11e4eb1a8a93fe63d79cb", "structural_hash": "4c7c2ad2fe84be094cf4c525fb6b095183af797c0b719a0509fbe49495ea17f2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30101.sh", "upstream_id": "BenchmarkTest30101", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n trap '' ERR\n echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-636"], "category": "fail_open", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a66f3d085b8c2822f8e3636af5aaaaa6bcaf87446334974a1198f8b00f6a002", "structural_hash": "bd91bd182c633f20098ba5c34a5d8c4feb1e96d7326f8bfb90a26e8d880de808", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05903.py", "upstream_id": "BenchmarkTest05903", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(cookie_value)\n data = collected\n if not re.fullmatch(r'[a-zA-Z0-9_.-]+', str(data)):\n return JSONResponse({'error': 'invalid input'}, status_code=400)\n processed = data\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "259eff5686004f7478fef5c072b43ba1ee65cfaedceec367ea13d0ec3ff94e84", "structural_hash": "2ea467c830b4732ba1d382c2936bca1c2cf7aaa8b2ef21c4708820ed90b10cbd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05203.java", "upstream_id": "BenchmarkTest05203", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n java.util.function.Function primary = s -> s.replaceAll(\"\\\\t+\", \" \");\n java.util.function.Function stripChain = primary.andThen(String::strip);\n String data = stripChain.apply(multipartValue);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62028f02d7cb453c0c48085426c5dc80e81c929ad861ddc7180ffcaded223aae", "structural_hash": "1fac6e3946f1d1bf78392864797506dbe04b62c2b666623379557ac3ec3c21c9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00810.rb", "upstream_id": "BenchmarkTest00810", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10a803d4bf489771f1c8f12ed1ea2276a79e8e10580a856c7f6f8a2a541d5d14", "structural_hash": "1c34573c992370dcd5b1e764bd49a0a749c52b07b2e2fa8091afc2691e0913af", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01950.cpp", "upstream_id": "BenchmarkTest01950", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_AUTHORIZATION\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "749bcc454d7f069d4a76a5e63b14c3223ee35405acc985385b8b45cfaccddb7a", "structural_hash": "db824e31b6802239ab6ca1904a1c85fd7f89eaa151eb4746ff94eb364160b23c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08859.js", "upstream_id": "BenchmarkTest08859", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n if (!authCheck(data, ctx.session.token)) { ctx.status = 401; ctx.body = {error: \"unauthorized\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "251658e0454db6bdeeddf5466576577486c30db0b1f66bb6547036e72dda0568", "structural_hash": "5b687914bca69e6dae24c14fc4fa685cf954321590d493100f6abf6a34fe644b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00642.java", "upstream_id": "BenchmarkTest00642", "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 response.setHeader(\"X-Forwarded-For\", authHeader);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39dbb6095eed95f3321222001f45d7a5ef0750b4b3045973451bb19ada3c845c", "structural_hash": "34400e8ad2482c8b9827cc96c27a90fcbdcf376fcc2079241a7a9f1a4aaf0811", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01824.cpp", "upstream_id": "BenchmarkTest01824", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a8c7feaad54f7d2470f4745c6538273540b3ad128676f9c217c8325ece92f28e", "structural_hash": "c938aa56521343a7fce442db7b48a371f9a682e822551aace1c811e8c80bbbd6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02832.py", "upstream_id": "BenchmarkTest02832", "language": "python", "code": "from flask import Flask, make_response\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n if origin_value:\n data = origin_value\n else:\n data = ''\n resp = make_response(jsonify({'status': 'ok'}))\n resp.set_cookie('session', str(data))\n return resp", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e3e22bdb6cf6e999d0a335a9c9ad518fbd2f2ffd31c497320355bdfced14287d", "structural_hash": "2b974400ef5153a301c51933e0f8add6d6915ed3a9521ab6c7cbe31ae158005a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00996.cpp", "upstream_id": "BenchmarkTest00996", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "666eb392db8a6257d515c333fa393d1faf814b0cf6b6662ab97791226538bc86", "structural_hash": "e2ad9f53701a94f8501dd3d7cf48a4f3c3ae49a398da9f7f28785c5e3b5e78ba", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02843.php", "upstream_id": "BenchmarkTest02843", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $role = (string) $userInput;\n if ($role === 'admin') { return new JsonResponse([\"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "36fbf3c9e38ff1565e433e9a780506216652bf8dd379cd351256af9da800bfb2", "structural_hash": "8edb5ce259bdc8d1420754c5ddd772f47a819c35ffbd9a1331bfa179638c4ae7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33488.sh", "upstream_id": "BenchmarkTest33488", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n _body=$(curl -s \"$data\")\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a2844d5a31ec46028cd5d99f3ea5783411180e7dc4b9b4c078838a80ecda2a5", "structural_hash": "c88c02eee638681f8d1e8a7881ef9e30c8a4eb6bb9c1538e97c87b90bf877fbb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00192.java", "upstream_id": "BenchmarkTest00192", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = \"\" + authHeader;\n java.security.MessageDigest md = java.security.MessageDigest.getInstance(\"SHA-256\");\n byte[] hashed = md.digest(data.getBytes());\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(java.util.Base64.getEncoder().encodeToString(hashed));\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "34b9e39a84aa00e57fed99affb07681d699ad8af922e540ac923a4dbe2e51264", "structural_hash": "63e2012a9c52c1901becba41cb23542f1db258cac896732567e0d79264b83414", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_26345.sh", "upstream_id": "BenchmarkTest26345", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n case \"$data\" in localhost|internal-gateway) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-940"], "category": "unverified_comm_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5556008a0b84f8bf3b47f9983ecfd99e6e4f82ccbf51f27e5849b5781f3398cf", "structural_hash": "d2accbc745700f1b7da8fddc58b0fb55775d83aa9013ea9c101cb6f7d7f88871", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05432.c", "upstream_id": "BenchmarkTest05432", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf4f95fe87b07f3c4b27584c247cf8649f7d64aef62118f172c0ea844cf5d524", "structural_hash": "b9f51787b6513e90ac50d65193d6684aecd9460604d5447df23c7dcd10a62fa1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02657.py", "upstream_id": "BenchmarkTest02657", "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 upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = ' '.join(str(upload_name).split(' '))\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 with open('output.csv', 'a') as fh:\n fh.write(str(processed) + ',data\\n')\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8eeedec56ab97e04c8830cb337f1c7e854c79e983fd875e045581a0626c5fcd7", "structural_hash": "8abcee484ba010da7c8ad41622d3d8eb15e5ec4997506e309761573ff69434a9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09682.c", "upstream_id": "BenchmarkTest09682", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_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 _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c6141596ad87e128c25a071995baa70f51be3b1018be8b74bfab349773ad2313", "structural_hash": "c6cbbbfdf16d3cfc704b1821c0165b1d756be9c9997bf976b000d0b8d2735dd2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00066.java", "upstream_id": "BenchmarkTest00066", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String data = refererValue.replace(\"\\u0000\", \"\");\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c6a8c0b281273f3c1991e1abfecca326a56816ca35bb5cea35ac28e7fe40e2a", "structural_hash": "0da681b6dd22d6b31ddfc06904c5b42c6fb15f99eb35015d06de11beac3cf1c5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19873.sh", "upstream_id": "BenchmarkTest19873", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n data=\"\"\n IFS=\",\" read -ra _tokens <<< \"${user_input}\"\n for token in \"${_tokens[@]}\"; do data=\"$token\"; done\n case $data in asc|desc|name|created) processed=\"$data\";; *) echo \"invalid\"; exit 1;; esac\n input_value=\"$processed\"\n if [[ \"$input_value\" =~ [a-zA-Z0-9_-]+ ]]; then\n printf \"X-Validated: %s\\r\\n\" \"$input_value\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "265f7741bd3ac6a0d90a423d1dc431a39b7175c52c07bd408a89c7c97cada30e", "structural_hash": "0bdab3070aa4848a98e2543beebf80293c5f31f752b2fcad0f1624435b4ba138", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03099.rs", "upstream_id": "BenchmarkTest03099", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let (payload, _origin) = (comment_value.clone(), \"http\");\n let data = payload;\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return (StatusCode::OK, \"\").into_response();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c70cb3e8d49ffdec14a51621f4d896e0513397387914629f870091045306e36", "structural_hash": "5dfd5bf4e5566dedcbd13eb704421e13e0e97fb81159741e2eca4809db5fe8a8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04408.rs", "upstream_id": "BenchmarkTest04408", "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 _prefix: String = referer_value.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => referer_value.to_lowercase(),\n \"f\" => referer_value.to_uppercase(),\n _ => referer_value.trim().to_string(),\n };\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "afe959e938d011ad039af458fd759ed0aadcafcf467ed02971b77ddd39125258", "structural_hash": "1b2f6a99ef257b00bbbab894ec6bc1038ff12d3436fb2f3262159e7b6758278f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04590.py", "upstream_id": "BenchmarkTest04590", "language": "python", "code": "from flask import Flask, make_response\nfrom flask import request, jsonify\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n data = origin_value if origin_value else 'default'\n resp = make_response(jsonify({'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:flask:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "012ab22b0331cc8f063afd71817b9bc2ce945630e092eaa8041af936c16f52a7", "structural_hash": "c6586a3d7b430290d2c5186e299b713a8ce2fb11dfd90cf6b895903007d3b914", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08995.c", "upstream_id": "BenchmarkTest08995", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91f4b7cc303b0e398e6b5f308d426a0cc0dc9911a0db673e1249e7657522153e", "structural_hash": "780ce99a328d6127e174d3a9bf1ab2ed6c14bbfcf8224fc49ec70f7f64c3deab", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12862.sh", "upstream_id": "BenchmarkTest12862", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n case \"$user_input\" in admin|true|authenticated) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-602"], "category": "client_side_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78af22fa21955521a220343e64d30b46e25c0bc7e6df4784f9a9b71f52eccb56", "structural_hash": "f2c98ed76d5886673c1e0a62cb3515c03fe1788f49779b5cb52da8e9e4d762be", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_09953.js", "upstream_id": "BenchmarkTest09953", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.cookies.get(\"session_token\") || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91a12d8da17c6605b88071b55a9440ae90e232da4c2097266158c73fdf780020", "structural_hash": "95cf350d54132fb007827a00e9e3f3f06feb3fa96138d4462fb9b0f277c59fe0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07839.c", "upstream_id": "BenchmarkTest07839", "language": "c", "code": "#define _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 FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", user_input); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "559847d494454fd093994363c9d676bcec15a0257dc21aace309ed7705635da9", "structural_hash": "3b0c7e9d6901f71c9c981711f41064013eaca44548f0818428ba996cf539b30d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01999.php", "upstream_id": "BenchmarkTest01999", "language": "php", "code": "headers->get('Authorization', '');\n $field = 'data';\n $$field = $userInput;\n $valid = is_string($data) && strlen((string)$data) < 4096;\n if (!$valid) { error_log('schema validation failed'); }\n $processed = $data;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $processed, $allowedActions, true)) { return new JsonResponse([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c60baf0b4cb9cd2a98fe0fbda4bc1b56cf4331ac7b6eebd1d8948eebf69b0ed", "structural_hash": "9ca9a047c82c8c95fe49a4d8deece4cfdbadc25d27a0f97c76f9a5228e8f5e94", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16117.c", "upstream_id": "BenchmarkTest16117", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5246e532fbd0f2b0afa775f5f1521ff15d64cec29456c37854a88c59c4609780", "structural_hash": "f5fd0e153303c076d5b8d44c379194b11c98bfb34302b1b945f2f261c182b6f4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_33286.sh", "upstream_id": "BenchmarkTest33286", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _captured=\"${user_input}\"\n make_reader() { printf \"%s\\n\" \"$_captured\"; }\n data=$(make_reader)\n _claimed_role=\"${data##*:}\"\n if [ \"$_claimed_role\" = \"admin\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-302"], "category": "auth_bypass_immutable", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79529a5667447d03851d6eb283d37e28181dfbedf41f810e0b6191d334edda2d", "structural_hash": "8e6188252dab2616217f2c9ad21a14605a41b3b99ea8e41654aedb2a6cc42bcf", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_02985.go", "upstream_id": "BenchmarkTest02985", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tholder := InputCarrier{UserInput: authHeader}\n\tdata := holder.UserInput\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\t\tif xmlErr != nil {\n\t\t\thttp.Error(w, xmlErr.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+data+\"']\")\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cb7186144d6bfc94bff814151c3674016c674b0ca89e5dfdbb746caef099e64", "structural_hash": "f76d7ff96c27a2e73ed0b29454eacefde95b9874a11d1070735be832b071487e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03873.ts", "upstream_id": "BenchmarkTest03873", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"host\") host: string): Promise {\n const userInput = host || \"\";\n const data = \"\" + userInput;\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b281265c3fa4e59b34c67bac19761ca7ef0b42bd7da605497f883cad031fa44", "structural_hash": "2c2db436fda9b269a52ec7111ea3dc1d3de4373d914977aba9cf163f80ddc49e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02216.rb", "upstream_id": "BenchmarkTest02216", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_FORWARDED_FOR\"].to_s\n data = format('%s', user_input)\n if %w[read write admin].include?(data.to_s)\n halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1142ab24a2a92cda1fe056c444b66ccb15a5efc2a082dda3f8d6abf23dfd1b1d", "structural_hash": "275cfea6698ff690b4c3796065ccf90f05633550e1035741ab66e71a464ddcb8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02455.php", "upstream_id": "BenchmarkTest02455", "language": "php", "code": "headers->get('User-Agent', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n if (!hash_equals((string)($request->getSession()->get('user', '')), (string)($data))) { throw new HttpException(403, 'forbidden'); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "653f8e0ecd1cc592372437b7477830c7c5d9c0a6fd59972fede636fdc11ddc41", "structural_hash": "2237dd236ee065232de121a784b0cf49d86139dbc90f7f69f2d6f6bd3b5dba98", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20415.go", "upstream_id": "BenchmarkTest20415", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(fieldValue)\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "30a0b291938b095792c9916d9dc0a47781232000d9be47bd8ac1cba4a0d4e145", "structural_hash": "79d75bce20490afc8d6d34e12089f052b967d1a9b9ca7b2aefb434c5c5bc47d8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01078.rs", "upstream_id": "BenchmarkTest01078", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = graphql_var.split_whitespace().collect::>().join(\" \");\n crate::shared::set_cookie(&format!(\"session={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f957eb4a921675615bcd205465f748c6df9d7ceb44fe939c55c55ad6c50f2db0", "structural_hash": "694ab22fdc6848b82d02b39b056bcc647533236b81121cc0434431251629ef61", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00109.cpp", "upstream_id": "BenchmarkTest00109", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c6bfdff4c41593c380c7bfaca53229d21f6af4aea7325adf05f52ae8bd1e551", "structural_hash": "deaad565ed254ac611dc1fa126ec93fbeee1046e59568fd89c97177511d3832a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01760.rb", "upstream_id": "BenchmarkTest01760", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_REFERER\"].to_s\n data = user_input.split.join(\" \")\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ee5887cf621270d17e03b5625acf3226a9ca34643850426ee1b84bde68ea30d6", "structural_hash": "5df623c5db0af5a56788d518e154d944c840bf740b20e0d934f96b3c5be74db2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01185.rs", "upstream_id": "BenchmarkTest01185", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in origin_value.split(',') { data = token.to_string(); }\n crate::shared::set_cookie(&format!(\"session={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acc4c6da370e9a28e2496a5beb05da8fcd17eb5db66704ee7ac63ccc9fdbc9d0", "structural_hash": "3943b655bada8f8507d7cf6a6bf97c76f7705aa3888a61c507430745b02bac33", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02472.py", "upstream_id": "BenchmarkTest02472", "language": "python", "code": "from django.http import JsonResponse\nimport re\nfrom urllib.parse import unquote\nfrom app_runtime import mongo_db\ndef benchmark_case(request):\n field_value = request.POST.get('field', '')\n data = unquote(field_value)\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n mongo_db.users.find({'$where': \"this.username == '\" + str(processed) + \"'\"})\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3762d21f6ff289242e2aa092b31715ad97f9bfdd0a921e36aced9ef0096b5c4d", "structural_hash": "2b3b4c52ecda389d1c0f0ff1818ff78c1c405406ef93ff430f917565cbc79074", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10586.sh", "upstream_id": "BenchmarkTest10586", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_FORWARDED_FOR\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1125"], "category": "excessive_attack_surface", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "11fe977e0c87b72487512c33669f7e7506fc6bc80f98f5d67698d73f7e54c7b0", "structural_hash": "cdc104c62146b01ca731b7f216468427f847bb8c951cb6d3ef74d967fc337e16", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02028.cpp", "upstream_id": "BenchmarkTest02028", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REDIS_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _hurl = user_input;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6783e5c3551a0df9c01af452740670720498fdfeadd24be02261bc710ef2b1c1", "structural_hash": "21a55825c52fae904301b97c31a7901d777fb0b8f57c2e0da4c2a7832f7e2e53", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19252.c", "upstream_id": "BenchmarkTest19252", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\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 pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cfc6b10b63dfc0379873e9012d24e794755d02ca041a25527b81d84f73fd8f8b", "structural_hash": "e2a297ced92b949949489f9df67af3d25639f560980ab7adbf3d866ee7c7d269", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03170.php", "upstream_id": "BenchmarkTest03170", "language": "php", "code": "json('payload', '');\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n return response('' . (string)$data . '')->header('Content-Type', 'text/html')->header('X-Frame-Options', 'DENY')->header('Content-Security-Policy', \"frame-ancestors 'none'\");\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c4e450d996d215b1eda61d06a8c9a868e667b344af2615d605ee7dd772e84ff2", "structural_hash": "e8b7555850c4b5f2ae1ff7a096ac25cfb12f8fdf56aa7cf9bc0efcfc3841e1d6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01286.rb", "upstream_id": "BenchmarkTest01286", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n $request_state = { last_input: user_input }\n data = $request_state[:last_input]\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "56ff41170ebd407ccc3f9b70ecf83f8655507596d330794e6d3cfbb7fa0d0d19", "structural_hash": "a0645d58ab93350e9a9f41b1d7dfd2fec2f55f931e0579d45205559c1d3e0570", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02069.cpp", "upstream_id": "BenchmarkTest02069", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ac4fbec3a0f2c61bdaefdae1cd1f3973f3848778752628017d11feb5c2a725f", "structural_hash": "6b1150a2f9ae654c716b6d3172a2a59a9a6b2dea522f9ed79a23069df884596b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00706.php", "upstream_id": "BenchmarkTest00706", "language": "php", "code": "request->get('field', '');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $hashed = password_hash((string)$data, PASSWORD_BCRYPT);\n file_put_contents('/var/data/output', $hashed);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "848b3259e599c3690bb5733a2e73ac6678abed81c57c6bc96d5aa742200ca81d", "structural_hash": "fa29712f451105415b199427f1fc0b01cced11ef296a74c884f2800b4c5b7af4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01955.py", "upstream_id": "BenchmarkTest01955", "language": "python", "code": "from django.http import HttpResponse\ndef benchmark_case(request):\n referer_value = request.META.get('HTTP_REFERER', '')\n parts = []\n for token in str(referer_value).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n with open('/var/app/data/' + str(data), 'r') as fh:\n content = fh.read()\n return HttpResponse(content)", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "82a306af999350f22127647152ef28d322bb213c4e6ae03ca0e0354b2fa93bfd", "structural_hash": "9d558de716eef07cc5d01c41fa566c2e2daf95c7f36f2379b7d0945ec3cfa20f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07981.c", "upstream_id": "BenchmarkTest07981", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79125ddaaf03b8e8b6a171fbd44a697c74bf03bc1116684154bad7fe1b2dc4d2", "structural_hash": "4ed6021e1fb87d1ccff1d07e9ae38921bff71d5b0d01b274635d73a9b6ba82a1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_00173.go", "upstream_id": "BenchmarkTest00173", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tauthHeader := r.Header.Get(\"Authorization\")\n\tdata := strings.Join(strings.Fields(authHeader), \" \")\n\tif !validInputPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\ttrustedClaim := processed\n\tw.Header().Set(\"X-Claim-Trusted\", trustedClaim)\n}", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "58ccacd7853913121c114147fed2fc35a804c1fc6de22d1fcc9e79c3df8fd2cf", "structural_hash": "117222345aa85236b9b147c9041cabc087dfc333ed631718560c7688966443f4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00970.php", "upstream_id": "BenchmarkTest00970", "language": "php", "code": "cookies->get('session_token', '');\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 $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return new JsonResponse(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25a5605b1407819379001e106417116c5040cdd62a2f1a1af0f2d75fc8e9dca4", "structural_hash": "57afc897df87cc0ae08d07336b8efe66cc0e9788c0abdf7862fab7c1d6e5208e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22765.js", "upstream_id": "BenchmarkTest22765", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const data = decodeURIComponent(userInput);\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) { res.status(500).json({error: \"privilege drop failed\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "413e5da1032e90aff2c765183eb95cabd3606242af4adf7e0866065aae290c9d", "structural_hash": "b3192dcd341dcdaf388481cc5ff466aecbb58c4023e6730e0be4bef6b2acd3d1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00020.rb", "upstream_id": "BenchmarkTest00020", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n begin\n data = JSON.parse(user_input)['value'] || user_input\n rescue JSON::ParserError\n data = user_input\n end\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48ab5b9fb85041d770fb70359ee24e72c00222c5182b5cfdd93f2d08a3d5cbd3", "structural_hash": "f541744d6f8d9e56f9f05ae9ae41b69c227a216582feca9a4c7cb738038673f6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02030.ts", "upstream_id": "BenchmarkTest02030", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const data: string = shared.passthrough(userInput);\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f509ee17f69b156e4cbde3026da7e31c9eb342a7e1a4fae25d857c9e49f4bd3d", "structural_hash": "02bb6c6a2a2da89ad19921600cabf210a2e6e66f3939c1df0c43ab2cbd35529d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_24239.sh", "upstream_id": "BenchmarkTest24239", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n printf -v data \"%s\" \"${user_input}\"\n trap 'echo \"error at line $LINENO\" >&2; exit 1' ERR\n echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e2dea169579e0e421aaaad1242fb04b189e4785c0a99d5d5f4f8dac4c33c8e7", "structural_hash": "95bf063fbef13e71d13558615d2cb28ca41d0a5a61bb83a0b6ec7a113e8dec3f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01504.ts", "upstream_id": "BenchmarkTest01504", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3782632c0e74614cc5f3aa107f8742416e6dc02606c5131b897d7d3cc7a23d51", "structural_hash": "2d6d83b85159f537fd3899ace07d7f6c580148f7c1a728c2721fef76ccc3e76a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_06348.sh", "upstream_id": "BenchmarkTest06348", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [ -z \"$AUTH_TOKEN\" ]; then echo \"unauthorized\" >&2; exit 1; fi\n if ! awk -F: -v u=\"$data\" '$1==u{found=1} END{exit !found}' /etc/app/users.db; then\n echo \"401 unauthorized\" >&2\n exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-521"], "category": "weak_password_req", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db4476e6b4c3e2c82713ca6b9330559a0dc03ae984e86f93ffdeee49e6094921", "structural_hash": "686c4e8e5f76298e4d9e50fb43954671cd7ac51e4d07b2c16039b132cf39d87f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04406.rb", "upstream_id": "BenchmarkTest04406", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.host.to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n cookies[:session] = data\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fc5bc6f46dccc5546806e7f7a306e9b4c91f9c7e479405968d7969a2a717dbf", "structural_hash": "a21638797e069d275e9a30b8a50480cbe0694193a34be9ce69d9e09286c6c5b7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02207.rb", "upstream_id": "BenchmarkTest02207", "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 = JSON.parse(user_input)[\"value\"] rescue \"\"\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96021652f99d75b42908434a821af1a571c9acd966d6e225ede5c9a78c86c51e", "structural_hash": "791bd8864e6c551c0a35a42fdc98c09f2282f6c73b0dcf99c6d67443afb845c7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01681.cpp", "upstream_id": "BenchmarkTest01681", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"DB_ROW_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n if (!std::getenv(\"APP_ENV\") || std::string(std::getenv(\"APP_ENV\")) != \"test\") {\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c954e4fc6fa35641311aec89fbc11bfe1a6b67ee58a4833b8eea107e80b9fd0e", "structural_hash": "bbc88a4c1dd4d8f4d1f60f75d9a23746c0160abc84ac9084f6428a807a2ca9ad", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05823.c", "upstream_id": "BenchmarkTest05823", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "589dd6e14dc105731f8bf70a9e065d571eb559eb5739be682bfbfba195136075", "structural_hash": "483c4938ca37c79a228d9585ab90140693c9c29caa4fdd1d9b1dc3f14e2ec83c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_03196.go", "upstream_id": "BenchmarkTest03196", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := func(v string) string { return strings.TrimSpace(v) }(rawBody)\n\tvar result *string\n\trow := DB.QueryRow(\"SELECT name FROM users WHERE id = $1\", data)\n\tvar name string\n\tif scanErr := row.Scan(&name); scanErr == nil {\n\t\tresult = &name\n\t}\n\tif result == nil {\n\t\thttp.Error(w, \"not found\", 404)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"name\": *result})\n}", "label": 0, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aded34bf72ec20542580641ff1a0d78dedb38a103e61e7295945672699107887", "structural_hash": "ee241afd3aaece9764097d398e74a0a91eba7485c838a99d2e90491411b79558", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15362.sh", "upstream_id": "BenchmarkTest15362", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n case \"$data\" in admin|true|authenticated) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-602"], "category": "client_side_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "51df16b1622d546bf567ec243820936019667c0f06d277e9bcc50285e0ac32ad", "structural_hash": "580701e57a3d96baa563f3a576d934968c5179ffcd827899ab7fad83829a8095", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05997.java", "upstream_id": "BenchmarkTest05997", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(dotenvValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "244d6ce6830f6a69f034cbc96be18b3ee269bb5ab4a943de6a3e4ec74685e104", "structural_hash": "ee9afec5286e6e834dd1b20acc7c53ac5251dccaa7643f69be35d4b669e85a0f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04308.ts", "upstream_id": "BenchmarkTest04308", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(userInput).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "128fd50fb4390a239f03df9085c818afd23b6fe24634f18ad7177eb3b3f27168", "structural_hash": "6cc5f27fb2fb99308ea776c881f633add422dcfb34e1e92ac28a3a30e0c53351", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04505.rs", "upstream_id": "BenchmarkTest04505", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(json_value.clone());\n crate::shared::set_cookie(&format!(\"session={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bc054a259c47b5e4c43b76b46d91d4d9181ff9f03f5937244a67fc26ac41ff6", "structural_hash": "8216410dfa9fe3ee3dc689e2648b70abfbeeebc22009ac0ff5685ba112e7a048", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02579.rs", "upstream_id": "BenchmarkTest02579", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let data = upload_name.split_whitespace().collect::>().join(\" \");\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return (StatusCode::OK, \"\").into_response();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "02d452e9572dcb10d11817e408ab88e80ac1467fb8e8b3cf6e71e0821e46a5c5", "structural_hash": "65c4d2fb18d24eeb63264010ddaf91deaa1ec8c601393caa1a05c3e4a73f06fa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05066.php", "upstream_id": "BenchmarkTest05066", "language": "php", "code": "headers->get('Authorization', '');\n $data = sprintf('%s', $userInput);\n file_put_contents('/var/data/output', (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2ac36387b0f99d410fd9b7f7d43fc0431448bf8033a77cdbe3cff0bc88db58c", "structural_hash": "01e5e1b77d856f4c89d4dacae9488b41a1c32212996dbdb8a91221bcbb42f507", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_01276.js", "upstream_id": "BenchmarkTest01276", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = ctx.request.rawBody || \"\";\n class RequestPayload { constructor(value) { this.value = value; } }\n const data = new RequestPayload(userInput).value;\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-620"], "category": "unverified_pw_change", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a129c3f971c0561df1c185cd49d58183fa0283db961deff74f0035a4e8eab892", "structural_hash": "5bbcb7b91c2edb215be61b54da856f22098e16b54796ed200de584844eaff2a7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01871.ts", "upstream_id": "BenchmarkTest01871", "language": "typescript", "code": "import { Body, Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Body(\"field\") field: string): Promise {\n const userInput = field || \"\";\n const data = userInput != null ? userInput : '';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21c213824eb9bff8267d779d0ea4881c04adaaf2390450779620aabd103bd875", "structural_hash": "40df07fb531ae2ff3b5753d05c94adaae8b35f47b59f44bbd1bb2025e3d9d6c1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_35558.js", "upstream_id": "BenchmarkTest35558", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n let data;\n const onInput = (v) => { data = v; };\n onInput(userInput);\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-215"], "category": "debug_info_leak", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c84356c685fa4040cb894dd98dcee7ff97c750f5a5fc8a81d61287b539a107c", "structural_hash": "c81fd2b67f043047192de9cca7791cdcb174c4247980e795645c74145f538779", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03888.php", "upstream_id": "BenchmarkTest03888", "language": "php", "code": "file('upload')?->getClientOriginalName() ?? '');\n $data = sprintf('%s', $userInput);\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$data));\n logger()->info('Action: ' . $processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "870f6709841a5ebe4f291218e6fa16ae285313c5332b9beb50b28a4631307d05", "structural_hash": "5d28e8c08512b93438624cbee7daa2192ee1f9995fcbece71f9292abacde28de", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04404.ts", "upstream_id": "BenchmarkTest04404", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f2bc819610cadf934733fca05ba550ec49456da50356a08fddbd50904e335e8", "structural_hash": "bbf3807a12ce33383d831e823dfd98dff8c10531a431cbe6c74ce312c28a87cf", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02621.ts", "upstream_id": "BenchmarkTest02621", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"referer\") referer: string): Promise {\n const userInput = referer || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0590862f779839c5c7ac944b953649e650dd80561b8ef978d624abdde6c92884", "structural_hash": "c4859953be594a4792e5533e059ea0a392d85de7a70571c3e13a5b99ca24b5ac", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14070.c", "upstream_id": "BenchmarkTest14070", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3af426422c6433b3810633360bd3cdbf7b431852787c330edb1fffbe6912413", "structural_hash": "189ee7593348298a2c795b411f11d78ab9d56b39e1366608ea5490fb9ff9c920", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00973.java", "upstream_id": "BenchmarkTest00973", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n String data = normalize(fieldValue);\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8288445933ea365b1d6803be47744af84c35acc43260b7cd5fe5ef894bb5e9b9", "structural_hash": "62e4b0243caff6d4ae944628eb564cff46de8d0e2131b7c22f584a4470cf889e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03629.php", "upstream_id": "BenchmarkTest03629", "language": "php", "code": "headers->get('X-Forwarded-For', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n $_match = hash_equals((string)(getenv('APP_CREDENTIAL')), (string)((string)$data));\n return new JsonResponse(['auth' => $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9341d12fdfdf7ea4cadab9e53f32e12f3ec8b7884a96b02c8271d607855d8b1c", "structural_hash": "fdf478516338030be0a50c27cdd62561da8764b4b846963d8822e8ef25af5200", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11804.sh", "upstream_id": "BenchmarkTest11804", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n printf -v data \"%s\" \"${user_input}\"\n if [[ \"$data\" =~ ^(read|write|admin)$ ]]; then\n echo \"granted: $data\" >> /var/log/auth.audit\n exit 0\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-266"], "category": "incorrect_privilege_assign", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8be52e3e03b6031a0099500804281ca83f01a89f7bf400818fe57950cb24100e", "structural_hash": "b7511aeb5040015d7db03205928ac65a8a759edcae72a6017ad235d31c0205d3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01341.rb", "upstream_id": "BenchmarkTest01341", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.user_agent.to_s\n data = user_input ? user_input : ''\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45c462c251fafa7104c1c7efa5b2b5cd280686a7e2eaab8a22350ffdd5ed2932", "structural_hash": "d7b316fcc11afb40fe33ee42dff592a02a66b637c46c353d8fa61eb4a979c575", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06184.ts", "upstream_id": "BenchmarkTest06184", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n function normalize(value: string): string { return value; }\n const data: string = normalize(userInput);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "863de6ba6fab4872e23c06d0673d1055e771753b2bb8de613a50e4eb0b2f4416", "structural_hash": "da79c53b5fd9a7b05a80e6a9913a67247d562c3526b0616ab79fcd9946eb8445", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00312.cpp", "upstream_id": "BenchmarkTest00312", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _raw = user_input;\n auto _closure = [&_raw]() { std::string r; r.append(_raw); return r; };\n std::string data = _closure();\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "78e0158a90c018c7d77641ba5127805d99b4fc2520b826aa1147ebe76795008c", "structural_hash": "b1b86ec4bf3cfc95b51a4a1e880f919827b33da4c55c55e65e5724f06684c53f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_04617.py", "upstream_id": "BenchmarkTest04617", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\napp = FastAPI()\n@app.post(\"/benchmark_case/{id}\")\nasync def benchmark_case(request: Request, id: str):\n path_value = id\n buffer = bytearray(int(path_value) if str(path_value).isdigit() else 0)\n return JSONResponse({'allocated': len(buffer)}, status_code=200)", "label": 1, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f28e167e67f4d4f42223c3ac80a004934fbf56f54ac0f82f74783a224eaccd2", "structural_hash": "16bf91c6233e90972d15184fc2521088788da4d7192eb275dcb7f902029c9355", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04965.java", "upstream_id": "BenchmarkTest04965", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Host\") String host, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String hostValue = host != null ? host : \"\";\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(hostValue);\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2806dc93eecb282efe4e646c28707c056cccb69d143f79f2b0231bb5a49d0288", "structural_hash": "b4742f93d1276850ea93579f570c57c0b09705d4c218efa84fb4eb37f4360588", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_01085.rb", "upstream_id": "BenchmarkTest01085", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = !user_input.empty? ? user_input : ''\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86cbc136dc59312de4f943381c590ca8f9c2fe664f6bdee697f9a4a9693e3531", "structural_hash": "607b2a42f40c0805a81dac05fed76b4a93012b9d4a83409d4c92721dcc8ec6ee", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00559.py", "upstream_id": "BenchmarkTest00559", "language": "python", "code": "import hashlib\nfrom flask import Flask, request, jsonify\nimport os\nclass RequestContext:\n def __init__(self, payload, source='http'):\n self.payload = payload\n self.source = source\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n ua_value = request.headers.get('User-Agent', '')\n ctx = RequestContext(ua_value, source='form')\n data = ctx.payload\n digest = hashlib.pbkdf2_hmac('sha256', str(data).encode(), os.urandom(16), 100000).hex()\n return jsonify({'digest': str(digest)}), 200", "label": 0, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a4d7044bf3814687b1800622a27e64de8e56d4400036a65638501e5606e89fcc", "structural_hash": "15738801d4f7778b30d122b1cbfdb3379434d5fb09eca2cccd3b77479e5936c0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01394.sh", "upstream_id": "BenchmarkTest01394", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n trap 'echo \"error at line $LINENO\" >&2; exit 1' ERR\n echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1c6e4843a3f350153e33f365b1aec605c3fd9a4c47e9bb3ab7b285240d5a3a43", "structural_hash": "752eac960f71b37b4b5720369ed37566dfcc01af3a86129d977996be418fa950", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_31843.sh", "upstream_id": "BenchmarkTest31843", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n printf \"%s\" \"$data\" | openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:oaep -pubin -inkey /etc/app/rsa_pub.pem -out /dev/null 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8ce3c6d63882c879321cbedda6fc417113f3214a427c437d2594700517304e1d", "structural_hash": "15ab02c044cea542fdda69dd76eb1f9410f5fcbc7ab01e43c559f7545a90daa9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09248.sh", "upstream_id": "BenchmarkTest09248", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n if grep -qxF -- \"$data\" /var/app/known_tokens; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-290"], "category": "auth_bypass_spoofing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b0f0dcc1240d5f103423b36734fdcd495ad10c0a9c028801f50e4d6a603f6026", "structural_hash": "9e14e3104ca8225bbad00a55c28d7be5a978cf513a8e4ab8668c8dcb932d8a15", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05251.rb", "upstream_id": "BenchmarkTest05251", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.query_parameters[:q].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eadd231f3c48b3f8fcb74a15b1ff7c14d59c0bafc6380ac27cbf03e7bcfdb661", "structural_hash": "99049a3605dcae9aa9178bb8b0f9815973188813e8a863a3770983cdf2d53f5b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03459.rs", "upstream_id": "BenchmarkTest03459", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if forwarded_ip.len() <= 4096 { forwarded_ip.clone() } else { forwarded_ip.chars().take(4096).collect() };\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c484b1d4402811a6f88f090722d57f871343c80df032f0dab8bc123d95edf3f", "structural_hash": "7ff728efa13538a56eba53c7c33e7ef407a917b5ca56e3f5b1f1b915999524c0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26083.js", "upstream_id": "BenchmarkTest26083", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.field) || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = row.name;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a03cf47b94ae95be92b79cfd4efe68f1e1b27cb506ef3a13b8387eace0d911e", "structural_hash": "5c54513a707feec1c163ab3cf09fbf1da91fffc986bce5e2b2c4448bfc6241f2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03241.ts", "upstream_id": "BenchmarkTest03241", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const _obj: Record = { payload: userInput };\n const data: string = _obj['payload'];\n const processed: string = data.length > 64 ? data.slice(0, 64) : data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4845fb9e37f06f3835da21cc16e2e4eae49613ffd3e39f7644d2706a36b5146d", "structural_hash": "b27d6a0bba9007ecfa5a6396df9d3a53f494fa8cd24ede5fc75d5842dacd33e5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03129.php", "upstream_id": "BenchmarkTest03129", "language": "php", "code": "getContent();\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 logger()->info('Action: ' . $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e91e6905fb05bbd8e969cdfde01706e12fc5bf956d0c8fab723af69fdc7712fe", "structural_hash": "387df5a8760991f30d08e38a1ccebf012101baabcca84525a110b9c076595a5c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_01925.php", "upstream_id": "BenchmarkTest01925", "language": "php", "code": "header('Referer', '');\n $pending = explode(',', $userInput);\n $data = '';\n while (count($pending)) { $data = array_shift($pending); }\n return response('' . (string)$data . '')->header('Content-Type', 'text/html')->header('X-Frame-Options', 'DENY')->header('Content-Security-Policy', \"frame-ancestors 'none'\");\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "178f010d9428197c8771a287ba8dc7c17543937b57ea6e6ea538935826b0851a", "structural_hash": "3536e6798fe9b51ad332738533df0ff3b3942dc126408965739252fce77d476c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05200.php", "upstream_id": "BenchmarkTest05200", "language": "php", "code": " (string)$userInput]);\n file_get_contents('https://api.corp.lan/submit?d=' . urlencode((string)$data));\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5db2630a44e8981b90c8c80d6f30e52f046f6bdfc2d34e18a0039797e147055c", "structural_hash": "5725e9113eb827f69ccac3347f01b097a43b375876f42a734ad1e15d1ac77249", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02733.php", "upstream_id": "BenchmarkTest02733", "language": "php", "code": " $_match ? 'ok' : 'denied'], 200);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "933d3cd54dfdac63a1bf2113e91f3fb11c8c440cb8656c2e72555c8114601044", "structural_hash": "c11c0863c612f992fdccc7c175812f924efe50c44fb5c826abfaefc2cb403a66", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04574.rb", "upstream_id": "BenchmarkTest04574", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n unless session[:csrf_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:csrf_token].to_s)\n render json: { error: \"csrf mismatch\" }, status: 403\n return\n end\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n end\nend", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b5e05b9978cddd71e0b4f29344ff843c78be969aa0f578b0cf2fdd11d0931dd", "structural_hash": "9d266b059e435b72b3f689d6fb0665053e670906dd8c87ccb8f770aa89d06f66", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_28015.js", "upstream_id": "BenchmarkTest28015", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n const data = await Promise.resolve(userInput);\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-550"], "category": "server_error_info", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c970a871cd4af03116da69f2146b4b3e60263f7b0b09b0a2200eff285205a453", "structural_hash": "d5330b184de3858425cb43975b902cbee3efc258ce48f24d2f5963dd251df723", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04092.cpp", "upstream_id": "BenchmarkTest04092", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_relay(const std::string &s) { std::string r; r.reserve(s.size()); r.insert(r.end(), s.begin(), s.end()); return r; }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::function _cb = cpp_relay;\n std::string data = _cb(user_input);\n std::string _truncated = data.substr(0, 64);\n std::string _hurl = _truncated;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "716b218a83d55728fa6c47ddd42ef2531919de6e262a50e9446abb6adee738ec", "structural_hash": "60eb5e3de39ade46e67f755808a12c9c65759070d6c5c30963bb941ae8e33772", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03160.rs", "upstream_id": "BenchmarkTest03160", "language": "rust", "code": "use actix_web::{HttpResponse, web};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Form(form): web::Form>) -> HttpResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let mut data = String::new();\n data.push_str(&field_value);\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0af744f6ee6082efe0a2be009cc454f5553f63207231830ba1fe65180ce7340f", "structural_hash": "af6ed72f5cc1641e35b5a1f8f5fd1b9ab2b46bc34064d94cad43885167a89493", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05626.py", "upstream_id": "BenchmarkTest05626", "language": "python", "code": "from django.http import JsonResponse\nfrom dataclasses import dataclass\nimport requests\n@dataclass\nclass FormData:\n payload: str\n content_type: str = 'text/plain'\ndef benchmark_case(request, path_param):\n path_value = path_param\n form = FormData(payload=path_value)\n data = form.payload\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9df33448b10f29a31d76d23e74bbef622d2cd32728dda78f02e57089bbc03410", "structural_hash": "c5165ea3944a3572924e29d6dbd0277a5ff5bf0c3c51c0f84a82495bcb60acf9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21414.c", "upstream_id": "BenchmarkTest21414", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *data = c_passthrough(user_input);\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7c082b36fea046f8a27c4430b5561ca3328fbbc761618a833e5e532180001677", "structural_hash": "07ae13da03b16b3640ca6a0d4ad9b9efe613eb7374993014dad55cba4f8fdaea", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00391.ts", "upstream_id": "BenchmarkTest00391", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n await new Promise((resolve) => {\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n resolve();\n });\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db395950f876ea042c812046032f7338be992d5a3af06bf2ba58a507d139d3b1", "structural_hash": "d442d23ea0e0c196f627d348f5f899775ef885729d775dc337b2debeeab55ddd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00628.java", "upstream_id": "BenchmarkTest00628", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Referer\") String referer, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String refererValue = referer != null ? referer : \"\";\n String prefix = refererValue.length() > 0 ? refererValue.substring(0, 1).toLowerCase() : \"\";\n String data;\n switch (prefix) {\n case \"h\": data = refererValue.toLowerCase(); break;\n case \"f\": data = refererValue.toUpperCase(); break;\n default: data = refererValue.strip(); break;\n }\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0690154b9fb36816563f4e636061fa6f73ed0c0dfa861d3508dd03257a114376", "structural_hash": "7553c1931485341c6a1051349c221caeaa9b7b284cfaea5035e4a235d992e0d3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02982.ts", "upstream_id": "BenchmarkTest02982", "language": "typescript", "code": "import { Controller, Post, Query, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "690c92c79f2a89e7bf3fba44604631ca6dc15120e8ad33370530d8b4cb68fb8e", "structural_hash": "c6e1b9239c04a870d65803b0c62e96f2231f6e20081a4e2873a81811a021cc30", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00895.rb", "upstream_id": "BenchmarkTest00895", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8b09d5556dc84167cf4383a91098150b9f0df5626091ca6fcedc28b694ed7c83", "structural_hash": "1057eb119d585e44c86b1b0f395f1284c23c15469eb4cb8bd36fb13e6aba0288", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02999.java", "upstream_id": "BenchmarkTest02999", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String squeezeSpaces(String v) { return v.replaceAll(\" {2,}\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = squeezeSpaces(cookieValue);\n if (data.isEmpty()) { response.sendError(400, \"request required\"); return; }\n String envSecret = System.getenv(\"APP_SECRET\");\n if (envSecret == null) throw new IllegalStateException(\"APP_SECRET unset\");\n String storeCred = envSecret;\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", storeCred)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a73197beee2043f1e3b8abd25d53811e5c485fb3681fba0aa20817cf52b653d", "structural_hash": "1418bb52e8e2fbf24d6d6acac3dbf5e1ec2e7421a3401a9ce329b1cc4f24116a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19533.c", "upstream_id": "BenchmarkTest19533", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_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 _shared = user_input;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e19005bbd5ec1a379bff89e39592df3d27932e6405e5c7db1f11cba9909233d", "structural_hash": "138a6981aef0ffd44bd76d7a9e497dea02d01fad757dcb643de83bea9a5dfa6a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02609.ts", "upstream_id": "BenchmarkTest02609", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 transform = (v: string): string => v;\n const data: string = transform(userInput);\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4895a8eee39b4f271e1283b2bce03a09a205a9ccffabfe8582d33c8b570b55c9", "structural_hash": "d6f5fe98a6f92aebcf61d3e3b429e95d4f0e0a6d12363658c87837d0d69920ba", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00382.c", "upstream_id": "BenchmarkTest00382", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f26ea2f5253e4ce2b2227611d8472f756c2a7e3e89d207310bcdb425227f7c00", "structural_hash": "2c15a21ecc0af2f4101247d57ed561d844945f122b6727c4b6fc4b20531aac7f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02926.cpp", "upstream_id": "BenchmarkTest02926", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n std::string::size_type _w = 0;\n while (_w < user_input.size()) { data.push_back(user_input[_w]); ++_w; }\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00a4f14c96fdba622dbe3e96f7ca122b1bac96b09043aadc5154cc8108cbf895", "structural_hash": "a1907af26c8968839b6aa7f447d428c97f83ac009f7e52d2e0e7c67d6ce9a285", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_34621.js", "upstream_id": "BenchmarkTest34621", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers[\"user-agent\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n res.status(500).json({ error: \"Internal error\" }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e734d1373829fa93de46adba6d41bbde8e736989e125bbf9e4f6049652222ff", "structural_hash": "afff721f847b03d989dd6d506ca24408c0857427593affb8ea2a29c07da9223d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00608.cpp", "upstream_id": "BenchmarkTest00608", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MQ_PAYLOAD\");\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 _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "55027f5c61010eea5fe303abcb6a04a7a01f5937b3a2095bdc2ffda004310d22", "structural_hash": "076be47d73bb1e1932172facbfeb2903b7f3ad87087be44b868d9d40ccc4a1a7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03631.java", "upstream_id": "BenchmarkTest03631", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{envValue});\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f0bbcc47fdc3d1f38778b08b13c2d1512fe43efdfd1378cda3c93bb6c9561992", "structural_hash": "cb985fdc01a2e191d3e00297634300694726fad4390247615db5b67b14245fbb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_01152.py", "upstream_id": "BenchmarkTest01152", "language": "python", "code": "from fastapi import FastAPI, Request\nimport subprocess\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n parts = []\n for token in str(upload_name).split(','):\n parts.append(token.strip())\n data = ','.join(parts)\n subprocess.run('echo ' + str(data), shell=True)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bbe77629f13af43455ec98d20cf1b9a354a26a16131e0debcd1292a83e2338e", "structural_hash": "8beb2fd0b8bf2432bdb34bcc28e38570eabec7441adba2d93e9c05dafe1aa735", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00187.rb", "upstream_id": "BenchmarkTest00187", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n data = String(user_input).strip\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62e81d1cebc76dcf5929106332fa43649ba0731271c26eae9ae72f00055a4b79", "structural_hash": "3579c8a17cd0388fb121c9c6b85ccaf9a639cb6a34a1398c9597011c22e694a3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04828.ts", "upstream_id": "BenchmarkTest04828", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf4ee331eed72f2a40045f77ee6cae978c3dbe84af79cbb295e41afe54e3ebb8", "structural_hash": "3dce591c385e24b7b28404181a6728ce0cf8073d78ea30634f8f700114ad969a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03263.rs", "upstream_id": "BenchmarkTest03263", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let captured = host_value.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9226922fadaf1744544a0052ae0e327b16008fd732afaa40b6c4f29e1f05b56a", "structural_hash": "d1043f414b5345aa14b8808ca08120e70ceef75544db8f4d18447cd5db58d9a9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03852.java", "upstream_id": "BenchmarkTest03852", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = String.join(\" \", cookieValue.split(\"[ \\\\t]+\"));\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d141a0ba28c2a6264e8c38514c4e72b5b393a566a7d3769de21da4c7e4066cc", "structural_hash": "6b72b4fd4bc9497000e6ea831932213f757cca002b43e3bb28ccfc93876f16ec", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02802.php", "upstream_id": "BenchmarkTest02802", "language": "php", "code": "cookies->get('session_token', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n if (!preg_match('/^[A-Za-z0-9_ @-]+$/', $data)) { return new JsonResponse(['error'=>'invalid'], 400); }\n $processed = $data;\n $stored = '0e462097431906509019562988736854';\n if (hash_equals($stored, md5((string)$processed))) { return new JsonResponse([\"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-843"], "category": "typejuggling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0a60651b3958b4e64f872524f6b3cefa09a45d207835217a742aaea01472bc21", "structural_hash": "e901b8e26d06f36644231324300add582fc128b1af629cfd759b6c91a9a771b0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02527.rb", "upstream_id": "BenchmarkTest02527", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.body.read\n data = user_input ? user_input : ''\n token = SecureRandom.hex(32)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24652f306ca8299a81f42ec1e0301371433c3b8cdb20e6dc7c5b8dbb1a508b16", "structural_hash": "1db51508d4d7de8e33dfbf1e7f5eefe9bec62926f7b1cba18051215e434a5e2d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00050.rb", "upstream_id": "BenchmarkTest00050", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"Authorization\"].to_s\n data = user_input.gsub(\"\\u0000\", \"\")\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "620238b829a25b831889395ab371bd49e3aac7ba7bf7a3ea2ca144525269cf96", "structural_hash": "98a0c849ccc31f18047d7e70b7313768de7a45818ec835a53ab5ae246a864133", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35740.go", "upstream_id": "BenchmarkTest35740", "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\tfieldValue := r.FormValue(\"field\")\n\tdata := strings.ReplaceAll(fieldValue, \"\\x00\", \"\")\n\tos.Setenv(\"APP_USER_PREFERENCE\", data)\n\tw.Header().Set(\"X-Config-Set\", \"APP_USER_PREFERENCE\")\n}", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2847000c4c3d49f103d98a244eabc1b032a4ae992a71ad950dfbeb28734306f1", "structural_hash": "404edf0e43cf7f125414cbedcd9b76a3efcd0074eeea2b3167685c707487cdc6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02973.ts", "upstream_id": "BenchmarkTest02973", "language": "typescript", "code": "import { Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 if (![\"asc\",\"desc\",\"name\",\"created\"].includes(userInput)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = userInput;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb3d9c933e23f0916b3c02b7bf8ba7fa3a2e9291437ce409b02f9c275234d293", "structural_hash": "b487702ea40b9d059dd3f922502fd395ffae6ca5c3f2f476445a327540a735be", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03963.cpp", "upstream_id": "BenchmarkTest03963", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bdc41b0d0f29fd414a149ac0a8d3ce5819841efae884dfb060f146b3f3e664c", "structural_hash": "87ef03c5625a0714250b95c08603dee7659e6097dd7d12d3b0f0e392f6233355", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01218.py", "upstream_id": "BenchmarkTest01218", "language": "python", "code": "import requests\nfrom urllib.parse import urlparse\nimport ipaddress\nimport socket\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n header_value = request.headers.get('X-Custom-Header', '')\n pending = list(str(header_value).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\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 jsonify({'error': 'metadata endpoint blocked'}), 403\n target_url = str(data).replace(parsed.hostname, resolved) if parsed.hostname else str(data)\n requests.get(str(target_url))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "634eee99e53df6d3035af84904424bc116f6fa499de8c3d2d5743ea32100b543", "structural_hash": "8f2a3a22dc0e5c05823b584ad7f6538e2583760674172de3c5c3e367a7008c8e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05370.rs", "upstream_id": "BenchmarkTest05370", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n crate::shared::set_cookie(&format!(\"session={}\", origin_value));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab626e97b600c84fd6e004eb555b6306049bb876d11e53d403a9ac65e308a8d5", "structural_hash": "3f94f3907a31727cbc9f5c9754f340a859c25dfa4c1de399ccf9331b43eff4c2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03235.ts", "upstream_id": "BenchmarkTest03235", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n if (process.env.NODE_ENV !== \"test\") {\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n }\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "95a93c514853cccf7c65add5d1183559d90ea9f2e6233273db7caf976497c12e", "structural_hash": "b3731c222b1ad030ef025dc8f2e0fac2e2993023e7ae9223e3acfcba5553d7b4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03274.php", "upstream_id": "BenchmarkTest03274", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $tokens = explode(',', $userInput);\n $data = implode(',', $tokens);\n $token = bin2hex(random_bytes(32));\n return new JsonResponse(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80794696c4f0def81f37076db2246f2bbc6dffb62afb1258edf5479fbac89545", "structural_hash": "7de5f9c9b31bd0644b65d70d820239e294a465aeab0433fd5ea6f1bd489416f5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19559.go", "upstream_id": "BenchmarkTest19559", "language": "go", "code": "package testcode\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tvar data string\n\tif fieldValue != \"\" {\n\t\tdata = fieldValue\n\t}\n\thashedCred := fmt.Sprintf(\"%x\", sha256.Sum256([]byte(data)))\n\tif !authVerify(hashedCred, os.Getenv(\"CREDENTIAL_HASH\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "755bd35011b20009e6e39861836493578626f2b1277d5cbd9361df0964827c4b", "structural_hash": "44047e30b0d700b87521ed8daefe521dfa1258ad26f0d7a98469f61c0dad99d5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18677.c", "upstream_id": "BenchmarkTest18677", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"prefix-%s\", user_input);\n pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "551818234cf17a83f0148275149b91abc203df1290d28f9747100b8c63fc19cc", "structural_hash": "4cfa0cdeed70154e46c4bbf010b338664018801de2e588a493437d8d5145e061", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01793.rb", "upstream_id": "BenchmarkTest01793", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n 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 halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3185c6d145ac36c660e1afc58b41523462857f3b4d9938bfb1e453f5cb3ef3bb", "structural_hash": "59713051dfe2f625a440b7d45d4a668b6cbd158ce754eb5e851a26151858e216", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00592.cpp", "upstream_id": "BenchmarkTest00592", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REDIS_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5482700d6e10d1e9821debb83ab347bcf572044757ae43b59facb0b78d339a6c", "structural_hash": "7feea56087c19c46f995c5b19fd797bd71549ba6ca0ebbe5d91c2cc28c8a0c7f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00181.rb", "upstream_id": "BenchmarkTest00181", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n if %w[read write admin].include?(data.to_s)\n halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b2ae8122a4ac4f6c36fc8314f3e523da1ce4dcbf1a7ee830d5d993a3d1702d56", "structural_hash": "369bbb914651082db3a71372c0d65603afa514e99d09e4ad19b23ef8455c6286", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10376.js", "upstream_id": "BenchmarkTest10376", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = process.env.USER_INPUT || \"\";\n res.status(500).json({ error: userInput, stack: new Error().stack }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "33349acb2fa05258d85f50be46dc884c4d395b3c26d38acaaaa5fc0b66b36fd3", "structural_hash": "0f431d6252f98e1f7a4dad0d50052f2c3111bdd9e5354f9207a7a5c241fd062b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03351.php", "upstream_id": "BenchmarkTest03351", "language": "php", "code": " true]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5cbaa7efb02b09f2a4493e7265e449bacd08ac18b55122e13a0543d3d84d2c20", "structural_hash": "8af7ee5cd76f152d94096ab4e6b8387f54b2c3ef80ccd3a470bd58532cf8d4b9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00961.ts", "upstream_id": "BenchmarkTest00961", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "901c0549d478b6da8c72f305908d4999019a7d3783be7b4e1e285c647691d675", "structural_hash": "a15736351672ed4078bf25471deb19a4c613b0e76588b860e41ef51b4c5e57ad", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02689.rb", "upstream_id": "BenchmarkTest02689", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = request.headers[\"X-Custom-Header\"].to_s\n data = ''\n user_input.split(',').each { |token| data = token }\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "23fd19fdb06ba619e462309142a4665c935a55b9a458745472affec4f31f2464", "structural_hash": "4967842c65b0f16c854b64c5b9e58b56c3b57b23126091e7decc44065cc97ea8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00976.cpp", "upstream_id": "BenchmarkTest00976", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7f763ec8dc9cd120189332253fb77ef9a56c08455a8aae17aaeee0ab2895e319", "structural_hash": "174e507d3cb53e4b1b53fc2654a91ced081af392eaab387e93a86e4c192b8934", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00767.java", "upstream_id": "BenchmarkTest00767", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.text.MessageFormat fmt = new java.text.MessageFormat(\"row_{0}\");\n String data = fmt.format(new Object[]{authHeader});\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08854613c96eb712d627e6a044bf6f79e6629fd9ff16d1c055471f9112996a1a", "structural_hash": "b56945694c5054720aa384d395cd5f8bb73c0c9bc37da8495065d4e0b8b77ed2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00214.ts", "upstream_id": "BenchmarkTest00214", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "495170dd50dd6093be0b051799faa3b71fbae1183b457cda3dcf4f1b97d0212d", "structural_hash": "d037382a7f14cbd82ec2cb54a0b99e2c5c06b09bc728eabd96fcf23c8bbcf3e3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05024.ts", "upstream_id": "BenchmarkTest05024", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b947736505d175d4deb037436c60159b69acb40c91d9b0407e96ddf169f67b55", "structural_hash": "0451a6071767f970375a71a0e2163fb78430ceb30a81901c0a1ed19ec84dad28", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00665.rb", "upstream_id": "BenchmarkTest00665", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_X_CUSTOM_HEADER\"].to_s\n payload, _origin = user_input, 'http'\n data = payload\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6207c7ec9a8c236e9ac210f6d1312c1c1931082963251b7391354a3763a0ef7b", "structural_hash": "a4dc3b0a8e6368ee2648783ea1c53150def866d47d192738fc66964b1255b9aa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06180.ts", "upstream_id": "BenchmarkTest06180", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7cac311746f5ef921f0a4d4f047c5d84750d6d47a17dbefaf8f50db9e4b014e3", "structural_hash": "f9eceba8312b15c84df8f338d573f9de988b38f805a08fdb7d047f6579cbca69", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02603.rs", "upstream_id": "BenchmarkTest02603", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let origin_value = headers.get(\"origin\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(origin_value.clone());\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return (StatusCode::OK, \"\").into_response();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c0ace93b432db6b3ed6f891d2566d66f21ee759ad42b04960e40af38523ce3cb", "structural_hash": "84dbb931a6f209ef856b5f90d2301ecd5dd7738ef58351eea9c2a432ef419a98", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_19079.go", "upstream_id": "BenchmarkTest19079", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tsegments := strings.Split(originValue, \",\")\n\tdata := strings.Join(segments, \" \")\n\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\tif xmlErr != nil {\n\t\thttp.Error(w, xmlErr.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+data+\"']\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90bd4834f766bc56fcaa25a1d5f96bf6fbfa6d60d142ff032f9f63e85c5d31ba", "structural_hash": "1dd4844eb954036d65050340e4f87d9de557570fe2832bed47fbaa7a91c04209", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10499.go", "upstream_id": "BenchmarkTest10499", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tsegments := strings.Split(forwardedIP, \",\")\n\tdata := strings.Join(segments, \" \")\n\tr = r.WithContext(context.WithValue(r.Context(), ctxKeyData, data))\n}", "label": 1, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91a20fee0add9a4b117e1b0ec0f5a80dae445169cadea91c122e9cc364269176", "structural_hash": "866b784a3d2000720db9b2e827ef65793c5dc5b664dde5b5425a7804b0840519", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_26939.js", "upstream_id": "BenchmarkTest26939", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.files && ctx.request.files.file && ctx.request.files.file.name) || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-1240"], "category": "risky_crypto_impl", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e04fd67f7ba0087b780ba3a6ea79648298e2fc8d40baa0c225a21c6438ab2b90", "structural_hash": "307ae071f6ca3d74b384818a2264dbe64bc1fffa1f1a116c36ac355ce91c728f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39210.go", "upstream_id": "BenchmarkTest39210", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tvar data string\n\tif rawBody != \"\" {\n\t\tdata = rawBody\n\t}\n\tencrypted := encryptForStorage(data)\n\tos.WriteFile(\"/var/app/data/store.dat\", []byte(encrypted), 0644)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-219"], "category": "sensitive_file_web_root", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6eb2fe8645d19bc7448388515b335e72dac374c7e4f34e79cef9b97ef590a141", "structural_hash": "0f96068fe6710eaa0c9918e462544debbf33e870ed294e3f41402b15c45511d3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01801.cpp", "upstream_id": "BenchmarkTest01801", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = !user_input.empty() ? user_input : std::string();\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bfa8016981339f92d3da12b33f05479b5a76172eca4ba5d60a7052e52ac711d", "structural_hash": "4404ac4b5991112ff71a6ede00ce44b7cef3bb706f39f58672f132f6fbd7e396", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15947.c", "upstream_id": "BenchmarkTest15947", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"value_%s\", user_input);\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b68454606f919484c8ee670ea40b6ada818f77f3d1694544971b69f92afa23e7", "structural_hash": "673859071bbd0be0ad7d9d0b20aa85abdb6a42fe1edaeb46329a6674bd13464c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02041.py", "upstream_id": "BenchmarkTest02041", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\ndef benchmark_case(request):\n comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n if comment_value:\n data = comment_value\n else:\n data = ''\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d43340f8fc36a602b079fb3f11151fd38341fd04bb0c0f247878f1717565f57", "structural_hash": "e3b86047d04c2afd15aac7567f3073d79e8b7a13ef8f3ee4e6b93de6e382eaba", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13266.sh", "upstream_id": "BenchmarkTest13266", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n _body=$(curl -s \"$data\")\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "35bd48ba347bf03a24e270407e1ea63e21ea6314c3d8349f31fb2f9c0a8bb332", "structural_hash": "7b73cc847160dd783908244d47841570610d0ed84d9f848c70d91629be249fcf", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00043.java", "upstream_id": "BenchmarkTest00043", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"id\") String id, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String userId = id != null ? id : \"\";\n String data = java.net.URLDecoder.decode(userId, java.nio.charset.StandardCharsets.UTF_8);\n if (data.isEmpty()) { response.sendError(400, \"request required\"); return; }\n String envSecret = System.getenv(\"APP_SECRET\");\n if (envSecret == null) throw new IllegalStateException(\"APP_SECRET unset\");\n String storeCred = envSecret;\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", storeCred)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 0, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5492603700ab3b745a2826b7a8c1550926c93356178055617ecd91788c67cae8", "structural_hash": "a88a2b60ee1488defa9b922398ad1620a29293d63628cb5623e4b5c6bba6b98a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05218.rs", "upstream_id": "BenchmarkTest05218", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::HeaderMap;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(headers: HeaderMap, Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = match field_value.chars().next() { Some(_) => field_value.clone(), None => \"default\".to_string() };\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ec86384d86bee755034a5d3377f8c172dfb163c75a1c37c7eaf88a714aaf1ce", "structural_hash": "309a736aef03c7a8f3d6cf32494a84b0fb6cfd89f49c8f496263f64315d79e18", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05977.py", "upstream_id": "BenchmarkTest05977", "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 user_id = request.query_params.get('id', '')\n pending = list(str(user_id).split(','))\n collected = []\n while pending:\n collected.append(pending.pop(0).strip())\n data = ','.join(collected)\n size = min(int(data) if str(data).isdigit() else 0, 1024)\n buffer = bytearray(size)\n return JSONResponse({'allocated': len(buffer)}, status_code=200)", "label": 0, "cwe": ["CWE-400"], "category": "resourceexhaust", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:resourceexhaust", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3956a52ebdef168137f6c67a290e8613d00518936dfe2fa5db13268ee56d37c", "structural_hash": "bf2de7595368dd03f3cae5899ed5683bff0e97839ed981d7fd185be39bf9e143", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_15459.go", "upstream_id": "BenchmarkTest15459", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\toriginValue := r.Header.Get(\"Origin\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(originValue)\n\tauthVerify(\"user\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-1391"], "category": "weak_cred_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5eca1bb763aa3a499cf93a17d7a8fa001c67abb475b09d47b0099353b7c54819", "structural_hash": "7b0b2af9d5aee37f34e6d0af675065386530e2a04a9c5f0b29bb8362ef16c637", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_27383.js", "upstream_id": "BenchmarkTest27383", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-757"], "category": "algo_downgrade", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d8607f9136b847eebb6f5183998f8bfab27453cc63da382901a5a6abe3da70ac", "structural_hash": "91b19c40a93792fb12c48646a72d6bc4a89884820b836003259160b4bdc43352", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_04505.js", "upstream_id": "BenchmarkTest04505", "language": "javascript", "code": "const zod = require(\"zod\");\nasync function benchmark_case(req, res) {\n const userInput = req.params.id || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error:\"invalid\"}); return; }\n const processed = _parsed.data;\n const params = new Map();\n for (const pair of String(processed).split(\"&\")) { const [k, v] = pair.split(\"=\"); params.set(k, v); }\n res.json({ role: params.get(\"role\") }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f95f7abc145b1f94e91fa16412ce76b483ef583c79348c978d54dfa9985b9b7e", "structural_hash": "b9cb161c05609868dd9dcec0a86fb0f38b7734d1d4c140cc83414ef36b802c2f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00596.sh", "upstream_id": "BenchmarkTest00596", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n if [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-303"], "category": "incorrect_auth_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f721e903d0fe1ee71e4e297edd9c8ec158e0381a8e8c7d68cbf769ef10134bfc", "structural_hash": "0fbaeba6a1e7f9cfef409527cd1216e1205a8e8b1883c39cd25e581f1ceaa4a3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01926.php", "upstream_id": "BenchmarkTest01926", "language": "php", "code": " true]);\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5bb1eda8aa1cf06df718ac03a09054ec60fdb38eb9d1897925fcd5a9fc951c61", "structural_hash": "6ee5b7f34ba17a5f733cbeb767eb717b7dc6f5908f1dcb22a5322bfd4eba50c6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_38516.js", "upstream_id": "BenchmarkTest38516", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = (req.body.variables && req.body.variables.input) || \"\";\n const _obj = { payload: userInput };\n const data = _obj['payload'];\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-489"], "category": "debug_code_production", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2b1ceffa7bd31733eed152332319d9e86221d8a40b7247f6ed03f1cfc6414ec6", "structural_hash": "77217da5c68116456e1027cc0b3dbd67921191f7e27b4fdbdfb0dac20b6bc5cd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03795.c", "upstream_id": "BenchmarkTest03795", "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 FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db16ad10f20c9b86253cc42b687e46c5a7ebd0de2c5d638aff8dd9374333af42", "structural_hash": "58351c7d8a3ac5ca92d373d97e0836c1c0ccdd8bba5298175e763bc0271227a2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_31800.go", "upstream_id": "BenchmarkTest31800", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(refererValue)\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{data, \"data\"})\n\tcsvWriter.Flush()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a111084c01e85489743e48c1c7f36f83aec2a9470ae5bf27adabeb436075ae17", "structural_hash": "ddf5f064022e9218a86a16ce8b358b0c3841aca5de997d7d602d465118745d70", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_07093.go", "upstream_id": "BenchmarkTest07093", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(c.Request.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tos.WriteFile(\"/var/uploads/\"+graphqlVar, []byte(\"data\"), 0644)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-646"], "category": "unsafe_file_upload_type", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aefd898abdb9dcaa2158967db9ce49d814dee3453220ce624b66a4b50f312423", "structural_hash": "271e388aa4b521267533c12ac1fae0354e60061abad463d159552075a4289e7a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04771.ts", "upstream_id": "BenchmarkTest04771", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = `${userInput}`;\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d81a9d9416827640008448681ce850a7d59982082da1aa12cc07406163f1a1e6", "structural_hash": "c8fbc1a257ffec1d3df96725f73621992b0d6c3974ffbecd610a9fea4c2d67b2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00569.php", "upstream_id": "BenchmarkTest00569", "language": "php", "code": "header('Host', '');\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n return response('' . (string)$data . '')->header('Content-Type', 'text/html');\n }\n}", "label": 1, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc03b8548f9b40427c23edff2cc823f5f41ac391a9521ac35645ddb1f565d95e", "structural_hash": "32d6190f8bc603693fc93cfd32a818f70fd606543959a34fc2490b11578b5310", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01995.cpp", "upstream_id": "BenchmarkTest01995", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REDIS_VALUE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4b127e5099de16ee00bddc15d86387bf2099aa67483c809c6e69196b62e83181", "structural_hash": "a694ebe7e6887a273d8ed43e3d7198df9be954ac9e700338cbdfae709d7eab6a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00795.cpp", "upstream_id": "BenchmarkTest00795", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string _hurl = user_input;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6c414146b28f1af416cb2bef295ef2b2facbce2f1babf43b44eac559728321f6", "structural_hash": "6072afcec3fb07570ce389ab3a29ab99ad27fbe020b763458bbd445d90e239cd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest00380.java", "upstream_id": "BenchmarkTest00380", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n record FormData(String payload) {}\n @POST\n @Path(\"/benchmark_case\")\n @Consumes(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 FormData payload = new FormData(fieldValue);\n String data = payload.payload();\n response.setHeader(\"X-Forwarded-For\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "feaf209c63e42ee5f45a4929c86bc8fff32faef0b2587a58ec6fcd2b14c15eb8", "structural_hash": "a9783b6c9d062072725f1240af41b1feca2dd61689ec209ba4fdeb01d9165ced", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04332.rs", "upstream_id": "BenchmarkTest04332", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n struct UserPayload { input: String }\n impl UserPayload { fn value(&self) -> &str { self.input.as_str() } }\n let payload = UserPayload { input: multipart_value.clone() };\n let data = payload.value().to_string();\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e4cf743c2e2bd91af2c2b2954f4ad6dd6fa4a3c8e9aa76a1dca2f37f17db4c40", "structural_hash": "5de15772ec04183b4ae71185aee715b3002a2a94f504a0234bef641941f0a31c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01140.ts", "upstream_id": "BenchmarkTest01140", "language": "typescript", "code": "import { Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\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 fields = [userInput, 'http'];\n const [data] = fields;\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a0ddd9710ed67d3590d873d9e530354132a7e70921883880fe4eeb118b2d3b0d", "structural_hash": "b7d83dd21272330570c9c6b5951d2dfd8ae4a5207fbfd3906ab479e14ce64df5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01408.py", "upstream_id": "BenchmarkTest01408", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n xml_value = request.body.decode('utf-8')\n data = '{}'.format(xml_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "434d352fc1434e215099db462f7f7f4d75b699f691d6dfa63bdb3497d62d4275", "structural_hash": "1e17c008b37e53a25398087793db632a9c78df12948886e472d77f19a3623ac2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00469.cpp", "upstream_id": "BenchmarkTest00469", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"API_RESPONSE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed17807eae48a5ccdbdd503ffcae906485931def2349d8a5d7d377dfbb784dc2", "structural_hash": "f274dac9e01f23dcffebf7322097db2a0cf21ee8d1ffd9ba911ce51059c3863a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00168.c", "upstream_id": "BenchmarkTest00168", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "59d65ae28842c2c9766cc8fbeb51f45a853a2eb1d2ac8d9967bb6bedd509ad17", "structural_hash": "6a9a04361aecd3a3a64a944865e34e889cae72c8ee7e226dce2c72950a4b7b91", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03903.py", "upstream_id": "BenchmarkTest03903", "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 parts = str(json_value).split(',')\n data = ','.join(parts)\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Content-Language': str(data)})", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "caa64589e84280b319cfa43d95ac2fd1fa9890371c13d49ef9b4ca29bb28c86d", "structural_hash": "85344b19a9c0bcbd217787b646ef21c010ec6baf0de4a82d09c9e86bbb4af09d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05620.c", "upstream_id": "BenchmarkTest05620", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "812b6225e40140c55ab0c848b11ad959bf05ae8a82934a2c4b975d30e60582bf", "structural_hash": "bb00eafadd712e1f49cc4dc3a0549090fd0a0d1b5899a7ca99bc9ebe11d2110f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03827.rs", "upstream_id": "BenchmarkTest03827", "language": "rust", "code": "use actix_web::{HttpResponse};\nuse futures_util::StreamExt;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(mut payload: actix_multipart::Multipart) -> HttpResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Some(Ok(_field)) = payload.next().await {\n if let Some(_cd) = _field.content_disposition() {\n if let Some(_f) = _cd.get_filename() { _fname = _f.to_string(); break; }\n }\n }\n _fname\n };\n let data = upload_name.to_string();\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9b4edb0847e9a50d626bd72531828f59e1987d54ec080de2421747e1d9ecafc", "structural_hash": "2f90876f6ef05cf593179025c6809a21e2030642fabb91b737508ac1e15cac10", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28253.sh", "upstream_id": "BenchmarkTest28253", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n 's/.*filename=\"\\([^\"]*\\)\".*/\\1/p' | head -1)\"\n printf \"%s\" \"$user_input\" | openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:oaep -pubin -inkey /etc/app/rsa_pub.pem -out /dev/null 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2c0d8c42b159b4195c215492af3aad982498f0a2d3743c5f1b6ad9152a513973", "structural_hash": "546e72fc806e8be04ee9253ebae533121de52384bcc9cfd05913d756ccf2f43b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05975.rb", "upstream_id": "BenchmarkTest05975", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"securerandom\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = cookies[:session_token].to_s\n data = sprintf(\"%s\", user_input)\n token = SecureRandom.hex(32)\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "597567d554139342240493421844aefaf87beebbbd7a155ad978688946d1a4ec", "structural_hash": "644712c1cad78118a4cfff45b62166282307f2f617ef0d7af36b775b18455f84", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04468.ts", "upstream_id": "BenchmarkTest04468", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"origin\") origin: string): Promise {\n const userInput = origin || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c60c2ff11a1ac8acdc0feecb35d58fbb6082b86a9968966a64139662d4b7e795", "structural_hash": "decfb99b16cc1cfd74435b611b08103ea62aec9e0db137d56586c9e644537408", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02992.sh", "upstream_id": "BenchmarkTest02992", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n printf -v data \"%s\" \"${user_input}\"\n trap '' ERR\n echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-396"], "category": "generic_catch", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52b17232cb6040c0a1c347ee7d3b2a116d09a70b29e191621467e5efced8f532", "structural_hash": "64473971f5a38f6124e41522812a84dbc9a1167bfc2621a300c03e31d927c6de", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01785.rs", "upstream_id": "BenchmarkTest01785", "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 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 = cookie_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let _token = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\");\n if !crate::shared::verify_bearer(_token) { return (StatusCode::UNAUTHORIZED, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f2b751689c9ca259368d9b7f9cb5c40e569c0a15907c8d173416b0539756ef3b", "structural_hash": "66f642a1df4c4615701bf3ff50ef6969afab56b65bd1c3c6168dfbd116f19af0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09951.c", "upstream_id": "BenchmarkTest09951", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "155c8f4627c9d9286bcf5d0890fd84763c5e6b3d3d71aa54966767b7e1383cf1", "structural_hash": "59c88cbcc067ce236770449c1866eeefd8cee894655036b7b67d32d0a446cd7d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04278.ts", "upstream_id": "BenchmarkTest04278", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 parts: string[] = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data: string = parts.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fcb73b13797d8c9daa1302ee87bfbc7e94b9ff50d916094fb5323565c9aebf1c", "structural_hash": "04747c86221cf6fa5fd53aa04a20e164b8d3dacc39bd2ff01f3b6e71ee4fecf8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00455.cpp", "upstream_id": "BenchmarkTest00455", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "331f6943c16b89cada4d26e5107eda718f68972bd6148c80cdec9c57db910d1a", "structural_hash": "ba9f67caa2cf7322abf0160d88fb2b716900179648a41f638b5d51b0eec6437a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03888.rb", "upstream_id": "BenchmarkTest03888", "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 cookies[:session] = data\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1736b5227d05fefe7621368b9557c1ddded9624d183d36590631660faef65b60", "structural_hash": "c79c94412a890a3b419896ad6611b290a50f36d069dad90bd13c6690d63ea2bf", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01262.ts", "upstream_id": "BenchmarkTest01262", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post } from \"@nestjs/common\";\nimport * as nodeUtil from \"util\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7fb6fa012198b050e63b1a7f29a2543d17587024de56897be3fd3bd49af6dee", "structural_hash": "35f9d425e79af206ae752eec4b4c79c0b49ba16c7d0125eddbfb4f405dc20154", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09045.js", "upstream_id": "BenchmarkTest09045", "language": "javascript", "code": "const crypto = require(\"crypto\");\nasync function benchmark_case(req, res) {\n const userInput = \"config_secret_test_abc123\";\n const data = await Promise.resolve(userInput);\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.from(String(data).padEnd(32, \"0\")).slice(0, 32), crypto.randomBytes(12)).update(\"payload\");\n res.json({ status: \"ok\" });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-321"], "category": "hardcoded_crypto_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:default_password_use", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3bedf52abf2c3a9008917c9dc07743be45d6ab5d2ac51c3d8620a5b5d204d2c3", "structural_hash": "15819e5ca477fdbdb1ef9109918d135138451822af84e674645f057179789014", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "jakarta/testcode/BenchmarkTest05234.java", "upstream_id": "BenchmarkTest05234", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.ws.rs.*;\nimport jakarta.ws.rs.core.Context;\nimport jakarta.ws.rs.core.MediaType;\nimport jakarta.ws.rs.core.Response;\n@Path(\"/\")\npublic class benchmark_case {\n @GET\n @Path(\"/benchmark_case\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response benchmark_case(@HeaderParam(\"Origin\") String origin, @Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception {\n String originValue = origin != null ? origin : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(originValue.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n if (!data.matches(\"^[a-zA-Z0-9_.-]+$\")) { return Response.status(400).build(); }\n response.setHeader(\"X-Forwarded-For\", data);\n return Response.ok(\"{\\\"ready\\\":true}\", MediaType.APPLICATION_JSON).build();\n }\n}", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:jakarta:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4d72af2a6aa02f9fc11cf2be14181c69c039346c0887fd000c6b082a9bdd39d0", "structural_hash": "4b8e757603ed94f80d2fbe50b90d33d9971c99532189c4ab9192657f96f48eb0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04863.ts", "upstream_id": "BenchmarkTest04863", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data: string = await new Promise((resolve) => setImmediate(() => resolve(userInput)));\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6d4ac5bb97a4415677a027ec5ff1f1b7d81fa4e311bbaa0ff7cce800196e81af", "structural_hash": "cd75c5898997fc5eb20c97224cbb9de6fb31c0940eb22041c483472b821c0396", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_33660.js", "upstream_id": "BenchmarkTest33660", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.query.id || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n if (!authzCheck(ctx.session && ctx.session.user, \"admin\")) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-642"], "category": "external_critical_state", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0734397040b674493f9794fdea1312f39fd73b97a5a2cc045b2a2a1449881048", "structural_hash": "682f69f168dbd4f1e28beab29ba0a059652902a53f2d46b103835ca6677b0e40", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03612.c", "upstream_id": "BenchmarkTest03612", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e2fa9b3108be3b1e928f883b03197afb38a185aa0aa643d45e77e49c048a370", "structural_hash": "64685092428a1bf33b13a62ec048e005726e977e5d98da6d308dff5491db57f4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12660.c", "upstream_id": "BenchmarkTest12660", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8dd89d55973e933948901c1388466c95bafedbe09d8f3a39b70f1af14d7beab4", "structural_hash": "efcf9f13e0177ae89afb81fed2c240c4eb4bd02c1d6dd1b363badb64fe6be564", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05402.ts", "upstream_id": "BenchmarkTest05402", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const data = userInput != null ? userInput : '';\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1ca23ffb3f25edc90e5794797061936fd59de8ca9dedd3ffdf6a4bab8b77e12f", "structural_hash": "74d6520bb894c536e5c2ca39d7e010421b3ddc3d596d3728b48d9fed192788db", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_02721.rb", "upstream_id": "BenchmarkTest02721", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"cgi\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params[:id].to_s\n data = CGI.unescape(user_input)\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ebe3750c78a8907ee90174c133648e518ef42ba758759fb1693c1b5bc230b315", "structural_hash": "47c981ebc400ef869881c13f0a85402cff707dc6a56d4d8ed6053d8500d9b3d3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_20584.js", "upstream_id": "BenchmarkTest20584", "language": "javascript", "code": "const benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const _mod = await import('./shared.mjs');\n const data = _mod.passthrough(userInput);\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-308"], "category": "single_factor_auth", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5239a0c55f9d3df21e5f37f4ef4db5392cd393bc99f2f710519866950787d098", "structural_hash": "dc943d1687f8c1b14ad158b9ee1f86aae34a5a638bc064ccaff4677edf4c8621", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02698.cpp", "upstream_id": "BenchmarkTest02698", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n 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 _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab2a508511fedfdae2de5bd2bf4014d4b414b8297e14e68aa6fe09012449ed8b", "structural_hash": "b26ac9318a4fff6d1ed52ceab9853ef7a76953fcfa13151a5652b1c92ebafa59", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19094.c", "upstream_id": "BenchmarkTest19094", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_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 _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a295839b17c15017a4700fc000a3be6d31ef7c721b91d48d5c6f8946e405de5", "structural_hash": "5be4777a70ab3e6d639e71c6f9394e0bce0b8ce1db4b7eeda2009f853192aadd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_08694.js", "upstream_id": "BenchmarkTest08694", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n if (!authzCheck(ctx.session && ctx.session.user, \"admin\")) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c1743e87a4e2e06145904abbb14413dd148d0cf697b3941214646f27de8816b", "structural_hash": "8d7a9335f4dc0a6292214b60f62fb701723768fec9521ea3aa15ff151c2dc32e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00868.php", "upstream_id": "BenchmarkTest00868", "language": "php", "code": "header('User-Agent', '');\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 response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n logger()->info('Action: ' . $processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a006b9bd61dcd2782d51623c35b0cc4f8df1894e21d38526686b39d5da98c3b2", "structural_hash": "c500373da97d1806a7fcf3cb4cb24735954c656e0183c22c372b60d9cd9b8f86", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_06789.js", "upstream_id": "BenchmarkTest06789", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n if (!authCheck(data, ctx.session.token)) { ctx.status = 401; ctx.body = {error: \"unauthorized\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "224587c6dfeba023233028574d9cd99344ac097f3371c22acbf488d0d9d45c2a", "structural_hash": "eecdaf3fef8d38dd720dc4b645af2ba3d61bc54d0e9307e9b17ce2ec7b913452", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_05684.rb", "upstream_id": "BenchmarkTest05684", "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 holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless session[:csrf_token] && ActiveSupport::SecurityUtils.secure_compare(data.to_s, session[:csrf_token].to_s)\n render json: { error: \"csrf mismatch\" }, status: 403\n return\n end\n ActiveRecord::Base.connection.exec_query(\"UPDATE users SET name = ?\", \"SQL\", [[nil, data]])\n end\nend", "label": 0, "cwe": ["CWE-352"], "category": "csrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:csrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f1f3de03c29f95cacef932002e8ee0e8ec12de1fedd8edb70fe4446136cd5e9", "structural_hash": "45208c8a7fb066e70155928f4fa91048e3ca7c94c430df075c0a2c8d0ab19b03", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03595.php", "upstream_id": "BenchmarkTest03595", "language": "php", "code": "files->get('upload')?->getClientOriginalName() ?? '');\n $data = trim((string)$userInput);\n posix_setuid(65534);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83f29c9ab2c6d7f4592781987610d415b7ecf7d023929e5deab5a0db26e6c399", "structural_hash": "bce23c8d4a8ab94a4dca4e3e058e7492870617b4a20d3ae637aac656c321a809", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_16953.js", "upstream_id": "BenchmarkTest16953", "language": "javascript", "code": "const { authCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.multipart_field) || \"\";\n const data = await Promise.resolve(userInput).then(String);\n if (!authCheck(data, ctx.session.token)) { ctx.status = 401; ctx.body = {error: \"unauthorized\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-289"], "category": "auth_bypass_alt_name", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "127fd0d5404a561cce15389523eee43ff6d3dbd0e576042f17b3dc4e6fc7342d", "structural_hash": "7d0d8a5ddb8275dd00d9887fbd520c20a084cc2f8dde6110c2888efbfcdf9454", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16648.sh", "upstream_id": "BenchmarkTest16648", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_AUTHORIZATION\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n redis-cli -s /var/run/redis.sock DEL \"account:$data\" >/dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "718458dd23438e8e3ace19ea64abcb53bb629aad2b86fcd0d79d77c3f588d8da", "structural_hash": "5b682562976788e6168bf2d4834fba8f5675903de043928e18362585cbb2a101", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01287.php", "upstream_id": "BenchmarkTest01287", "language": "php", "code": "headers->get('Host', '');\n $token = bin2hex(random_bytes(32));\n return new JsonResponse(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e33844af128af81a8d7d8d9b8f65f93e1580bd9cc9c1ad1208400a92d3a21d0", "structural_hash": "f2a74ed23eae93372b9931f9543e9d4f473485f414e503ee8c70e53e1968ab30", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12257.c", "upstream_id": "BenchmarkTest12257", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbf1c0f0c5ec3a4b0b1e3b91e7bf7744c05cd31b72d963c987dc8536f839792a", "structural_hash": "053ab27018624fcc93f028bad365343ac5f9ca49b7b1b6301f552dd63ef60d38", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_19370.js", "upstream_id": "BenchmarkTest19370", "language": "javascript", "code": "const { authzCheck } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.params.id || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!authzCheck(ctx.session && ctx.session.user, \"admin\")) { ctx.status = 403; ctx.body = {error: \"forbidden\"}; return; }\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-288"], "category": "auth_bypass_alt_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4af030594400ae0ba9940bd2343bce3ccac94aed2713609e4b94003d435c433d", "structural_hash": "d5459e1c3877cbb34c275e931c05ad1deb95c278bd68ccbd731a822f60bfa596", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05398.py", "upstream_id": "BenchmarkTest05398", "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 comment_value = db.fetch_one('SELECT text FROM comments LIMIT 1')\n kind = 'json' if str(comment_value).lstrip().startswith('{') else 'text'\n match kind:\n case 'json':\n data = str(comment_value).strip()\n case _:\n data = str(comment_value)\n if str(data) in ('read', 'write', 'delete', 'admin'):\n return JSONResponse({'access': 'granted', 'role': 'admin'}, status_code=200)\n return {\"updated\": True}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d15532e4e5f60c9bf84de97bbb4d6952e96bd0962469fff12f8ba275a7fa8888", "structural_hash": "d17a2aa98a2d38caad75bfd11cb4ac52607b9ffca7b22ab2e0a48d7a05e41471", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30783.sh", "upstream_id": "BenchmarkTest30783", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n export APP_USER_PREFERENCE=\"$data\"\n echo \"config_set:APP_USER_PREFERENCE\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "287f94bdb1f078e6c79dd0ba5c14af861c1c9b97c1d12f6b898a0142da9bc565", "structural_hash": "900a426454b4e225c806f5593caed006c1da0dc3fc24a3f10f72dce5fa18f5f9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_11104.js", "upstream_id": "BenchmarkTest11104", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "902e1c3099e311c53150e67db53a3e1830bf3fd7212e55e835d1f3ac073c8c6a", "structural_hash": "d494662e17c222906f7a13066a4b4392c21b374eff6b083a2e326a00baab4e1b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00701.py", "upstream_id": "BenchmarkTest00701", "language": "python", "code": "from django.http import JsonResponse\nimport json\nimport re\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').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=200)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a62a3fd7330c086ef8949285f27e1e0a68b671381ff321675c07852e21b83d80", "structural_hash": "735efe99926f906f9bb10620a794009a5428be6ebf011995162b7dad0aa6039f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02409.rs", "upstream_id": "BenchmarkTest02409", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let header_value = headers.get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in header_value.split(',') { data = token.to_string(); }\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d41ca64339dea4bd61d023ee77c7a7fdfcec1c1debf0e9e697e6689b9b3a429a", "structural_hash": "a73080057ca15295432d75a15becab563754dc316cdeee32353682d079a6a05d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00499.py", "upstream_id": "BenchmarkTest00499", "language": "python", "code": "from django.http import JsonResponse\nimport json\ndef benchmark_case(request):\n raw_body = request.body.decode('utf-8')\n data = json.loads(raw_body).get('value', '')\n trusted_claim = str(data)\n return JsonResponse({'trusted': trusted_claim}, status=200)", "label": 1, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb965bc964fb4d7dc95ef334c8e1aac37b4e461d40e354fd0b4d14c0ef48228b", "structural_hash": "5fe2e97fbd798e3db7d1c3db0ededa23b540816d33e237617b706ee89fed65f1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00008.cpp", "upstream_id": "BenchmarkTest00008", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d3e78d4cb945622359ea836b20d9278c741e6a2f49dab82ccad0d4d4406944b", "structural_hash": "904320d195217314ad26a5be7d3d1503d77fa0db9f6794cc1f05fb85882d535f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03520.php", "upstream_id": "BenchmarkTest03520", "language": "php", "code": "name;\n $middleware = function (callable $next): callable {\n return fn($v) => $next($v);\n };\n $handle = $middleware(fn($v) => $v);\n $data = $handle($userInput);\n if (!preg_match('#^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$#', $data)) { return response()->json(['error' => 'forbidden'], 400); }\n $processed = $data;\n logger()->info('Action: ' . $processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f3dd6228f7f28422a753ff3ed18232c711f9e8cbdca124b2dcacd439554b942a", "structural_hash": "f59336d7f4a193eb895e0756e8baf9ce6c1c790bfc71fd9d07ad4865c3ff1593", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09851.c", "upstream_id": "BenchmarkTest09851", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "094c1b028dc1aaa030f7b143fafe7cf44002ef17490afc0677b3173fb69c492a", "structural_hash": "28d3cdc8b14dbd06dea62c9f047d53f7a37de567eea6379bd9eb3c8d35f5f82f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00254.cpp", "upstream_id": "BenchmarkTest00254", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"API_RESPONSE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n if (!user_input.empty()) data = user_input;\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "af4c6c1875dd45efaa913c2b46a9178b90055aa53176811fbf1740e6021aa6a6", "structural_hash": "2c5266b70ffb28518fe604198e03cd81e5370ffbaa04d127d304fd748dda059f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_16969.sh", "upstream_id": "BenchmarkTest16969", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n redis-cli -s /var/run/redis.sock DEL \"account:$data\" >/dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6edafc4da74b50074867dfc2863e256c649d99b81963321299d28aad00552fb", "structural_hash": "4b1924d29b8f421139290539f9594d6fc8f04bc417f23b600b86a4a7a01ac47a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03206.py", "upstream_id": "BenchmarkTest03206", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n user_id = request.query_params.get('id', '')\n parts = str(user_id).split(',')\n data = ','.join(parts)\n db.execute('SELECT * FROM users WHERE id = ?', (data,))\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "028a368c4e416623a936dce63afd60d9e3c2fd09c2d225c4109922fe266746b3", "structural_hash": "ed6528047487f9927159d5ebd1ca32e1b52d2ebc0cc0bff6e0ef54476aac76b6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03149.cpp", "upstream_id": "BenchmarkTest03149", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input + std::string(\"?ref=bench\");\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "75ee8a7e4667461da37b0c0fe530fd5b1aee0c312cc8ad9afb7d8f1b65ba3437", "structural_hash": "cfeac5379a376031113b9c417b239a34163e04300058d4be2d0dc20a0befc585", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_21704.go", "upstream_id": "BenchmarkTest21704", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\theaderValue := r.Header.Get(\"X-Custom-Header\")\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 <- headerValue\n\tclose(_jobs)\n\tdata := <-_out\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed012a6c9cfd7141ce7fa16405271826e6bda715d28b1ae8bbf0e9cb6df9ba97", "structural_hash": "823c2c60fbd0167e0f614aa5bb5663789c5eefb7c64763604617d7d7b7fddaf5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_06115.ts", "upstream_id": "BenchmarkTest06115", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + userInput + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4772e3e64b343325253f096dbbda16c3ce0bd98bafa31c809b77e14502679492", "structural_hash": "13853ceb10bbf7c0704a1df1e26d88b566b508cb5ce58e99998450e4c006fbc6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_38901.js", "upstream_id": "BenchmarkTest38901", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"user-agent\"] || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const { publicKey: weakPubKey } = crypto.generateKeyPairSync(\"rsa\", { modulusLength: 512 });\n crypto.publicEncrypt(weakPubKey, Buffer.from(String(data)));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-326"], "category": "weakkeylength", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3d64127ad7da79bd0e17afc82b59c1a2ca4974015305aa0422d69fa3fb5e4f5c", "structural_hash": "274051f9ef86dd9e03f133bbbdbfea5523b2e2e95847f8f573ca2e9b8a1b8ad6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01426.java", "upstream_id": "BenchmarkTest01426", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n record FormData(String payload) {}\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n FormData payload = new FormData(rawData);\n String data = payload.payload();\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "784bca4ea289eeca34d03398f7a72610bf4274af5756e556446d09a09fcdf3fe", "structural_hash": "8c1bd4e7b3a2b60ee7cd0c575ba73489faf0cdabb5b6d40fb6d3cae9e15e519c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03449.php", "upstream_id": "BenchmarkTest03449", "language": "php", "code": "header('Origin', '');\n $data = trim((string)$userInput);\n if (!in_array((string)$data, ['true', 'false', '1', '0'], true)) { return response()->json(['error' => 'invalid bool'], 400); }\n $parsedBool = (string)$data;\n logger()->info('Action: ' . $parsedBool);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e5778adb93857a59aa2050d22c36b90dd2b82bb11a835d202f05424faa178362", "structural_hash": "8c45c3771a7324757eb5c49f27baaa7efd17734613dfda96161d53fb8e64c164", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00902.rb", "upstream_id": "BenchmarkTest00902", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n pending = user_input.split(',')\n data = ''\n data = pending.shift until pending.empty?\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "83646cf9ab226b6072808a1a8d46559e5c32edc0c68e66c9fc393c2f46a4df77", "structural_hash": "712560df602bf14c7d620bb123125bc4da029e85eebf2d250a8eac552081e63d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04721.rb", "upstream_id": "BenchmarkTest04721", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n data = !user_input.empty? ? user_input : ''\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "162fbb57067562b815e3671be5c312d7f0341be34fabfbc8e6095bfaba89042b", "structural_hash": "8ca52b1a4764ffd081387ed240bf05b1e970ef6db55b4126d4837e290801ad66", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03532.rb", "upstream_id": "BenchmarkTest03532", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_ORIGIN\"].to_s\n rec = Data.define(:payload).new(payload: user_input.to_s)\n data = rec.payload\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1178e3c188fc5f19ae687887df8c6f0273b8b7908f16051c24d74f0bdd7f7e7e", "structural_hash": "5e73ba0d0366416de7cb35dcc897efaeb8b51611a5c58c39231a61ff357ddb35", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_30549.sh", "upstream_id": "BenchmarkTest30549", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n eval \"_body=$(curl -s \\\"$data\\\"); printf \\\"%s\\\" \\\"$_body\\\" > /var/app/feed.dat\"\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fc49e94bbdbf6b871df78ff0f901a5f0680c73837e96dc2c9e50250bebc29472", "structural_hash": "72eed2c3c9decc9e69d5eb6f1f1ea0032a61f84668c2ee13ba781580b7a69c69", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01848.rs", "upstream_id": "BenchmarkTest01848", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let transform = |v: String| v.trim().to_string();\n let data = transform(json_value.clone());\n 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 tokio::fs::remove_file(format!(\"/var/app/data/{}\", processed)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "197b3345bb3ffd0c52e0d0aca06b84acd3203968834c0c76a00935ee9211c988", "structural_hash": "27b1db17ee1d9f3eaf4f9c3d3517d7170ddd5a6ad508527645de915cf8afffbb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01488.php", "upstream_id": "BenchmarkTest01488", "language": "php", "code": "fetchOne('SELECT bio FROM profiles LIMIT 1');\n $data = strtr('{0}', ['{0}' => (string)$userInput]);\n $encKey = getenv('DATA_ENC_KEY');\n $iv = random_bytes(12);\n $tag = '';\n $_ct = openssl_encrypt((string)$data, 'aes-256-gcm', $encKey, 0, $iv, $tag);\n $encrypted = base64_encode($iv . $tag . $_ct);\n file_put_contents('/var/data/secrets.enc', $encrypted);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8a511e268701dd442ca78ba33aab4fb1253fc12f691ced166f9f0968afd5317d", "structural_hash": "4ca0bc2d279cf467c74d7ca1f1b9fd6cd99ca073bac9c286a261cb74bb86cb2d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_40472.js", "upstream_id": "BenchmarkTest40472", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = `${userInput}`;\n if ([\"https://app.jscdn.io\"].includes(data)) res.set(\"Access-Control-Allow-Origin\", data);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-942"], "category": "corsmisconfig", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:corsmisconfig", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9671947989fdba7eca57e5773ba865d12833483da3351e78a4d3999a9070f2e9", "structural_hash": "b7b8d7ce4cb1bf1698780e303bc2c1d04a5f1c2ad7c29b6b409a90e7161a88b3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_03361.js", "upstream_id": "BenchmarkTest03361", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-custom-header\"] || \"\";\n const parts = [];\n for (const token of String(userInput).split(',')) { parts.push(token); }\n const data = parts.join(',');\n if (!ctx.session || !ctx.session.user) { ctx.status = 401; ctx.body = {error: \"unauthorized\"}; return; }\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n ctx.body = { listing: entries }; return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed5d7da2fd664acb76524de2e37604ad165b3a272e00dccbbd8c432293672f15", "structural_hash": "99a821c612bbd52310f5b4c6c4f61fed76bab62f03753aab5ac62e132b2a2da3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04063.py", "upstream_id": "BenchmarkTest04063", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n referer_value = request.headers.get('Referer', '')\n data = ' '.join(str(referer_value).split(' '))\n if len(str(data)) > 8192:\n return jsonify({'error': 'Internal error'}), 400\n return jsonify({'error': 'An internal error occurred'}), 500", "label": 0, "cwe": ["CWE-200"], "category": "infodisclosure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6db85be0049d68ddb409acc4312e9651e52ccc6eb953afe7c5b60486fba3c83", "structural_hash": "870baf26e0a1d3e899681e86b4433db04b0a1768a5b2d2266566662715d8c102", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01902.cpp", "upstream_id": "BenchmarkTest01902", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"MULTIPART_FIELD\");\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 _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e29796005321a6f0dfa93a81ea672688a9b6d08ba7089f63a5d88e52414ff75f", "structural_hash": "93025439760c4fc782c8a420f53f9f468b0172c5608e6805a222cc3d3f585794", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03679.cpp", "upstream_id": "BenchmarkTest03679", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_own(const std::string &s) { return std::string(s.begin(), s.end()); }\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"API_RESPONSE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_own(user_input);\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2bd84c4f83103e576c21f3813784cf01d77ac8f3f7e8ecc55ff0cf69b83299c", "structural_hash": "87777ce69de5bafefad2dbc7966e100e275a7e1874ae55f748e96d3de665d5c1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01320.java", "upstream_id": "BenchmarkTest01320", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\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(authHeader);\n String data = normalizer.apply(authHeader);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a890caaad723db606aae98978c087cb5cb9670efe39ab0bc9d6fe2c17560c0d", "structural_hash": "417d7433369e86d0a29d14aca4698ac0960e1ae8b7b4f8ffefa4cb4f9a5bf4ad", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01496.cpp", "upstream_id": "BenchmarkTest01496", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8578b7657ddd2093a8e0ec06febf8695252d2ee40372b97c8bf37a8c656abd19", "structural_hash": "0ee3dcd4774662516b33e8a8bb24e89e96aec95b2d930e773750149e4bdb76af", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15596.c", "upstream_id": "BenchmarkTest15596", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7d8c7817f97453175b1f5516f2fa10843da2cc95bed65167ef832d5df561e11", "structural_hash": "bf3c4ec887e7c6dab4fbf8eefd4d7b1ee9e562b4351383c7d28b458f65df2e12", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11681.sh", "upstream_id": "BenchmarkTest11681", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n if [[ \"$data\" =~ ^(read|write|admin)$ ]]; then\n echo \"granted: $data\" >> /var/log/auth.audit\n exit 0\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-284"], "category": "improper_access_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05603aafde346949cb0f7c580b2a697d03ac25dca12d0e4463bcc521f0a3fe93", "structural_hash": "224a11491da824bed6762b619bbb2669475bb434fe3ea928925f4ce63223ed96", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03470.ts", "upstream_id": "BenchmarkTest03470", "language": "typescript", "code": "import { Controller, Param, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case/:id\")\n async benchmark_case(@Param(\"id\") pathId: string): Promise {\n const userInput = pathId;\n const _mod = await import(\"./shared.mjs\");\n const data: string = _mod.passthrough(userInput);\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69c314fcd93d548a86591a415b023777730f21b421a655cc29cb00690b19583b", "structural_hash": "e356f7f103e7d8960147f618d102254daf58b194756ed79cef71367d0c67e52b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01165.cpp", "upstream_id": "BenchmarkTest01165", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input + std::string(\"?ref=bench\");\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "024e25b7b2cc9bc338e4f39c7acba8c4436526ebd973cd38f23032dd5bd3f581", "structural_hash": "d68cfe8c465a475cabe4f9d012d4c220ccaaa81f66b764c362c86701c4129b37", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08261.sh", "upstream_id": "BenchmarkTest08261", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n printf \"%s\" \"$data\" | openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:oaep -pubin -inkey /etc/app/rsa_pub.pem -out /dev/null 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe944852d6c4846398f4863839e3eb5d7fc27624d09b0fcdb0de6e4b426f5f01", "structural_hash": "809e2e7022482325512ea536419be5c3899b11bad8656b35fb87729b481a843e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00604.rs", "upstream_id": "BenchmarkTest00604", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let _prefix: String = upload_name.chars().next().map(|c| c.to_lowercase().to_string()).unwrap_or_default();\n let data = match _prefix.as_str() {\n \"h\" => upload_name.to_lowercase(),\n \"f\" => upload_name.to_uppercase(),\n _ => upload_name.trim().to_string(),\n };\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a14bd1db433bef7bd33caf378d283f45a99a08a783cacb89d73febe0bfb3acb3", "structural_hash": "b1693a31361095d0a080bbf4d7d4b7f3cd187f40b29dd2ca12204c31a260bea2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_00351.js", "upstream_id": "BenchmarkTest00351", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const role = String(data);\n if (role === 'admin') { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-425"], "category": "forced_browsing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7a299a466ba57068bcdf6372831c4f09b585aa3839a22cca4489d9edfda5bf2c", "structural_hash": "b505e70779360a796968ff263ffb9ad4dcbda979b7fba3c6c0a29fd531c0e13e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_02756.go", "upstream_id": "BenchmarkTest02756", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\tunpack := func(v string) (string, string) { return v, \"http\" }\n\tdata, _ := unpack(forwardedIP)\n\tif !validSchemaPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"sh\", \"-c\", \"echo \"+processed)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-77"], "category": "genericcmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ac071c20856d6f5352ba6b691f4a5aa369f071cd04d46f3f60a9d87ac5c3fde", "structural_hash": "c34291d90bd62b547ce779c4ed709801295a58b2d17146878173cbe0d19ed997", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00997.ts", "upstream_id": "BenchmarkTest00997", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "827dc84ed7fba3b3d5bc94196a6e384ce3d3951ff5a359c6205e14ec73ffbf01", "structural_hash": "1184cef64cac39097474d39219c3eb60e5f6e8098ebc8436543e53b7cb13d50b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_22681.js", "upstream_id": "BenchmarkTest22681", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n function normalize(value) { return value; }\n const data = normalize(userInput);\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) { res.status(500).json({error: \"privilege drop failed\"}); return; }\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c3c0447df5126df2d4be4adeb9c5667764f336624807a2f340c0bcfc5bc92e0", "structural_hash": "6f9bddc4a98f7c95c2ff22adce6840809b483de54d11b6af5ea3ddca0951deb2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00600.java", "upstream_id": "BenchmarkTest00600", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n String data = normalize(authHeader);\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b3d77554c113af6c833d5c69b85993336fd10683ae8fe90107e3b6a8de7ce792", "structural_hash": "7bd63356217349004676a13656fc9039a77ab957f07c4470c51cdd637dc18315", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_01708.rb", "upstream_id": "BenchmarkTest01708", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_AUTHORIZATION\"].to_s\n data = [user_input].pack(\"H*\").force_encoding(\"UTF-8\") rescue user_input\n if %w[read write admin].include?(data.to_s)\n halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "41052584d4c7e4307d2ca1e76ed6fded421f5e36fa0434d2ce595392c8f22dda", "structural_hash": "ccec643729275ed2bcb6dcd81232ae622751258778ee338f6671230ba7ccb26a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01456.java", "upstream_id": "BenchmarkTest01456", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n java.util.function.Function transform = v -> v.strip().replaceAll(\"[ \\\\t]+\", \" \");\n String data = transform.apply(jsonValue);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9c91534729b833f13f624cf40a8e49bcdfc9581eeffc0e62888d5df298402cad", "structural_hash": "de0fd1b66dc6a063e8cd9fe1709db01938f4632589f79f3258a41342345a62c4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03395.sh", "upstream_id": "BenchmarkTest03395", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n data=\"\"\n while IFS= read -r line || [ -n \"$line\" ]; do data+=\"$line\"$'\\n'; done <<< \"$user_input\"\n data=\"${data%$'\\n'}\"\n trap 'echo \"error at line $LINENO\" >&2; exit 1' ERR\n echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-755"], "category": "improper_exception", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:fail_open", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "79500ee235d13821ca9d972ef9fd75a0ad437c58ec21c082d916dae644e4bbcf", "structural_hash": "0189b630c66568e930345fb425ad350fcb79ee751a6a73d0b5fa1065facbaf1d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04790.py", "upstream_id": "BenchmarkTest04790", "language": "python", "code": "from flask import Flask, make_response\nfrom flask import request, jsonify\nclass RequestPayload:\n def __init__(self, raw):\n self._raw = raw\n @property\n def value(self):\n return self._raw if self._raw is not None else ''\napp = Flask(__name__)\napp.secret_key = 'benchmark-secret-key'\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n user_id = request.args.get('id', '')\n data = RequestPayload(user_id).value\n resp = make_response(jsonify({'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:flask:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e8ef191679fe0fe7b15bc399f120abdeabd0b5dcb4b566cf3e1e8144c6314c77", "structural_hash": "1c16ca98fad11f1d0aa66dce7cd0ad654632eda47fdfeaa2cd9a71a249344ef5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03325.py", "upstream_id": "BenchmarkTest03325", "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 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 secret = db.fetch_one('SELECT secret FROM vault WHERE owner = ?', (str(data),))\n return JSONResponse({'secret': str(secret)}, status_code=200)", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "44696880254219c47cd7d9d13890ef6a7a954dbffc0cb060d437510383e910ae", "structural_hash": "9c2f6498f2232ad54c29c296e250cc3978273226da89ad84e20f958a465e5347", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_37811.go", "upstream_id": "BenchmarkTest37811", "language": "go", "code": "package testcode\nimport (\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\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\t_handlers := map[string]func(){\"primary\": func() {\n\t\tos.WriteFile(\"/var/app/data/\"+data, []byte(\"data\"), 0644)\n\t}}\n\t_handlers[\"primary\"]()\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7521a82ec73176de4b802862f0c04340e755720dca24723c4e5909d8ef353520", "structural_hash": "755b17141b30fea37ef41e506279952e592a2d9b5bdc423f28ea3f308cec807f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_02937.py", "upstream_id": "BenchmarkTest02937", "language": "python", "code": "from starlette.middleware.sessions import SessionMiddleware\nfrom fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nfrom app_runtime import auth_check\napp = FastAPI()\napp.add_middleware(SessionMiddleware, secret_key='benchmark-secret-key')\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = (lambda v: v.strip())(upload_name)\n if not auth_check(str(data), request.session.get('token')):\n return JSONResponse({'error': 'unauthorized'}, status_code=401)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-306"], "category": "missingcritauthn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e741e4dd10399ae5f8ce5a08f6a04022eb7f463a93a8007f5da850c4737f669", "structural_hash": "6731eff694a0a42df40cad12595d3469160ed5a4cae535822a95fcc5baef6bc0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05119.ts", "upstream_id": "BenchmarkTest05119", "language": "typescript", "code": "import { Body, Controller, Post, UsePipes, ValidationPipe, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\nimport { IsString } from \"class-validator\";\nclass UserInputDto {\n @IsString()\n payload!: string;\n}\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n @UsePipes(new ValidationPipe())\n async benchmark_case(@Body() dto: UserInputDto): Promise {\n const userInput = dto.payload;\n const _raw = userInput;\n const data = (_raw && _raw.length > 0) ? _raw : 'default';\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8728872ead4825386c6224787833f8d1c635dea48dffdefb48a494231a431be4", "structural_hash": "6aa9068780227e2eec92bdd84383c78225247b1ab23cf8560b8d01b3d971a2d9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02158.php", "upstream_id": "BenchmarkTest02158", "language": "php", "code": "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 posix_setuid((int)$processed);\n return new JsonResponse(['result' => 'ok'], 200);\n }\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bed1daee5a4cb30043e35fdafc0ee15de009778c0d42b7078835cd274c49a131", "structural_hash": "192da9cb8941f45b33009c34f8e58b0c6079c629a88bea0e933850cf72c12a18", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05248.rs", "upstream_id": "BenchmarkTest05248", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let data = upload_name.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 crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cd5f7e047c9fc263e7688e416fdd2127efa6ba7d0482e6a19726530635cfe55", "structural_hash": "5ed805f8aa884036281b355f90f9fcffb1ebd464f9654b32c57a5352db012624", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00940.ts", "upstream_id": "BenchmarkTest00940", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "08e39c9d7d9c5faf95a7d8992a58346a88be77bc677f41265005bd81f64a6d6c", "structural_hash": "220405e52ccded632f1409200ffd34ba424067de9d1b9cdc8d9150b57cf6c87a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03875.php", "upstream_id": "BenchmarkTest03875", "language": "php", "code": "request->get('field', '');\n $data = sprintf('%s', $userInput);\n file_put_contents('/var/data/output', (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "80c7d18d94e4ef8d8b93017e85e8607ae9acaa2a9f7ef98e38ef5b107d778396", "structural_hash": "23ecada996cc2680cdec9329126dbe218507da177778da6a5a7d5321e2bc694a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09897.go", "upstream_id": "BenchmarkTest09897", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"log\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar reqBody struct {\n\t\tPayload string `json:\"payload\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&reqBody); err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tjsonValue := reqBody.Payload\n\tcapture := func() string { return jsonValue }\n\tdata := capture()\n\tlog.Printf(\"User action: %s\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "894bf6f25dcc74f4af1503c0081d98562e5e86cf3dcb21c3def1201e69599810", "structural_hash": "176bf17636ce6d388e4ce93633bd16ed82a4550faf817203490c1cdea109b53d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_16978.go", "upstream_id": "BenchmarkTest16978", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tqueryArray := strings.Join(r.URL.Query()[\"items\"], \",\")\n\tform := FormData{Payload: queryArray}\n\tdata := form.Payload\n\tlog.Printf(\"User action: %s\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-598"], "category": "sensitive_in_get", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d9fe7c76297ada44eb167bf717d668d9dc0fbe915487e2b339bdf63aa2d2205", "structural_hash": "93a01f603ba29228bfa062a9c1337afafd58b7901ec8bdd7dbd9a807d753190f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21648.c", "upstream_id": "BenchmarkTest21648", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n c_shared_input = user_input;\n const char *data = c_shared_input;\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c16dab3b9d82147d4caaf897a200f9ce742803af06b391f7ba624995339f2463", "structural_hash": "de328261d6b7e08dfd86d51ebc3747c01b676ec2c6e931ed99d55f6fa7ba02d8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21762.c", "upstream_id": "BenchmarkTest21762", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_payload { const char *value; };\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n struct c_payload _pd;\n _pd.value = user_input;\n const char *data = _pd.value;\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "24274083e5ffad04390375daf5148201ef2871ee0c7607dd0efcbb1c357cfbbf", "structural_hash": "3bb5127877e7b34992ba0e2825c7cd6f2e52b5b284cbf58b6a6116687ab687b9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_08809.js", "upstream_id": "BenchmarkTest08809", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT text FROM comments WHERE post_id = ?\", [1])).rows[0].text;\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.status(500).json({ error: data, stack: new Error().stack }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-497"], "category": "system_info_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b6f51639549e972ebfa46df5e513a4b97e41ef9faa415616a2f47aff7fa75ac0", "structural_hash": "4076977c64a4ee83189764967ba803e303de997fbf5d8e0f638b4927b147c908", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02520.ts", "upstream_id": "BenchmarkTest02520", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as nodeUtil from \"util\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(): Promise {\n const userInput = process.env.USER_INPUT || \"\";\n const data = nodeUtil.format(\"%s\", userInput);\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a418a171defe175f3c5ad631892d1608e5b2efd7046f9a3dea2ad06cf91dc80", "structural_hash": "f400854eb9ca7477e7db398f960949f5b0e510770136c6b98203990e629917c6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04708.java", "upstream_id": "BenchmarkTest04708", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data;\n try { data = new String(java.util.Base64.getDecoder().decode(cookieValue), java.nio.charset.StandardCharsets.UTF_8); }\n catch (IllegalArgumentException base64Ex) { data = cookieValue; }\n response.addCookie(new Cookie(\"session\", data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0fd4a0f63d3a53ea920a8a1a37308c35f75925390f0908b33ceaaca3d20abb09", "structural_hash": "5a6e64bd66121d0e32c26ca9891307340e5b37d963fb70e62c9ec55502ce7ae0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00414.rs", "upstream_id": "BenchmarkTest00414", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let mut data = String::new();\n data.push_str(&json_value);\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6090df5aa3573939060c64185a42dce8a6b28d9d39bdcf44b0d7f3efd65d05e2", "structural_hash": "04689ca1d18ce7a0b0872bf18f7aa9cbd5abaa84260f95a71398b6bf01ccc00f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03874.rb", "upstream_id": "BenchmarkTest03874", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = JSON.parse(request.body.read).dig(\"variables\", \"input\").to_s rescue \"\"\n q = Queue.new\n producer = Thread.new { q.push(user_input.to_s.strip) }\n data = q.pop\n producer.join\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "016da7146b3802d468610c70da728dfff2190ef282a2158e181618651a2b18ac", "structural_hash": "ba3c83642287e4a0f7b1166a3567e86f2abd5818bca6c0160efdce184916c984", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_16553.js", "upstream_id": "BenchmarkTest16553", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n function normalize(value) { return value; }\n const data = normalize(userInput);\n db.query(\"SELECT * FROM users WHERE id = '\" + data + \"'\");\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "46241a6a9f05699248c16ed222bf1a526baa462c40704182498d721128778f9e", "structural_hash": "ea10b4694e1b77834e8d14084e2bd541e2858244458d375a1976f5b03e7e4648", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01127.rs", "upstream_id": "BenchmarkTest01127", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let json_value = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"payload\").and_then(|p| p.as_str()).map(|s| s.to_string())).unwrap_or_default();\n let data = 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::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bdcdb76ef9911cd607ca8bee881862a2e8e6cbfa0a9e974b64931b964317e50", "structural_hash": "c47baf9518f552fbc65fddb8e96b5b25e1075a42f77ee9bc4cda3a90b48dae41", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02634.java", "upstream_id": "BenchmarkTest02634", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n java.util.function.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(envValue);\n String data = normalizer.apply(envValue);\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4c64973399277dab25af2b6f278ce22a7b0b7de2f4b4c3a6efdcded456a20089", "structural_hash": "e206d3cbe7f414bca6f229d2430ca07722f39498a223b38fc4cbae74acb7ea41", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_11754.go", "upstream_id": "BenchmarkTest11754", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tstoreCred := os.Getenv(\"CONFIG_SECRET\")\n\tif storeCred == \"\" {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tRespondJSON(w, http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 0, "cwe": ["CWE-798"], "category": "hardcodedcreds", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6bd2ae719cef2b0a82116bb9b96b85d9451ff7c624672bd9f50d10a5d612e1c1", "structural_hash": "3940f87e21d322e32fa1faa5a30992c6384c9c3e6e42cdb37d8d9323cb69b753", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_05122.go", "upstream_id": "BenchmarkTest05122", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tdata := strings.Join(strings.Fields(pathValue), \" \")\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5a92c8c68ef685bbee04ad353b171d08de78039d1458bd365cc5f944e211ea53", "structural_hash": "15a90e487a024b9105f2dc48cf28691d7a06bc10d28de4a32e842bf8c2db109f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01021.cpp", "upstream_id": "BenchmarkTest01021", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6625068d8579a65aaa0c4a74fa33e6522557585937355979568f88ad04650109", "structural_hash": "1dd22947af27edb4a60c879c5aa0281592a67232be1fea4ffb948585e449ace9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_08561.go", "upstream_id": "BenchmarkTest08561", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os/exec\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tsegments := strings.Split(userID, \",\")\n\tdata := strings.Join(segments, \" \")\n\tif !validInputPat.MatchString(data) {\n\t\tc.String(http.StatusBadRequest, \"invalid input\")\n\t\treturn\n\t}\n\tprocessed := data\n\tcmd := exec.Command(\"python3\", \"-c\", processed)\n\toutput, _ := cmd.CombinedOutput()\n\tc.Data(200, \"text/plain\", output)\n}", "label": 0, "cwe": ["CWE-78"], "category": "cmdi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4db624e9579dd978056cee860f75f0689dbfb82c0a51ba0fc2162a30454771ad", "structural_hash": "ac33434c86a4c78a45ce4b61aa268afa8d4aed11b620ff806b273e2997672759", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01241.cpp", "upstream_id": "BenchmarkTest01241", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n 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 _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7dd10d0c798e2931e7e76b27cd09097c260a4a66fe01555c2f2f18f897154827", "structural_hash": "17c2e244a0b7ba7363e263464c83a433ec3b9f268f95667da43fc665a764e3dc", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05535.java", "upstream_id": "BenchmarkTest05535", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = \"\" + multipartValue;\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a9de62970f6ac3a3899a30b83d2f442b63439a63f467837447b76b436ba8a7e", "structural_hash": "e36d7c4833107e398ebf4a74ff26b0bd8dfe874097de529f024e9deaa56bcf6d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01319.ts", "upstream_id": "BenchmarkTest01319", "language": "typescript", "code": "import { Controller, Post, Req, BadRequestException } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4795dc697fd18bac6f2b73ff29e924924dceecfdcd81d704d95f144b4bce8ac9", "structural_hash": "d4c7799fcca7930030baca7b4afdf4b573c32eb26e2ded624298925a8f0d46c2", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06318.go", "upstream_id": "BenchmarkTest06318", "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\theaderValue := r.Header.Get(\"X-Custom-Header\")\n\thexBytes, _ := hex.DecodeString(headerValue)\n\tdata := string(hexBytes)\n\tos.Setenv(\"APP_USER_PREFERENCE\", data)\n\tw.Header().Set(\"X-Config-Set\", \"APP_USER_PREFERENCE\")\n}", "label": 1, "cwe": ["CWE-15"], "category": "external_config_control", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_config_control", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf8f599d48fd80ce44280929d41bc2148aa7b3d18e8731ad9b30de9e04f3ceff", "structural_hash": "bd2d59237bb8e8e1aa0f0f1dc963ca793bfef13bea0fa360247d9173d509b11a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00147.py", "upstream_id": "BenchmarkTest00147", "language": "python", "code": "from django.http import JsonResponse\nimport re\ndef benchmark_case(request):\n cookie_value = request.COOKIES.get('session_token', '')\n data = f'{cookie_value!s}'\n if not re.fullmatch(r'[a-zA-Z0-9_-]+', data):\n return JsonResponse({'error': 'forbidden'}, status=400)\n processed = data\n trusted_claim = str(processed)\n return JsonResponse({'trusted': trusted_claim}, status=200)", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d16b6e94ca9b92631d3a3d2d238c2260e395348d967455e7858e986c4a1a0e76", "structural_hash": "cb74f23be31e61430d0525cc5ff40bef2706717eb9b4e95e3e8124b04400b260", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05758.sh", "upstream_id": "BenchmarkTest05758", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_HOST\"\n data=$(IFS=\",\"; read -ra _items <<< \"$user_input\"; printf \"%s\" \"${_items[*]}\")\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n if ! grep -qxF -- \"$USER:$data\" /etc/app/acl; then\n echo \"403 forbidden\" >&2\n exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-283"], "category": "unverified_ownership", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e0092e7953b7e1a7059cad48a1297f668485a3f03d2a34d7b4fc449c02baf14", "structural_hash": "d8941738db22c71e1b3f82254dd101b777384d5b5d8c8815baf701514baa50fd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03526.ts", "upstream_id": "BenchmarkTest03526", "language": "typescript", "code": "import { Controller, Post, Query, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Query(\"id\") id: string): Promise {\n const userInput = id || \"\";\n const data = `${userInput}`;\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dbd8c0d57a9caec03c799a45c4e344ea3e353c474ed71b5193e8b72218d3571d", "structural_hash": "0d5157296c6edb02e4049fa3f2d3f7b1920d3fe144365ef3ba4fd3f445b5462a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01734.c", "upstream_id": "BenchmarkTest01734", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstruct c_ctx { const char *captured; };\nstatic const char *c_capture(const struct c_ctx *c) { return c->captured; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n if (fgets(user_input_buf, sizeof(user_input_buf), stdin) == NULL) user_input_buf[0] = '\\0';\n user_input_buf[strcspn(user_input_buf, \"\\n\")] = '\\0';\n const char *user_input = user_input_buf;\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b57d13636d8ca225b92a2587611ee099e2b6ef953efb2ba02e1e2168b9da9499", "structural_hash": "a2432b5e5e0ed1561571143fb55d0cda2ef157d764c5413ef637012720230413", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00802.cpp", "upstream_id": "BenchmarkTest00802", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"UPLOAD_FILENAME\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input + std::string(\"?trace=v\");\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bdfdf97cbc12f0615183492ac55bf2c5461508b5b730893f7bb7a5729e25342c", "structural_hash": "84715f09bed7d960f4982d739a5355d45d721bba2e95ca6318088b0d3969b126", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_07295.js", "upstream_id": "BenchmarkTest07295", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers[\"x-forwarded-for\"] || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const _h = crypto.createHash(\"sha256\").update(String(data)).digest(\"hex\");\n const _adminHash = String((ctx.session && ctx.session.adminHash) || \"\");\n if (_h.length === _adminHash.length && crypto.timingSafeEqual(Buffer.from(_h), Buffer.from(_adminHash))) { ctx.body = {role: \"admin\"}; return; }\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-303"], "category": "incorrect_auth_algo", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f06bed7703eeae2b954a39d65f51aec3b7a70289097ec14f2ed29326eeb5a2fd", "structural_hash": "036da0360e2393dcb55d69fca1910640406f26ad9c46bc2131ebcd69974a0a89", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_10472.js", "upstream_id": "BenchmarkTest10472", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const pending = String(userInput).split(',');\n const collected = [];\n while (pending.length) { collected.push(pending.shift()); }\n const data = collected.join(',');\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "52fc46804e80d615734f60c89203ebf648bd5d8818c7ba1c515a9a3bb10201fb", "structural_hash": "4d8770bf8cb8ba86d3bd1e4f0f38f5fcad8f287706c66f70d71ee15f04080f98", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_18263.js", "upstream_id": "BenchmarkTest18263", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = ctx.request.headers.authorization || \"\";\n const data = userInput != null ? userInput : '';\n const row = db.querySync(\"SELECT id, name FROM users\").find((r) => r.name === String(data));\n const value = row.name;\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-476"], "category": "null_deref", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:null_deref", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3505debfb8970cb98dc8618492303f32a7a76afb0a3cf3c639a2418d7fb2872d", "structural_hash": "10b7fe737fd488b0e4fa6c7ac1de37010c7b06c585d0128f7673836ee5646913", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03658.rs", "upstream_id": "BenchmarkTest03658", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n let captured = upload_name.clone();\n let reader = move || captured.trim().to_string();\n let data = reader();\n if data == \"admin\" || data == \"write\" {\n crate::shared::store_session(\"granted_role\", &data);\n return (StatusCode::OK, \"\").into_response();\n }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31d2e3c9e45faf79e7d79c94688cc8a3d1cda18625350e4a41451251a0557e80", "structural_hash": "5e70fe84175b95bcc19a05417acf02bbe9460ce9a4579491bb763d20799e2946", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10292.sh", "upstream_id": "BenchmarkTest10292", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n case \"$data\" in localhost|internal-gateway) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-940"], "category": "unverified_comm_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "25fee994480d568625f84d4fbbf9d024de5784e8037c9d876de2af776ac12132", "structural_hash": "a200e3a541a6a5fbd57b22ab2e2723dcf44563e545dc39e1530befe7df5389d3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_21400.sh", "upstream_id": "BenchmarkTest21400", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.variables.input // empty' 2>/dev/null)\"\n mapfile -t _mapped < <(printf \"%s\\n\" \"${user_input}\")\n data=\"${_mapped[0]}\"\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n case \"$data\" in admin|true|authenticated) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-602"], "category": "client_side_security", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0116ee2eeff26935ab6301563e5a635dfedad73bf16545d2a586bd34465a2e51", "structural_hash": "9b0c431cd757da5cc1d4320584afe22c45406f4fbd48b31c32ebaa4e98e36f1e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_00258.ts", "upstream_id": "BenchmarkTest00258", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const formData = Object.freeze({ payload: userInput });\n const data = formData.payload;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1f5c933fe5c225d1083af919c8b65f878764135c6c0316cf418006bd8460654b", "structural_hash": "6e2db01c172e90813c1415d839119141a8e2e7911e775c7f918bda59814c5045", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03851.cpp", "upstream_id": "BenchmarkTest03851", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_ORIGIN\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "499612381367e0e3409e79edba558e6120869f25623565440a3e66b4147f1215", "structural_hash": "84559fd808f5f01332c91642fb88d3e122badffc94529afded160ee4c2c89238", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01198.ts", "upstream_id": "BenchmarkTest01198", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c2490f7a40430d8f1833ecf59b8604bf6bb721907eb639745770944ff531746a", "structural_hash": "c308398fed9a2ce0ff418200d4aead0b778da8fc9924fe4e93ed7d6100317900", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_11043.js", "upstream_id": "BenchmarkTest11043", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const data = String(userInput).slice(0, 200);\n require(\"./shared\").iam.putRolePolicy(\"app-service-role\", \"inline\", String(data));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-269"], "category": "cloud_iam_write", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:cloud_iam_write", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5189a707b623d13992efd48e395e928602f4563f1c80c61db53bc7044b1d59e9", "structural_hash": "dbe0f23c0b27cf8dc45070c3a003564a9612a396e16e7e04ca20d24907dc3a99", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_04711.py", "upstream_id": "BenchmarkTest04711", "language": "python", "code": "import requests\nfrom urllib.parse import urlparse\nimport ipaddress\nimport socket\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n data = '{}'.format(xml_value)\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 jsonify({'error': 'metadata endpoint blocked'}), 403\n target_url = str(data).replace(parsed.hostname, resolved) if parsed.hostname else str(data)\n requests.get(str(target_url))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "31213862990ab1372a03dc091c99d0901dc2c7647405625be1909407efaccb2f", "structural_hash": "8cbd8e1b8e2ca8e73fb4b3deec5afec1fcafa1da3578dd40f231410276327d35", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_30666.go", "upstream_id": "BenchmarkTest30666", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/antchfx/xmlquery\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tdata := rawBody\n\tif _, after, ok := strings.Cut(rawBody, \",\"); ok {\n\t\tdata = after\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\txmlDoc, xmlErr := xmlquery.Parse(strings.NewReader(\"\"))\n\tif xmlErr != nil {\n\t\thttp.Error(w, xmlErr.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\txmlquery.FindOne(xmlDoc, \"//user[@name='\"+processed+\"']\")\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9434ad80332430f57e6f2461ff7bf9529b07d4004a063f39eed0887217d4a92", "structural_hash": "719ad19a0365c2154ede22b03b367f77b68f650e782016daf19d610e5b45f743", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_27848.sh", "upstream_id": "BenchmarkTest27848", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(mysql -N -e 'SELECT name FROM users LIMIT 1')\"\n printf -v data \"%s\" \"${user_input}\"\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n if [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1390"], "category": "weak_auth_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc23bdf94d48904daf45af8068e93b053f35f00f10e783fbb4c936f45f9f3b60", "structural_hash": "129d0f070d6d678226a490f39044fed56b0ff1a31d9fb6906af9375bf44b6aea", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02664.cpp", "upstream_id": "BenchmarkTest02664", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e3209342a63ce8f83f76bd86549d73212e1e30fb161361bfa2109993ae85690", "structural_hash": "a1920cf49ba232fab3ade68cf09ce1a10d66b607a9d2b7e68698caee92c279e8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09279.c", "upstream_id": "BenchmarkTest09279", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"uploads/%s\", user_input);\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "87c35d3aba6bf3b5f250e0046b91324afa1151b12b58709600cbcf0f49e53d27", "structural_hash": "62fa5deb0e0e653875fdb2a7d0d157a79296e0f8c4fb32a3745a2bae51dd1e56", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_23577.js", "upstream_id": "BenchmarkTest23577", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n globalThis.lastRequestValue = userInput;\n const data = globalThis.lastRequestValue;\n const _sk = crypto.createHash(\"sha256\").update(process.env.DATA_ENC_KEY || \"\").digest();\n const _siv = crypto.randomBytes(12);\n const _scipher = crypto.createCipheriv(\"aes-256-gcm\", _sk, _siv);\n const _sct = Buffer.concat([_scipher.update(String(data), \"utf8\"), _scipher.final()]);\n const _stag = _scipher.getAuthTag();\n fs.writeFileSync(\"/var/data/cipher.bin\", Buffer.concat([_siv, _stag, _sct]));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-325"], "category": "missing_crypto_step", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e6e12222462bcd1a77bb6773bfca493c7a48a198fc44bad5d85a9a60f2443926", "structural_hash": "3f4074aa2c24138c073822a51513229156c3f8214c7e912c79dd9e3e3b7ebd9f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03918.rb", "upstream_id": "BenchmarkTest03918", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n Process::Sys.setuid(65534)\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "96968a21cf23b63194a02aad25147d19656a15ec560aded67f75124bd09b32e6", "structural_hash": "d61bfa4f5daa0b6ee41abefb74493880cf46a0369a9a75a1cc3667374d095e82", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_03320.py", "upstream_id": "BenchmarkTest03320", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\ndef to_text(value):\n return str(value).strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n upload_name = getattr((await request.form()).get('upload'), 'filename', '')\n data = to_text(upload_name)\n processed = re.sub(r'[A-Za-z0-9]{4,}', '****', str(data).replace('\\r', '').replace('\\n', ''))\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Content-Language': str(processed)})", "label": 0, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bef8e1f578fa782eecfd86ebe8cb0e9f4415c15cf0ddc60dcc8d3f0abed74bb9", "structural_hash": "d224d7ab0bdab14f38089adaba791d28f286d33bf0d32fdcd55497dc3aca717a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_01290.py", "upstream_id": "BenchmarkTest01290", "language": "python", "code": "from django.http import JsonResponse\nimport requests\nfrom app_runtime import db\ndef benchmark_case(request):\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = ' '.join(str(db_value).split(' '))\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-347"], "category": "unverified_signature", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2082d6e63f34204e47860539212d664f323dfff0e78005b05a2283c6868d2447", "structural_hash": "bbc2cb472ecb6a27578b70f278764dd3a5c9e11189e1bf7d9e888ff2330d887a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02377.c", "upstream_id": "BenchmarkTest02377", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"QUERY_STRING\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ffb7da733f8b60b605b0cf89715c43cdac32330f0865feef11f712ba424f15be", "structural_hash": "be9c77f2c753190a4e7f381b2a60ce3c13185e532ead79b0086b69b519ab146e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00819.rb", "upstream_id": "BenchmarkTest00819", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = ENV[\"USER_INPUT\"] || \"\"\n on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n cookies[:session] = data\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0d3acc6449f41297869fd1fc254d3533d8c1a1d470ab8a2c8d52351083adab63", "structural_hash": "01ca4795cd9d10f1b91e22c0360d98c2283f228f5e6c0d1a70113c3f08afa15a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00445.java", "upstream_id": "BenchmarkTest00445", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport jakarta.validation.Valid;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static class UserInput {\n @jakarta.validation.constraints.NotNull\n public String payload;\n public UserInput() {}\n public UserInput(String payload) { this.payload = payload; }\n }\n private static String stripWhitespace(String v) { return v.strip(); }\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@Valid @RequestBody UserInput req, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String jsonValue = req.payload;\n String data = stripWhitespace(jsonValue);\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "14d15e2bc2c97d20e032570d2b0ba694038e5b8b86f62b09813daf26867b9f2c", "structural_hash": "b0056e2f2e5fed992486fb108c55fa80dc836f1f9bc496a3920bbfa8044aabbe", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15488.js", "upstream_id": "BenchmarkTest15488", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n try { if (typeof process.setuid === 'function') { process.setuid(parseInt(data, 10)); } } catch (e) {}\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-280"], "category": "improper_priv_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:improper_priv_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "032dda6e186ccacbba7e0a056712285c5c8748bda15ba5a95920b0b570e99afb", "structural_hash": "a6f0501e9d6406dfd984ada6907628a9e67c2b1db287e01247d93af8facbe622", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03967.ts", "upstream_id": "BenchmarkTest03967", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-custom-header\") hdr: string): Promise {\n const userInput = hdr || \"\";\n const data = String(userInput).slice(0, 200);\n const processed = [\"true\", \"1\", \"yes\", \"on\"].includes(String(data).toLowerCase()) ? \"true\" : \"false\";\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a700c040aa1041e93636fe1263b6bf384856a0e094f77737dadd48e15f28390f", "structural_hash": "05dc277489938027c1192b5fc000fc6359fb3aec300d7d2b70705b0d74dcaa35", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05368.php", "upstream_id": "BenchmarkTest05368", "language": "php", "code": "getContent(), true)['payload'] ?? '';\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n file_put_contents('/var/data/output', (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ae9872b0313fe3ca6805ebb73de7a6834a3e44430e7cb46acf4f4b2b8467e6d9", "structural_hash": "e501226402187a8f47cb256f393279f30d652d1bac9c48c1001e9c25448f5d90", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_01721.rs", "upstream_id": "BenchmarkTest01721", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n fn call_with(input: String, on_input: impl Fn(String) -> String) -> String { on_input(input) }\n let data = call_with(comment_value.clone(), |s| s.trim().to_string());\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e7ed9887954f4cd29964a9e3297e5491d133c3dbe12a2491ba77f3ab0916482", "structural_hash": "082cbe6a12312cca8f5b473612265ffb4ac826732469ae6f956590150cb57996", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_01943.js", "upstream_id": "BenchmarkTest01943", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.cookies.session_token || \"\";\n function normalize(value) { return value; }\n const data = normalize(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 res.json({ done: 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:express:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3b7bb2ff369d77e02eb352de92490d2c37702e04941f741c41fcdb73f7d44482", "structural_hash": "d84e832873626fd0dc3a98bc382b00e618610c41794db27d3f068c787563eaf5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01373.php", "upstream_id": "BenchmarkTest01373", "language": "php", "code": "request->get('field', '');\n $form = new class($userInput) { public function __construct(public readonly string $payload) {} };\n $data = $form->payload;\n $role = (string) $data;\n if ($role === 'admin') { return new JsonResponse([\"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fbffc78db9c776df5a9f2842c1569ba76751a79f34de610e26061b8d8212d9ab", "structural_hash": "ee01bb22674485a83af13e20ec33dd5a017e93d23a41c02bfa43b8cdb0112be7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_01344.py", "upstream_id": "BenchmarkTest01344", "language": "python", "code": "import requests\nfrom urllib.parse import urlparse\nimport ipaddress\nimport socket\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n host_value = request.headers.get('Host', '')\n parts = str(host_value).split(',')\n data = ','.join(parts)\n parsed = urlparse(data)\n resolved = socket.gethostbyname(parsed.hostname or data)\n if ipaddress.ip_address(resolved).is_private:\n return jsonify({'error': 'private range blocked'}), 403\n target_url = data.replace(parsed.hostname, resolved) if parsed.hostname else data\n requests.get(str(target_url))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-918"], "category": "cloud_ssrf_metadata", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "90767f58fad5b161d6a2eda4095f52c4225967e8039ec03985edc4b9f0389bbe", "structural_hash": "87ad15e91e0de0c7f57033ba3dd94654df2c947c4fb949316f8c898d6416d018", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05237.sh", "upstream_id": "BenchmarkTest05237", "language": "bash", "code": "benchmark_case() {\n user_input=\"$APP_INPUT\"\n coproc _relay { IFS= read -r -d '' _m; printf '%s\\0' \"$_m\"; }\n printf \"%s\\0\" \"$user_input\" >&\"${_relay[1]}\"\n IFS= read -r -d '' data <&\"${_relay[0]}\"\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n case \"$data\" in */public|*/static|*/.) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b9e3dfd708c9ded93d81f84fab955ff55ef51c1585f4d04ab980ad98dbcf2a0", "structural_hash": "89161c4469653a4cf18980acff17b73e34534135b6a5d15c7b8d270c623fe397", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00029.rb", "upstream_id": "BenchmarkTest00029", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.cookies[\"session_token\"].to_s\n data = user_input ? user_input : ''\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7ad432a5677f451933ba751000dc59314000fee73b1d13bfe20013ed2a64ded2", "structural_hash": "2cd9f609be610f83e4346a27247e9b3d09d23687e00575fc15dfb15fb08f695f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02253.rs", "upstream_id": "BenchmarkTest02253", "language": "rust", "code": "use axum::extract::Form;\nuse axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let data = field_value.to_string();\n let _role = data.clone();\n if _role == \"admin\" { return (StatusCode::OK, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "72b6c43c3ae192fb7888888e9870971959c789955c72b3bf81877bcaed6b69e1", "structural_hash": "f08f5d03e19d54e68429e3f5d938c5b687e84e9bc24519a43b77897dee173a0f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01491.cpp", "upstream_id": "BenchmarkTest01491", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"POST_DATA\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68de3e4941e64cca11ab02c7ae5c69803c0327452cf69337bc6459350253b759", "structural_hash": "2d190b1637dd7ea4a428ca42f37fd37ea82fde499661e243817ca262c0e0a8d4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_04667.rb", "upstream_id": "BenchmarkTest04667", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:multipart_data).permit(:multipart_field)[:multipart_field].to_s\n data = \"\" + user_input\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b0428bb4cc379e52f326eafdce45bed7d00e558efbef68e3b52d1253e0f5214", "structural_hash": "569870cdea617cbe2be83df8ba70d0a872cbb69ff8ae4f3beede4a62125d74ac", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02108.py", "upstream_id": "BenchmarkTest02108", "language": "python", "code": "from django.http import JsonResponse\nimport json\nimport requests\ndef benchmark_case(request):\n graphql_var = json.loads(request.body or b'{}').get('variables', {}).get('input', '')\n parts = str(graphql_var).split(',')\n data = ','.join(parts)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dfc5dace592a18647354aa2cd3ffa44608afb042fc2cbd37daa0102060f847ea", "structural_hash": "61ae24337c7ac258c20f35ba4fbe693c4123f7e4acda46613fee56195be85888", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02581.cpp", "upstream_id": "BenchmarkTest02581", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n data.reserve(user_input.size());\n for (char _c : user_input) data.push_back(_c);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89dfd029ed7d5c86db588b8123dd617b5f417f8dbdc6e5069dc8fe6de35f5e65", "structural_hash": "97b52dea3d3ab3cffcf73dab6fa623eb59daa545c1066d2b5ec7ba31463605fe", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_21381.js", "upstream_id": "BenchmarkTest21381", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n res.status(500).json({ error: \"Internal error\" }); return;\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4fb11aecf9062dd18fbbad754161831909e715afc0906f9b8eb1c658f741e4ed", "structural_hash": "e33180eada9fff12743641c449b7eccd3af3ecf2b982315891b3d92e944812c4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_13907.c", "upstream_id": "BenchmarkTest13907", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c37bce1f546949c889677b9b11052270f9633e4e32840edf11920e7affea44d5", "structural_hash": "fdcb684da92a333906ac1a150f7ed0490cb15ed515d7305c58063a100f7275d5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01365.php", "upstream_id": "BenchmarkTest01365", "language": "php", "code": "headers->get('Authorization', '');\n $_prefix = strtolower(substr($userInput, 0, 1));\n $data = '';\n switch ($_prefix) {\n case 'h': $data = strtolower($userInput); break;\n case 'f': $data = strtoupper($userInput); break;\n default: $data = trim($userInput); break;\n }\n if (!hash_equals((string)($data), (string)($request->getSession()->get('token', '')))) { throw new HttpException(401, 'unauthorized'); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9d637f252ff161753ba66b03ba353c0e17054a474542a62062a1d1bc54148442", "structural_hash": "c542697d037dadec91b7d386d027d75eed9ec8f1e3876fe22aa7bac9fef8403e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04485.rs", "upstream_id": "BenchmarkTest04485", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n if multipart_value.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4adddfeb500706582274f265334c1581f1b58665daa918af80bcde2998c62039", "structural_hash": "5debed8802d6d887d113e16a2fcf4ac10adc90e71dca02ccf6e0384964d57baa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03930.cpp", "upstream_id": "BenchmarkTest03930", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07b6f7bae0031c8e910a718efb2d0b8fee5c7cb998601d35bd0bcd176ec4efb7", "structural_hash": "53562f6e534f64c5151874ab7c2ed7f6ad79d9707ff732434e47858e25c3eddb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05765.rs", "upstream_id": "BenchmarkTest05765", "language": "rust", "code": "use axum::http::StatusCode;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(comment_value.clone());\n static _RE_ALLOW: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"^[a-zA-Z0-9_-]+$\").unwrap());\n if !_RE_ALLOW.is_match(&data) { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let processed = data.clone();\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", processed)).await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7b1183bcc7ad480e656a799db08053e3e5b49648c44b2b7c1663c04f5db7cb6f", "structural_hash": "8f17d0ecb52b4531dd36b622e2f0c315088669772bc2cf613b836eefc1d83577", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02451.py", "upstream_id": "BenchmarkTest02451", "language": "python", "code": "import requests\nfrom urllib.parse import urlparse\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data = '%s' % (db_value,)\n parsed = urlparse(data)\n if parsed.hostname not in ('api.prod.internal', 'cdn.pycdn.io'):\n return jsonify({'error': 'forbidden host'}), 403\n target_url = data\n requests.get(str(target_url))\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4603460f929058f7dfdc55577cf3a60d268d1d1a3162be0eb41b663682d2bcb3", "structural_hash": "de5c3c1d2ea42a29f8b44bdceb58a8329b329dedc454265f3e5bd0a25f5c3e6d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_01730.rs", "upstream_id": "BenchmarkTest01730", "language": "rust", "code": "use actix_web::{HttpResponse};\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case() -> HttpResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n static LAST_REQUEST: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Mutex::new(String::new()));\n {\n let mut _slot = LAST_REQUEST.lock().unwrap();\n *_slot = db_value.clone();\n }\n let data = LAST_REQUEST.lock().unwrap().clone();\n let _: serde_json::Value = serde_json::from_str(&data).unwrap_or_default();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "aec8f02414d560726de708a4d9d5a88998dd2daf0435213ce97d9deec2182eba", "structural_hash": "344c2571591ab35d35a4f33b312b72cd81da0fd24c1a44ad00f8e6f24d983ad3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00605.rb", "upstream_id": "BenchmarkTest00605", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:field].to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n Process::Sys.setuid(data.to_i)\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "db15e9db0b9e7c4b6f456bf0d09d3a5cd5f475250a344ebba82590a449cbeff7", "structural_hash": "3ead0b6a5d0852d9399254e7f4b60c7de5eeaed0e09739ac9d8acfa4a1db1c20", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04359.rs", "upstream_id": "BenchmarkTest04359", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case() -> impl IntoResponse {\n let comment_value = crate::shared::db_fetch_one(\"SELECT text FROM comments LIMIT 1\");\n let data = crate::shared::passthrough(comment_value.clone());\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "20b0f69ed5eeefe31718c534747dd2b278138fcdb41505a17bca2e8d93786a75", "structural_hash": "d0e9c63ca42b7da3dcf00038c497499d052bd8ab18118ef2ca1c6e50d69b81c9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09791.sh", "upstream_id": "BenchmarkTest09791", "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 [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-287"], "category": "authnfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "60230e4152a1a4f2d59447cdb88935bcacebedacceeee8d8d8c860b342c31e1b", "structural_hash": "fbed05dd5be88eb62b6e4b3a7395f531445044195844c195c7c900fc8f8a30bd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35691.go", "upstream_id": "BenchmarkTest35691", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar data string\n\tif len(multipartValue) > 0 {\n\t\tdata = multipartValue\n\t} else {\n\t\tdata = \"default\"\n\t}\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: data, Secure: true, HttpOnly: true, SameSite: http.SameSiteStrictMode})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eeb2975a28324f9b21ae8dffece69cb0e8e102d739257799f4f9618264a0e63b", "structural_hash": "7b7c190459b89648f2bf9063ac80bbbbeaa02b7d9ae89aae90ec34c487c887eb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00979.cpp", "upstream_id": "BenchmarkTest00979", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstatic std::string cpp_shared_input;\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_COMMENT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n cpp_shared_input = user_input;\n std::string data = cpp_shared_input;\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2612c57a3078c571211ae65eb1841aa6ce379c9958fdad6b7a1039474bfa4c36", "structural_hash": "48069766404dea8a149d6598490a75dca86e2fa50bfefa825e90955d69cd244a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00633.cpp", "upstream_id": "BenchmarkTest00633", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input + std::string(\"?trace=v\");\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "39e4042ff3be34c096eaa09b04278242480d9328889750d615295a5635b752d8", "structural_hash": "d415f1af64cc6b431076305c0735e4fdc68d2c8c46de2671c1ab007c9183ff05", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01283.cpp", "upstream_id": "BenchmarkTest01283", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"QUERY_STRING\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n auto _fn = [](const std::string &s) { return std::string(s); };\n std::string data = _fn(user_input);\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "91c166990cb6a77b68a59b91999bef2c817c224c3d1cfdd54a559b6c82b0bbc7", "structural_hash": "dee66b2946b2a5cf714785cb78bdc2b9694d69eb28883c9e37bdb1b792ac6e40", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03899.rs", "upstream_id": "BenchmarkTest03899", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let upload_name = {\n let mut _fname = String::new();\n while let Ok(Some(_field)) = multipart.next_field().await {\n if let Some(_f) = _field.file_name() { _fname = _f.to_string(); break; }\n }\n _fname\n };\n fn normalize(value: String) -> String { value.trim().to_string() }\n let data = normalize(upload_name.clone());\n #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "649b1a0e38c6681b3846ee63d659ab3612ec25d4a8fca103e2fa889e2e63b973", "structural_hash": "2bf379bd8a7b3d36ce0829fb22acb438c14bf69380bbecbe41378ab8b2caa043", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03415.rs", "upstream_id": "BenchmarkTest03415", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let ua_value = headers.get(\"user-agent\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = if ua_value.len() <= 4096 { ua_value.clone() } else { ua_value.chars().take(4096).collect() };\n let _ = tokio::fs::read_to_string(format!(\"/var/app/data/{}\", data)).await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b02c74c6da0f8e60b5e01aaf82408c6d949d0931fec0507b330e88e31dca36e", "structural_hash": "46c9342de214222e927cdc6951eadb6e6b9b99a9e2f449f510a63a7e84968fd0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07776.c", "upstream_id": "BenchmarkTest07776", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/etc/app/config\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "29bd245655668803eb2b8aadc87abfec217c41487d581579f5fa0e2e2ac1eabc", "structural_hash": "2421ac8c69c9513768dc8c7ed7f8d8f335b9bbf844e3c3d7e324f40055668914", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_00173.go", "upstream_id": "BenchmarkTest00173", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tuserID := c.Query(\"id\")\n\tcapture := func() string { return userID }\n\tdata := capture()\n\tif !strings.HasSuffix(strings.ToLower(data), \".jpg\") && !strings.HasSuffix(strings.ToLower(data), \".png\") {\n\t\tc.String(http.StatusBadRequest, \"invalid file type\")\n\t\treturn\n\t}\n\tentryFile := data\n\tos.WriteFile(\"/var/uploads/\"+entryFile, []byte(\"data\"), 0644)\n\tc.JSON(200, gin.H{\"code\": \"OK\"})\n}", "label": 0, "cwe": ["CWE-434"], "category": "fileupload", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9501c98c11671f379bad8fd3d033b3173c5c446db96903d448b6cdfb84d06c5e", "structural_hash": "aae7e32f0678aa7004fcd8dc3d1a3964c37ffc06d39834896c316041b4e0cc8b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19237.sh", "upstream_id": "BenchmarkTest19237", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n _prefix=\"${user_input:0:1}\"\n case \"$_prefix\" in\n h|H) data=$(printf '%s' \"${user_input}\" | tr '[:upper:]' '[:lower:]');;\n f|F) data=$(printf '%s' \"${user_input}\" | tr '[:lower:]' '[:upper:]');;\n *) data=\"${user_input}\";;\n esac\n input_value=\"$data\"\n if [[ \"$input_value\" =~ [a-zA-Z0-9_-]+ ]]; then\n printf \"X-Validated: %s\\r\\n\" \"$input_value\"\n fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8cf5393204daac9861007abb408321629f74937547a4ffcb9b0696e0ffeef3ba", "structural_hash": "14e3a1648f90bb361f50e4055b1990118c81769950333585a8aa04e1690aeeed", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03976.c", "upstream_id": "BenchmarkTest03976", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, user_input); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f40dd5d82d14923716e9e7552b6a117ac314e79be434e035d4ab4ebd690a5919", "structural_hash": "dc51e8b2ce38ce516db60d022c1f9cda4754c32389af75b04ca025f2bf5414c3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05727.rs", "upstream_id": "BenchmarkTest05727", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let forwarded_ip = headers.get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut data = String::new();\n for token in forwarded_ip.split(',') { data = token.to_string(); }\n crate::shared::nosql_find_one(&format!(\"this.username == '{}'\", data)).await;\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-943"], "category": "nosql", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:nosql", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d5df1ccffa087f26177dbb93abd450c42a75b42976b678480e4a6ebdc630196e", "structural_hash": "814dda24278504b8f107375c12e9662fd6211111deda283fd2d554e2101ac35d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_05867.php", "upstream_id": "BenchmarkTest05867", "language": "php", "code": "json('variables.input', '');\n $words = explode(' ', $userInput);\n $data = implode(' ', $words);\n return response('' . (string)$data . '')->header('Content-Type', 'text/html')->header('X-Frame-Options', 'DENY')->header('Content-Security-Policy', \"frame-ancestors 'none'\");\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c40257852979828cb13533039c93bf3a0bb0165491befc6c3560b32d4b104edf", "structural_hash": "9b9b24f288f37f3cb9f98e3e1e222202893c68ae46d0e17ec3516dc8c03ebe78", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03513.rb", "upstream_id": "BenchmarkTest03513", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = params.require(:request_data).permit(:payload)[:payload].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n processed = data.length > 64 ? data[0, 64] : data\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "03c3c447b5fdb1be9213f0dd2551d455d706b04f673e0b3ea2c4bb61cc4d4b8c", "structural_hash": "123f2471a2b9612a9ab4fb43491330f756fd6c515dabf1ff15775944b83efe22", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05448.c", "upstream_id": "BenchmarkTest05448", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "adb018ddb1770e96d383826ebfa2d35d16e7dcb33d9154427110a08804ae2c84", "structural_hash": "e768203877fd2d5deb6a23af68f57f2f5ca22a8f5204b14df16a0ccc87bcda9f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_09841.go", "upstream_id": "BenchmarkTest09841", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvar data string\n\tfor _, token := range strings.Split(xmlBody, \",\") {\n\t\tdata = token\n\t}\n\tcell := data\n\tif len(cell) > 0 && strings.ContainsRune(\"=+-@\\t\\r\", rune(cell[0])) {\n\t\tcell = \"'\" + cell\n\t}\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{cell, \"data\"})\n\tcsvWriter.Flush()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7448cae80ba739e184ae83e4c0d4e6501c8f67a05e25b1fa1fe06284ad503fb7", "structural_hash": "e16042296c050af494d2afc08012786d005060941faa93ccae4416326f319983", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_35135.go", "upstream_id": "BenchmarkTest35135", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\t_, header, err := r.FormFile(\"upload\")\n\tif err != nil {\n\t\thttp.Error(w, \"bad upload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tuploadName := header.Filename\n\t_prefix := \"\"\n\tif len(uploadName) > 0 {\n\t\t_prefix = strings.ToLower(uploadName[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = uploadName\n\tcase \"f\":\n\t\tdata = uploadName\n\tdefault:\n\t\tdata = uploadName\n\t}\n\tos.Chmod(\"/var/app/data/\"+data, 0777)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-281"], "category": "improper_perm_preservation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:improper_perm_preservation", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e759037d3f1f73ac87b484a67dda088ae83253837ac647d344b4bce84473919", "structural_hash": "ec41891c08b962cc1f9587a348ab98684642f83ea69858d4807ccc91f25e5cd5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13040.go", "upstream_id": "BenchmarkTest13040", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\tvar data string\n\tfor _, token := range strings.Split(forwardedIP, \",\") {\n\t\tdata = token\n\t}\n\tcrlfStripped := crlfPat.ReplaceAllString(data, \"\")\n\tprocessed := redactPat.ReplaceAllString(crlfStripped, \"****\")\n\tlog.Printf(\"User action: %s\", processed)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8bf04f4ccc7c3c5d268bb088e1c007781216c4214724385f5799ac6c4e16e9b", "structural_hash": "5b80b1653805e2f06c3cc00f56647a0a3c0dadc8613a6dc5a48b834b1fbc5c6b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_03774.ts", "upstream_id": "BenchmarkTest03774", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const data = \"\" + userInput;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "acdd909faa1c4ffef5889faa66411882547d875237ebf8a7193e80ea989f20c4", "structural_hash": "ed8525ea02bbaf3a20772b5efdc287e4c83baee472d4a758ca182faf305e6a6c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_05989.js", "upstream_id": "BenchmarkTest05989", "language": "javascript", "code": "async function benchmark_case(req, res) {\n const userInput = req.headers.authorization || \"\";\n let data;\n try { data = JSON.parse(userInput).value || userInput; }\n catch (e) { data = userInput; }\n const params = new Map();\n for (const pair of String(data).split(\"&\")) { const [k, v] = pair.split(\"=\"); params.set(k, v); }\n res.json({ role: params.get(\"role\") }); return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-235"], "category": "extra_parameter_handling", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:extra_parameter_handling", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f499ee478e7621abfa8528a30ee903b7efa2cdec0345876c3f3cd1c486425b8d", "structural_hash": "76b92c99992fa9a96ca6590d35e618ef8851e5eb0270b949b313d8e132dd3ec3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_05343.rs", "upstream_id": "BenchmarkTest05343", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse log;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(web::Query(query): web::Query>) -> HttpResponse {\n let user_id = query.get(\"id\").cloned().unwrap_or_default();\n let data = user_id.to_string();\n let _crlf_stripped = data.replace(['\\r', '\\n'], \"\");\n static _RE_REDACT: std::sync::LazyLock = std::sync::LazyLock::new(|| regex::Regex::new(r\"[A-Za-z0-9]{4,}\").unwrap());\n let processed = _RE_REDACT.replace_all(&_crlf_stripped, \"****\").to_string();\n log::info!(\"User action: {}\", processed);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c9dd9c89e4830245444589b307c56916ea8db0a2e8c94ce0bd844562a1eec40", "structural_hash": "a3c9d9ddffd0f74154fa97e2d4bdf5352f83eed3a594e882245ec1a0b3bdf3d8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_00235.py", "upstream_id": "BenchmarkTest00235", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom starlette.responses import JSONResponse\nimport json\nfrom app_runtime import db\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n try:\n data = json.loads(cookie_value).get('value', cookie_value)\n except (json.JSONDecodeError, AttributeError):\n data = cookie_value\n record = db.fetch_one('SELECT * FROM documents WHERE id = ?', (str(data),))\n return JSONResponse({'record': str(record)}, status_code=200)", "label": 1, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d7d2ad074e821fdc133ff092e0d0e53ac620110793a3448dca29bd73bcad1f15", "structural_hash": "099cf5a65f0b6d0ea4fb8bc37869939f2e0f1b53ef7c8d4c26afbe9ab42a053a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01424.ts", "upstream_id": "BenchmarkTest01424", "language": "typescript", "code": "import { Body, Controller, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 = String(userInput).split(/\\s+/).join(\" \");\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d41b4ffbbed7ef6681d0a8ca870d8cf7b7c64ec875f850c82d9f61b8051ac42e", "structural_hash": "9bbae2e5f7957620a9a112f4cb954fb90fa11fe2d1d7d0f865a405eb33fa2f4d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01965.ts", "upstream_id": "BenchmarkTest01965", "language": "typescript", "code": "import { Controller, Headers, Post, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"user-agent\") ua: string): Promise {\n const userInput = ua || \"\";\n const data = String(userInput).slice(0, 200);\n if (!/^[a-zA-Z0-9_.-]+$/.test(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6a38b18938378726715705eac1c8ec5aeb66375b926273a62e7e2b7c16dd9535", "structural_hash": "08529cc889d7c01e30503009c9033fd4397cf37d0a1d616f7ee48af060d7b3c5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_04546.rs", "upstream_id": "BenchmarkTest04546", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse hex;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let cookie_value = headers.get(\"cookie\").and_then(|v| v.to_str().ok()).and_then(|s| s.split(';').find(|c| c.trim_start().starts_with(\"session_token=\"))).map(|c| c.trim_start().trim_start_matches(\"session_token=\").to_string()).unwrap_or_default();\n let data = String::from_utf8_lossy(&hex::decode(&cookie_value).unwrap_or_default()).to_string();\n let _ciphertext: Vec = data.bytes().map(|b| b ^ 0x42u8).collect();\n tokio::fs::write(\"/var/data/cipher.bin\", &_ciphertext).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "003849d65a65a2286d0bab9d00172f5780b2648cc453e9ba25165222dfe41483", "structural_hash": "6d47864b4cbab0d436431a00a59091e91fb03bfd8edbef22a4a05dea43fd90f7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01946.php", "upstream_id": "BenchmarkTest01946", "language": "php", "code": "cookies->get('session_token', '');\n $data = urldecode($userInput);\n if (!hash_equals((string)($request->getSession()->get('user', '')), (string)($data))) { throw new HttpException(403, 'forbidden'); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f63a8aa20493bee8fed1b6e8da0c88f820695da05ad0c4cc93aca60711dd8f92", "structural_hash": "0bfe26f978e95c055c0e16cb9fb80b3a1d396a21ef91221ceebd917ccfeb7500", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10052.sh", "upstream_id": "BenchmarkTest10052", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(jq -r '.value // empty' 2>/dev/null)\"\n printf -v data \"%s\" \"${user_input}\"\n if [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-1125"], "category": "excessive_attack_surface", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "85ca97a6090acc7dc4e694fc6d0734d635e3ff69ecab6acc750d03a6256e31a8", "structural_hash": "f0c04302f89e6ff0b3222854b9682672734ade91ed5c5cda42205d54f5a0a8ac", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_05483.py", "upstream_id": "BenchmarkTest05483", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n data = '{}'.format(ua_value)\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=True)\n return JsonResponse({\"saved\": True})", "label": 0, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "701fd576c3fffa50f02639e098ece06359d31793f2379386d2caf73deb6500d4", "structural_hash": "d9d21f0e1822a803af0882a810f8f73892ff6c2f54e3379c7fb983c2d31f40c7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05754.java", "upstream_id": "BenchmarkTest05754", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestParam(\"field\") String field, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String fieldValue = field != null ? field : \"\";\n java.util.Map.Entry edge = java.util.Map.entry(fieldValue, \"form\");\n response.setHeader(\"X-Tuple-Context\", edge.getValue());\n String data = edge.getKey();\n try (java.sql.Connection authConn = java.sql.DriverManager.getConnection(\n \"jdbc:postgresql://db.svc.local/app\", \"appuser\", data)) {\n response.getWriter().print(\"{\\\"auth\\\":\\\"ok\\\"}\");\n }\n }\n}", "label": 1, "cwe": ["CWE-1392"], "category": "default_credentials", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "61af05b850fedf33f3ee945314ddca676758a7bc701dccc786143ee3ccc50837", "structural_hash": "1387e2b0a714ba26c022fe76d9cd154d0ac79c0c404e80f11ad3707ea2ba6364", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_09645.js", "upstream_id": "BenchmarkTest09645", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = (await db.query(\"SELECT name FROM users WHERE id = ?\", [1])).rows[0].name;\n const 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 res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a9c4657d75bc005187dfb3fc23f19d19b34b322ae19f801bebc0219f82f4bc12", "structural_hash": "c8af739a83d3d20b75621477f84c7ea45dfaf3d6408fcb924479c65609222ed1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01441.go", "upstream_id": "BenchmarkTest01441", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/csv\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tfieldValue := r.FormValue(\"field\")\n\tdata := func(v string) string { return strings.TrimSpace(v) }(fieldValue)\n\tcsvFile, _ := os.Create(\"output.csv\")\n\tcsvWriter := csv.NewWriter(csvFile)\n\tcsvWriter.Write([]string{data, \"data\"})\n\tcsvWriter.Flush()\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-1236"], "category": "csv_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:csv_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "17637e944f72736b2e1aa70e173d9565ab71bd9b09fedd5bcf09eb8a9daad482", "structural_hash": "8be8d5dd7e90f9d7d71553b7552c1e8b6dca24ed246b19528ccda1a826f270df", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_02713.py", "upstream_id": "BenchmarkTest02713", "language": "python", "code": "from django.http import HttpResponse\nimport json\ndef benchmark_case(request):\n json_value = json.loads(request.body or b'{}').get('payload', '')\n data = f'{json_value!s}'\n with open('/var/app/data/' + str(data), 'r') as fh:\n content = fh.read()\n return HttpResponse(content)", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4fc5172ae88845e449251ce563455c535677706de2b1dbb2f984fb9a7522bf6", "structural_hash": "135e2ffe0a492d33c7550ad120d19c60b6338b9947bd294ae8129b233d865602", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03432.c", "upstream_id": "BenchmarkTest03432", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = c_passthrough(user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2979b2a2211a98f108875103a5f0d3739696d0431261de03d2afe902678160f9", "structural_hash": "8f54e96d1db44f1c5807fb2cd5f4ce33dfa1a33855a8d1ef7f037600d582ee06", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36059.go", "upstream_id": "BenchmarkTest36059", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tuserID := r.URL.Query().Get(\"id\")\n\tdata := strings.ReplaceAll(userID, \"\\x00\", \"\")\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: data})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-565"], "category": "cookie_no_validation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "faa466c4240dfaadcd64d4cb251b792ca498c8cd4c99f5f5b5677e84cbfcf540", "structural_hash": "541ee29474e1d40d2d31e8f5d268a943e5323fc73d5c1ffbfe45acd1af6784fa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05015.py", "upstream_id": "BenchmarkTest05015", "language": "python", "code": "from fastapi import FastAPI, Request\nimport re\nfrom starlette.responses import JSONResponse\nfrom app_runtime import db\ndef trace(fn):\n def wrapper(*args, **kwargs):\n return fn(*args, **kwargs)\n return wrapper\n@trace\ndef handle(value):\n return value.strip()\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n cookie_value = request.cookies.get('session_token', '')\n data = handle(cookie_value)\n if not re.match(r'^.{1,256}$', str(data)):\n return JSONResponse({'error': 'schema invalid'}, status_code=400)\n secret = db.fetch_one('SELECT secret FROM vault WHERE owner = ?', (str(data),))\n return JSONResponse({'secret': str(secret)}, status_code=200)", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc9e2395457cd10d3985eb3c4b334806c7046dba6b3883e4d55c71d9582d8011", "structural_hash": "5d70d0e0ae24816ecf197f4894c4cd2d10fae4fdb91e1c9e8799ad251ae14021", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_03237.rb", "upstream_id": "BenchmarkTest03237", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ab510617ee45546faa22e7a776e19fc22dec6200e64a7727455cc5615131cd72", "structural_hash": "bc5a5e2f84fcf67b9d52f313b66e4683eca02a14a7a6c845093c5fa44419cc5a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_14429.c", "upstream_id": "BenchmarkTest14429", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *data = \"\";\n if (strlen(user_input) > 0) data = user_input;\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f363764cb409ff814f4e056822260c742bd7ef09244c847359b8422a7856db5b", "structural_hash": "0edda2c2be442f6c711cad479f3626f421f0c0cabb586365998951da15524517", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_12305.c", "upstream_id": "BenchmarkTest12305", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_passthrough(user_input);\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3c399e92137874be1b8eb4ffb1a6fd70534701ca3315534cb545287bc0527b95", "structural_hash": "beeaf62e20b8d4253f812990f9f9c069651ea5be7735fab11cb45f8a810f5024", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_14859.js", "upstream_id": "BenchmarkTest14859", "language": "javascript", "code": "const { db } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const payload = { get value() { return userInput; } };\n const data = payload.value;\n db.query(\"SELECT * FROM users WHERE id = ?\", [data]);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-566"], "category": "auth_bypass_sql_pk", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:auth_bypass_sql_pk", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "308ddc1989bf67561ed2b7e1963ad934564063bd9749bed4cf1d5ff73453829a", "structural_hash": "9d8263edcd48b26575241a63d8ffe34b3a70604e609462a658f3b8257fca4b1e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00849.rb", "upstream_id": "BenchmarkTest00849", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = params[:multipart_field].to_s\n data = \"%s\" % user_input\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\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:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5ec59c3bb7a3eb7e087edefd3c9bff16a0d3729ac088a6e9d29a41390ec96ae8", "structural_hash": "d36aaa1a561fdbe4dc09db16b6ff999d52d5578381a12cf4108327706dcef6c6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest04209.java", "upstream_id": "BenchmarkTest04209", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case/{pathId}\")\n public void benchmark_case(@PathVariable(\"pathId\") String pathId, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String pathValue = pathId;\n String data;\n if (pathValue.length() > 256) { data = pathValue.substring(0, 256); }\n else { data = pathValue; }\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1e989fefa8487d4de677682235699c733ec60c9548b4f30f8accc566e3d0830a", "structural_hash": "a0713ff7056f466ecd5131e1616ac42760729696866a86b7e0c03eb1186ec916", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00107.rs", "upstream_id": "BenchmarkTest00107", "language": "rust", "code": "use axum::extract::Form;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\nuse std::collections::HashMap;\npub async fn benchmark_case(Form(form): Form>) -> impl IntoResponse {\n let field_value = form.get(\"field\").cloned().unwrap_or_default();\n let queued = field_value.clone();\n let data = tokio::task::spawn_blocking(move || queued.trim().to_string()).await.unwrap_or_default();\n crate::shared::set_cookie(&format!(\"session={}; Secure; HttpOnly; SameSite=Strict\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b246e89de9b76158a1895a3ad16e93da799a15327c488a26d056a41646fb18be", "structural_hash": "639d9c4306112a664afbda84a800ec2b9b62fc26fdc1dcd99c42476a7b10cf47", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00696.php", "upstream_id": "BenchmarkTest00696", "language": "php", "code": "json('variables.input', '');\n $transform = fn (string $v): string => $v;\n $data = $transform($userInput);\n return response('' . (string)$data . '')->header('Content-Type', 'text/html')->header('X-Frame-Options', 'DENY')->header('Content-Security-Policy', \"frame-ancestors 'none'\");\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c8dbf5694a30b4e8dc65722eb43ac4320260c566598a2c2e09b09468205fdf9d", "structural_hash": "a0130f4b8ba746a1019feeeb6980bb2b77796d2bf80c845561f4ded9d35f5f4e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02507.rs", "upstream_id": "BenchmarkTest02507", "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 = match json_value.chars().next() { Some(_) => json_value.clone(), None => \"default\".to_string() };\n if data.len() > 8192 { return (StatusCode::BAD_REQUEST, \"\").into_response(); }\n let _principal = crate::shared::current_session_user();\n if !crate::shared::user_has_role(&_principal, \"admin\") { return (StatusCode::FORBIDDEN, \"\").into_response(); }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-639"], "category": "idor", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f5ce52efc0c44db238a31478fea78c73445456b08e753832da44a98f67c32446", "structural_hash": "1242427d4f866f648e51bab9de996ccdbbdb0b6ea7c93444e42e49f8c6a908cb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01809.sh", "upstream_id": "BenchmarkTest01809", "language": "bash", "code": "benchmark_case() {\n user_input=\"$QUERY_STRING\"\n data=\"${user_input//$'\\x00'/}\"\n sudo -u nobody echo \"$data\"\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "73bb2861154286fa577f6a22b64e91cf0ca4877f04309c32ef3cc5748249a79a", "structural_hash": "d506ab32f1bc89b6000c410288db6f8540093b0be4ac5cca6a5108ed684ff23e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05044.rb", "upstream_id": "BenchmarkTest05044", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n _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 Process::Sys.setuid(data.to_i)\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0976c81c8ca7f068b29e059afe296fe1c2130a8d72942aa1e550154ba35041f5", "structural_hash": "bc3db85fb1a24fede03ef4b6b924c02683c4e592d0c20946211a4a59130b4070", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15233.c", "upstream_id": "BenchmarkTest15233", "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 const char *user_input = (argc > 2) ? argv[2] : \"\";\n struct c_ctx _ctx = { user_input };\n const char *data = c_capture(&_ctx);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "574eda3319e8d79ce33ef567808345945d77d24faf9a27a467308edfbc9906f0", "structural_hash": "3a39fbcc8d535e74266ceefc26e3974f103cadfcf98a86e09f64aa4ea37090ec", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04500.php", "upstream_id": "BenchmarkTest04500", "language": "php", "code": "query->get('id', '');\n $data = urldecode($userInput);\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return new JsonResponse([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b332d3bea67870e6ef461d7120a9dd73b9192fbd9fb73911cc7dbddd7ad56d98", "structural_hash": "82acdfbdff61dcc0d08ce73813b08a0776bc57b730f707798f1d697e8a7e3be9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_22747.js", "upstream_id": "BenchmarkTest22747", "language": "javascript", "code": "const crypto = require(\"crypto\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.variables && ctx.request.body.variables.input) || \"\";\n crypto.createCipheriv(\"aes-256-gcm\", Buffer.alloc(32, 1), Buffer.alloc(12, 0)).update(String(userInput));\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-323"], "category": "reusing_nonce_key", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:algo_downgrade", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3045ec36e37f7088d9056872a49f74833e59eb3a14ceb68ec1213fb610b87d2d", "structural_hash": "47a8b9bba9a27feaefcb43d417624230bd365f85395b341ceaeafb20c1bf9410", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02037.php", "upstream_id": "BenchmarkTest02037", "language": "php", "code": "getContent();\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n if (!preg_match('/^[a-zA-Z0-9_.-]+$/', $data)) { return response()->json(['error'=>'invalid'], 400); }\n $processed = $data;\n logger()->info('Action: ' . $processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ff9f9d3e5724a9f3eff7eac1245ff2563fcf526856225953f1bc575e1948c464", "structural_hash": "cf518084ed8282a714f82d9242617fbc7b8809732979d03b571512e9e9b9fde6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00040.sh", "upstream_id": "BenchmarkTest00040", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n read -ra _parts <<< \"${user_input}\"\n data=\"${_parts[*]}\"\n _body=$(curl -s \"$data\")\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7633db4dbe94a95362fc8796aeb9717f96af13e2d7610dac6bc7a9eaa82888b8", "structural_hash": "648c472f609d600e0a87b20487382fe1a19b177b32de87ef8963ad15879389c4", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_05505.php", "upstream_id": "BenchmarkTest05505", "language": "php", "code": "getContent();\n $data = \"{$userInput}\";\n $role = (string) $data;\n if ($role === 'admin') { return new JsonResponse([\"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-307"], "category": "no_brute_force_limit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4029c11981e35730d24ec61a7cf358acc7b2e02eed50bded1bcb805b5d1e93d9", "structural_hash": "628e2650c6ad59f3f8b15a63b9c83d11b375ee9bd7dc3cc4ca873645767a2c3d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00447.cpp", "upstream_id": "BenchmarkTest00447", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"GRAPHQL_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n try { data = user_input; } catch (...) { data.clear(); }\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "05bd2d55acc749fe9d2fa9aa5cd4c3864b92b8ca79f6395473f8fcbc741fb84b", "structural_hash": "a6dbed0cb2654fbdccbe38d8697c5ec7ebf8ecfd409404e491eea2856a9728e1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_00815.rb", "upstream_id": "BenchmarkTest00815", "language": "ruby", "code": "require \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nrequire \"ostruct\"\nclass benchmark_caseController < ApplicationController\n def benchmark_case\n user_input = Comment.first&.text.to_s\n ctx = OpenStruct.new(payload: user_input)\n data = ctx.payload\n cookies[:session] = data\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b2db1c7f4454559aaa1bfc70a8d928163d506585799b5f2b89709be2e2678fa", "structural_hash": "79636ebb7bf3d070b44860faed14bb2ba205c9c44f9da2f672564e5cbdaaaaed", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11981.c", "upstream_id": "BenchmarkTest11981", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 2) ? argv[2] : \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7bcdab00703b242218e813467e7efe5ab9f997dac70ef26057371543266c3e16", "structural_hash": "27fc4767046ecaba97a57645881e05d579a3939d6d81e141fca9d7d5ffb9e322", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_07503.go", "upstream_id": "BenchmarkTest07503", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/base64\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tcookieObj, err := r.Cookie(\"session_token\")\n\tif err != nil {\n\t\thttp.Error(w, \"missing cookie\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tcookieValue := cookieObj.Value\n\tdecodedBytes, _ := base64.StdEncoding.DecodeString(cookieValue)\n\tdata := string(decodedBytes)\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: data})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-539"], "category": "persistent_cookie_sensitive", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e2b1c732f1637905b0acc05f12344ae0d3db72f245750f0f558f5e591787dc4", "structural_hash": "50aa373eebe944a8d2c2a4fead5fd6a1c671ac91d8fc1397b6600c665d73cb2e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04778.sh", "upstream_id": "BenchmarkTest04778", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_USER_AGENT\"\n data=\"${user_input//$'\\x00'/}\"\n printf \"%s\" \"$data\" | openssl pkeyutl -encrypt -pkeyopt rsa_padding_mode:pkcs1 -pubin -inkey /etc/app/rsa_pub.pem -out /dev/null 2>/dev/null\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-780"], "category": "rsa_no_oaep", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:rsa_no_oaep", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7e46b85bf42b26b19f65b1fde9844918ba23704a5c6f8caebaccaeb3f5255cf2", "structural_hash": "06b0f63e3aaaa99c15e73bd606e376f2ee92199a041606b50dbd6a9d2528f6a0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05396.ts", "upstream_id": "BenchmarkTest05396", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"x-forwarded-for\") xff: string): Promise {\n const userInput = xff || \"\";\n const _input = String(userInput);\n let data;\n switch (_input.startsWith('{') ? 'json' : 'text') {\n case 'json': data = _input.normalize('NFC'); break;\n default: data = _input; break;\n }\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c179174b91cf00fe8543531fcc9a3fef14f347950a55e6a00d2d37f5b1619096", "structural_hash": "f50c1f1e8b5c37de1e621da7d0e06882406e9235341dc3817b001886509525bc", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_03737.rs", "upstream_id": "BenchmarkTest03737", "language": "rust", "code": "use actix_web::{HttpResponse, web};\nuse serde_yaml;\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: String = json_value.parse::()\n .map(|n| n.to_string()).unwrap_or_else(|_| json_value.clone());\n let _: serde_yaml::Value = serde_yaml::from_str(&data).unwrap_or_default();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4a3e1e25b5aadcd4d3123829bd5dfe27d598e0bccc69013f08fe1dfe48d40513", "structural_hash": "f052616ff3c6ac60aff7eaceaa4b85aa1f2459cb79114cd3b4d54cca3061f037", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_09199.sh", "upstream_id": "BenchmarkTest09199", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n _body=$(curl -s \"$data\")\n _want=$(curl -sI \"$data\" | grep -i \"^X-Content-SHA256:\" | tr -d \"\\r\" | cut -d\" \" -f2)\n if [ \"$(printf \"%s\" \"$_body\" | sha256sum | cut -d\" \" -f1)\" != \"$_want\" ]; then echo \"integrity check failed\" >&2; exit 1; fi\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "471e2419a0794fc585b563af94d10fd593ef665c76d819c2cf7bb2bd95af97d1", "structural_hash": "74557fe261f1b4da4755bb8206dadf3783173e89b85478c670f4111198373230", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_10403.go", "upstream_id": "BenchmarkTest10403", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trefererValue := r.Header.Get(\"Referer\")\n\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 <- refererValue\n\tclose(_jobs)\n\tdata := <-_out\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: data})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7d7935b01ce77c1a87396493a32e73711b3f6efeb4e26a82fd25c68963068583", "structural_hash": "9a6818c27d3b82c643695a6697e77243cb17135293364b833f4e46c3d3dc7ea6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15638.c", "upstream_id": "BenchmarkTest15638", "language": "c", "code": "#define _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 char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d2dbf848264157425ac7327e258ca8153cf7845942af931671de1cb86e36d2e3", "structural_hash": "5bf71434703162a53c0590b2f0504e040f36eb40833a6a6c1ae754976dc116de", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_39023.go", "upstream_id": "BenchmarkTest39023", "language": "go", "code": "package testcode\nimport (\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trawBytes, err := io.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"bad request\")\n\t\treturn\n\t}\n\txmlBody := string(rawBytes)\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(xmlBody) {\n\t\tdata = normalizer(xmlBody)\n\t}\n\tif os.Getenv(\"APP_ENV\") != \"test\" {\n\t\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\t\tif err != nil {\n\t\t\tc.String(http.StatusNotFound, \"not found\")\n\t\t\treturn\n\t\t}\n\t\tc.Data(200, \"text/plain\", content)\n\t}\n}", "label": 1, "cwe": ["CWE-23"], "category": "relative_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f31632efc12ca62ae6f06543af62297f645d4651a4db40e90994c077673fe777", "structural_hash": "a516a9c1ede8196952715ee90d4f1a27e18b7b7efe92175e65f64a9b23bc339e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_00662.php", "upstream_id": "BenchmarkTest00662", "language": "php", "code": "fetchOne('SELECT name FROM users LIMIT 1');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n file_put_contents('/var/data/output', (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ed9e1e4a0b1ef82e4ac04fff68bdd560e417757796e7740c5c798f8f2ec12c25", "structural_hash": "8406dbf0bff5ee8e1682b514bdc88b439cc2d2f609b5a60a3436f74b5a7ea82a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_15040.c", "upstream_id": "BenchmarkTest15040", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n char data[512];\n snprintf(data, sizeof(data), \"%s\", user_input);\n for (char *_r = data; *_r; ++_r) if (*_r == '\\n') *_r = ' ';\n char *_dst = malloc(16);\n if (_dst) { strcpy(_dst, data); printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 1, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6fa79aea79fd208c793f8260ef0cf58954a8e0a9da236f6106c1cd033dd038e1", "structural_hash": "80e6a4d32329364b8fed9d23682c2420179aa2a85fdcd60847fd7eb0698716ee", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest01691.java", "upstream_id": "BenchmarkTest01691", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String envValue = java.util.Optional.ofNullable(System.getenv(\"USER_INPUT\")).orElse(\"\");\n String data = envValue.isEmpty() ? \"default\" : envValue;\n response.addCookie(new Cookie(\"session\", data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "eebe8e36949c9b4662f6b74b8e7cf3dcafa9c76227ff0e50c81641c9393f1acb", "structural_hash": "42c4ad3d4e51e2f5e98f3e50fc0027a0dc96d7fc8cfbeed5bc02823372af86f9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03244.rb", "upstream_id": "BenchmarkTest03244", "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 on_input = proc { |v| v.to_s.tr(\"\\r\\n\", \" \") }\n data = on_input.call(user_input)\n cookies[:session] = { value: data, secure: true, httponly: true, same_site: :strict }\n render json: { status: \"ok\" }\n end\nend", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cbb38656f4213324615592e5d0cdf90219b25c16fa7453a858f6ad42ddd94677", "structural_hash": "9228baaa4ed630f4b9e03398266da6b6bfbeab9082b0244b36a60f5afbb1008a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02359.sh", "upstream_id": "BenchmarkTest02359", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_X_CUSTOM_HEADER\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _body=$(curl -s \"$data\")\n _want=$(curl -sI \"$data\" | grep -i \"^X-Content-SHA256:\" | tr -d \"\\r\" | cut -d\" \" -f2)\n if [ \"$(printf \"%s\" \"$_body\" | sha256sum | cut -d\" \" -f1)\" != \"$_want\" ]; then echo \"integrity check failed\" >&2; exit 1; fi\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-494"], "category": "download_no_integrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c66aa2c1560c6c2b056eab30eb28f081c1128f08e2ab4c239726a4ed9386a671", "structural_hash": "947b9784fe2e5781f593885ad913c239a2f41bd3a20f434afdea2dfc21533b9d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00327.py", "upstream_id": "BenchmarkTest00327", "language": "python", "code": "from django.http import JsonResponse\ndef benchmark_case(request):\n upload_name = request.FILES['upload'].name\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(upload_name)\n data = collected\n processed = 'true' if str(data).lower() in ('true', '1', 'yes', 'on') else 'false'\n trusted_claim = str(processed)\n return JsonResponse({'trusted': trusted_claim}, status=200)", "label": 0, "cwe": ["CWE-345"], "category": "dataintegrity", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:dataintegrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cc02ce4e3b02da0c41f056fe2a36cbd01be218798bff0629d7995be1053de2cf", "structural_hash": "6e51fa4396f1a1a0192214a00eebac9e8be199df2f423807c88ce74c503fdd09", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04082.php", "upstream_id": "BenchmarkTest04082", "language": "php", "code": "query->get('id', '');\n $data = urldecode($userInput);\n $token = bin2hex(random_bytes(32));\n return new JsonResponse(['token' => (string)$token], 200);\n }\n}", "label": 0, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "45afbd8e9a77a2f9d07510b83f45dc4833495840ad27eb7e67f60863cbcd15f4", "structural_hash": "b6aed4d25ba0c47fd81122bf7f66e7f865523f9be9a02d89538903cf54ca98f8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00245.java", "upstream_id": "BenchmarkTest00245", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.io.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String squeezeSpaces(String v) { return v.replaceAll(\" {2,}\", \" \"); }\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@CookieValue(\"session_token\") String sessionToken, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String cookieValue = sessionToken != null ? sessionToken : \"\";\n String data = squeezeSpaces(cookieValue);\n try (java.io.FileWriter fw = new java.io.FileWriter(\"/var/data/secrets.txt\")) {\n fw.write(data);\n }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-312"], "category": "cleartextstorage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cf327fe0904ad2f7486d4634dbb98f4c8414ff5895d0a5c8a1bdd637b44c4ca3", "structural_hash": "6e174ff643994564250683b303e2ed096a8255bb2daa3a1855d580857fbf6dd7", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_03352.php", "upstream_id": "BenchmarkTest03352", "language": "php", "code": "json('payload', '');\n $data = '';\n foreach (explode(',', $userInput) as $token) { $data = $token; }\n logger()->info('Action: ' . $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-117"], "category": "loginjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cb4bfcff1eeb47426f0e3d2ffba14091bed277ca41663619390916bc5b4e90e7", "structural_hash": "ddf540556bcfcbdd03f8cf845c604b42a27d303d0422d7bc4fc1a4cf6cca990a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_09590.go", "upstream_id": "BenchmarkTest09590", "language": "go", "code": "package testcode\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\trefererValue := c.GetHeader(\"Referer\")\n\tdata := fmt.Sprintf(\"%s\", refererValue)\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-552"], "category": "external_file_access", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "07196d80b5d52a05a1c71f967380015f7d7e57936449fd53e8dc908e0030840b", "structural_hash": "b8ac95a5436fe2b8096e9671be6b7a40f14d6a4f535d386df609c9babeea86ea", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_01022.go", "upstream_id": "BenchmarkTest01022", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\trawBytes, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, \"bad request\", http.StatusBadRequest)\n\t\treturn\n\t}\n\trawBody := string(rawBytes)\n\tlastRequestValue.Store(rawBody)\n\tdata, _ := lastRequestValue.Load().(string)\n\tw.Header().Set(\"Session-Lifetime\", \"1800\")\n\tr = r.WithContext(context.WithValue(r.Context(), ctxKeyData, data))\n}", "label": 0, "cwe": ["CWE-613"], "category": "insufficient_session_exp", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bb2e3def0eb47e0a11a1c18a71cea88da2137f8161b0a64eb2c9bf681777f076", "structural_hash": "d266642ca1eeeae049930d6d00baf807bdf68903541edb36985231c9dbcc56ec", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05931.ts", "upstream_id": "BenchmarkTest05931", "language": "typescript", "code": "import { Controller, Post } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2e21ed3af49d52b7de510ab47172ec7a6a6a1fb69fdc65da4f54fa419938f606", "structural_hash": "d1ac8e2247c4366adfa9ce795686e2056e95f49f9e5d15de09b5cdc1c4389031", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "django/testcode/benchmark_test_00002.py", "upstream_id": "BenchmarkTest00002", "language": "python", "code": "from django.http import JsonResponse\nimport requests\ndef benchmark_case(request):\n ua_value = request.META.get('HTTP_USER_AGENT', '')\n if ua_value:\n data = ua_value\n else:\n data = ''\n requests.get('https://api.pycdn.io/data', params={'q': str(data)}, verify=False)\n return JsonResponse({\"saved\": True})", "label": 1, "cwe": ["CWE-295"], "category": "tlsverify", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:django:tlsverify", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5f2e8933421f1ed5c0141e401c6442ac3980117e99a4e594beaff5bea1a75a6a", "structural_hash": "8bf087d9164900b76f0034330101017a3ae1e6bd16164e56a322573dc8c6dae8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_05284.c", "upstream_id": "BenchmarkTest05284", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n const char *(*_fn)(const char *) = c_passthrough;\n const char *data = _fn(user_input);\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "9b9fad3bee47d06f58f2175974653af46eaeb0ddba996f1bf964376772c09378", "structural_hash": "77355b8f7d9735ea815d85b7f111604a129ebaf822e5fd0685b817f064451fd9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_36502.go", "upstream_id": "BenchmarkTest36502", "language": "go", "code": "package testcode\nimport (\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar gqlReq struct {\n\t\tVariables map[string]string `json:\"variables\"`\n\t}\n\tjson.NewDecoder(r.Body).Decode(&gqlReq)\n\tgraphqlVar := gqlReq.Variables[\"input\"]\n\tvar _b strings.Builder\n\t_b.WriteString(graphqlVar)\n\tdata := _b.String()\n\tencCookie := encryptForStorage(data)\n\thttp.SetCookie(w, &http.Cookie{Name: \"session\", Value: encCookie})\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 0, "cwe": ["CWE-784"], "category": "cookie_no_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_cookie", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "d4a279b5db29f51c6eacc89877cfc5814a6bfcbc37c4d0f7f027b0a22b70b708", "structural_hash": "fcb9badb4fac131a3a56168a1fff6225009a829c71dec3d0603ece99eb6b8ca0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_05597.ts", "upstream_id": "BenchmarkTest05597", "language": "typescript", "code": "import { Controller, createParamDecorator, ExecutionContext, Post, BadRequestException } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\nimport * as zod from \"zod\";\nconst Cookies = createParamDecorator(\n (data: string, ctx: ExecutionContext): string => {\n const request = ctx.switchToHttp().getRequest();\n return request.cookies?.[data] ?? \"\";\n },\n);\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Cookies(\"session_token\") cookieToken: string): Promise {\n const userInput = cookieToken || \"\";\n const data = await Promise.resolve(userInput).then(String);\n const _parsed = zod.z.string().regex(/^[a-zA-Z0-9_.-]+$/).safeParse(data);\n if (!_parsed.success) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = _parsed.data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9ec15ec83e536a58feb533db76c16afe56f63b9ed4c2327e0599d99213d80db", "structural_hash": "1564972df80917d7f9277d0a24f94b111ce07ebaf09e42b542b90fe67725068a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_29460.go", "upstream_id": "BenchmarkTest29460", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\thostValue := c.Request.Host\n\tpending := strings.Split(hostValue, \",\")\n\tvar data string\n\tfor len(pending) > 0 {\n\t\tdata = pending[0]\n\t\tpending = pending[1:]\n\t}\n\tbaseDir := \"/var/app/data\"\n\tcleanPath := filepath.Clean(filepath.Join(baseDir, data))\n\tresolvedPath, resolveErr := filepath.EvalSymlinks(cleanPath)\n\tif resolveErr != nil {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tif resolvedPath != baseDir && !strings.HasPrefix(resolvedPath, baseDir+\"/\") {\n\t\tc.String(http.StatusForbidden, \"access denied\")\n\t\treturn\n\t}\n\tcheckedPath := resolvedPath\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-61"], "category": "symlink_following_unix", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b537d107dc34f61eb423a651cb9110e659985371f2bb77d1fae502249d1b6cbf", "structural_hash": "3273068d87289bc3099d1c0acae0294c348c794a6686a2524f76eb024acbf549", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_24622.js", "upstream_id": "BenchmarkTest24622", "language": "javascript", "code": "const fs = require(\"fs\");\nconst benchmark_case = async (ctx) => {\n const userInput = process.env.USER_INPUT || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n const entries = fs.readdirSync(\"/var/app/data/\" + String(data));\n ctx.body = { listing: entries }; return;\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-209"], "category": "directory_listing_exposure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:directory_listing_exposure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "602fafac09b01d231547312c2ecbf1543da310db3674321752f0b4a68aec86f6", "structural_hash": "62444548ae61a2869fd169ad1d92e62a06baed2bf5a63912dd516cd68ed0bdaa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_07819.c", "upstream_id": "BenchmarkTest07819", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nstatic const char *c_passthrough(const char *s) { return s; }\nstatic const char *c_invoke(const char *(*fn)(const char *), const char *s) { return fn(s); }\nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n const char *data = c_invoke(c_passthrough, user_input);\n pthread_mutex_lock(&_mu);\n _shared = data;\n pthread_mutex_unlock(&_mu);\n}", "label": 0, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8db06420a18d96969341ffad38523066883bac86440006cf02bde4392cb27d0d", "structural_hash": "ab383f41e3741eb5c1d8010e35889d3121998ac9aa1dcd3bbc7c86e86941f74e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_22885.go", "upstream_id": "BenchmarkTest22885", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strings\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sqs\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tpathValue := strings.TrimPrefix(r.URL.Path, \"/api/\")\n\tvalidator := func(s string) bool { return len(s) <= 8192 }\n\tnormalizer := func(s string) string { return strings.Join(strings.Fields(s), \" \") }\n\tvar data string\n\tif validator(pathValue) {\n\t\tdata = normalizer(pathValue)\n\t}\n\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\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-20"], "category": "cloud_queue_publish", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cloud_queue_publish", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f6530b6900442e6bdfbcb9fb3dac50620254ed6ec46f6cbc77a8e53cb02d788f", "structural_hash": "b860d7f775b4521b38b099757359b674f7bb8331cc1c54a43b5d79ad77b6e0f1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02954.rs", "upstream_id": "BenchmarkTest02954", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let xml_value = String::from_utf8_lossy(&body).to_string();\n 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 #[cfg(unix)] { unsafe { libc::setuid(data.parse::().unwrap_or(0)); } }\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bca7685854ad04d906bd3830586298d46df67770303d8fcdfcd34e114cb0ca2f", "structural_hash": "77d811ea32429bbfed2724b30c623834e93ec8066bab24ebbf2b0e265ee10ad3", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_04121.sh", "upstream_id": "BenchmarkTest04121", "language": "bash", "code": "benchmark_case() {\n user_input=\"$PATH_INFO\"\n set -- \"$user_input\" \"http\"\n data=\"$1\"\n _body=$(curl -s \"$data\")\n _want=$(curl -sI \"$data\" | grep -i \"^X-Content-SHA256:\" | tr -d \"\\r\" | cut -d\" \" -f2)\n if [ \"$(printf \"%s\" \"$_body\" | sha256sum | cut -d\" \" -f1)\" != \"$_want\" ]; then echo \"integrity check failed\" >&2; exit 1; fi\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c3e4724b88b3417671ffc652882e323ada5a2b5e4a1dae581d54a0781054b7c3", "structural_hash": "c4320a669568be1ca0e277810f0c43395d8d4a1ca4e6673db5623f1f8f928178", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_19752.sh", "upstream_id": "BenchmarkTest19752", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(sed -n '/^\\r*$/{n;s/\\r$//;p;q}')\"\n normalize() { local _v=\"$1\"; printf \"%s\\n\" \"$_v\"; }\n data=$(normalize \"$user_input\")\n if grep -qxF -- \"$data\" /var/app/known_tokens; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-290"], "category": "auth_bypass_spoofing", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "045c9120dcd4ace2356dc4f00b3e8017e54d57774bcb5fc8e34e716f20b4a254", "structural_hash": "2a893ca23ac0d000fb913279fe7571046d7dd647f70939f428efab804fe4eda6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_02949.rs", "upstream_id": "BenchmarkTest02949", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse reqwest;\nuse urlencoding;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let cookie_value = req.cookie(\"session_token\").map(|c| c.value().to_string()).unwrap_or_default();\n let data = urlencoding::decode(&cookie_value).unwrap_or_default().to_string();\n reqwest::get(&data).await.ok();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e686cd3974740ad74621c339c651d382fe0ad073aeb65f8b4c14508096edef5", "structural_hash": "47164f10ae762342da9077b6afe022c6f9cbd5e9ebcb3205cf94fe3f40998265", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_18777.sh", "upstream_id": "BenchmarkTest18777", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n redis-cli -s /var/run/redis.sock SET \"role:$data\" admin >/dev/null 2>&1\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-286"], "category": "incorrect_user_mgmt", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "cba5c2303f43d7c500ecd3f985d9f1b8b49680f49b7c1a6a3032ac2e09e5ede6", "structural_hash": "3f65ff804b5a1fc20619dad42a44938a275abde0474da6deabc9a29669d5e63e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_34064.go", "upstream_id": "BenchmarkTest34064", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\thostValue := r.Host\n\tdata := BenchSvcPassthrough(hostValue)\n\tif !validSchemaPat.MatchString(data) {\n\t\thttp.Error(w, \"invalid input\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tprocessed := data\n\tr = r.WithContext(context.WithValue(r.Context(), ctxKeyData, processed))\n}", "label": 0, "cwe": ["CWE-501"], "category": "trustbound", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "616c32ffc1cc2c74510445de9b84db69103068ee41c56d243840f12098e2f7ae", "structural_hash": "85e3c50165845fed5adc1c4c3062f21bc1b94eba13986672c1b7ec0a580206cf", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05492.java", "upstream_id": "BenchmarkTest05492", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(@RequestHeader(\"Authorization\") String authorization, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String authHeader = authorization != null ? authorization : \"\";\n java.util.function.Supplier valueSupplier = () -> \"payload:\" + authHeader;\n String data = valueSupplier.get();\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "68dcad15bec8951e8aba5f5f50a80c2a13cbf775cbe406e4ef42b761a4226544", "structural_hash": "b3bfc8cb780b95249e5cc506c9927c11072cc154e28a7938e910cd1fa8036aa6", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03514.sh", "upstream_id": "BenchmarkTest03514", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n data=$(printf \"%b\" \"${user_input//%/\\\\x}\")\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n if ! grep -qxF -- \"$USER:$data\" /etc/app/acl; then\n echo \"403 forbidden\" >&2\n exit 1\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5b3ac4747b11ccb28202f0f2b73a9631c7edcc7688802625308e283c72d11d4b", "structural_hash": "260b9fe358e2551260ab9b39758d4cf0a212d752094ef029f20058a7cce371d1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_27925.go", "upstream_id": "BenchmarkTest27925", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar profileBio string\n\tDB.QueryRow(\"SELECT bio FROM profiles LIMIT 1\").Scan(&profileBio)\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 <- profileBio\n\tclose(_jobs)\n\tdata := <-_out\n\tos.WriteFile(\"/var/data/secrets.txt\", []byte(data), 0644)\n}", "label": 1, "cwe": ["CWE-922"], "category": "insecure_storage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f48b7b2c882d845141638d1865c7b1bf5f1208fcd9a8faf964354bf7ffb67933", "structural_hash": "b1b44ae2a7a64f99e85cc3e2653ee8867817c6b5edbf7b0ba8ca5d42bd9c934d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_06353.go", "upstream_id": "BenchmarkTest06353", "language": "go", "code": "package testcode\nimport (\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tmultipartValue := r.FormValue(\"multipart_field\")\n\tvar _b strings.Builder\n\t_b.WriteString(multipartValue)\n\tdata := _b.String()\n\tlog.Printf(\"User action: %s\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"state\": \"active\"})\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:log_encoding_failure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bc28c05e5e37cca7c4789ffd88aae4aeca6c29d16c7ac6e2e94ab6adb1b3c2c5", "structural_hash": "1f06daedea442612ddeae3af49e7d2ea5b219db9e883e019ca53f04e1b49c877", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest02961.java", "upstream_id": "BenchmarkTest02961", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.util.Map.Entry tuple = java.util.Map.entry(uploadName, \"json\");\n response.setHeader(\"X-Tuple-Context\", tuple.getValue());\n String data = tuple.getKey();\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-1275"], "category": "cookie_no_samesite", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "301ff42536b70acdb5b9b5dc5424e13caf05ef3ca10483df1039a810dba94e8d", "structural_hash": "75e5f275beed3091cd58adcd4d452ec3763c958c5f3b30d6a58b34ef3233818d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00849.php", "upstream_id": "BenchmarkTest00849", "language": "php", "code": "route('id') ?? $request->input('id', ''));\n try { $data = json_decode($userInput, true, 512, JSON_THROW_ON_ERROR)['value'] ?? $userInput; }\n catch (\\JsonException $e) { $data = $userInput; }\n $processed = preg_replace('/[A-Za-z0-9]{4,}/', '****', str_replace([\"\\r\", \"\\n\"], '', (string)$data));\n logger()->info('Action: ' . $processed);\n return response()->json(['ok' => 1]);\n }\n}", "label": 0, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "66793a844d523a365db97b01c3054a85acb80155553aa267f2cc4108c4b20797", "structural_hash": "9d9f49cea5729cba8a3da0941f3936218841c38f9b827a083097e236183b465b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_13351.go", "upstream_id": "BenchmarkTest13351", "language": "go", "code": "package testcode\nimport (\n\t\"context\"\n\t\"net/http\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tvar dbValue string\n\tDB.QueryRow(\"SELECT name FROM users LIMIT 1\").Scan(&dbValue)\n\tcapture := func() string { return dbValue }\n\tdata := capture()\n\tif !verifyBearer(r.Header.Get(\"Authorization\")) {\n\t\thttp.Error(w, \"unauthorized\", http.StatusUnauthorized)\n\t\treturn\n\t}\n\tr = r.WithContext(context.WithValue(r.Context(), ctxKeyData, data))\n}", "label": 0, "cwe": ["CWE-384"], "category": "sessionfixation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:external_trusted_var_init", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e73d1969704f7572999bb2c3dac8d61bf69d1a24b2b44d3c041b7ec168346ba5", "structural_hash": "312fe9dbdcc0b6331e8f7c5f24ba3195a5aa5c40088b2d52c6a7d88d8489bdd9", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02346.php", "upstream_id": "BenchmarkTest02346", "language": "php", "code": "request->get('field', '');\n $data = '' . $userInput;\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return new JsonResponse([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "306abf2c08f16a2eecfc8a04551e080e841dc9f312416af4ebb8d8ec4df2c5a6", "structural_hash": "0d231449fb07281d94428e2244e93f4a53b2c4d94c5df95856573fc8ad70df0d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10241.c", "upstream_id": "BenchmarkTest10241", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"USER_INPUT\");\n if (user_input == NULL) user_input = \"\";\n char data[512];\n size_t _len = strlen(user_input);\n size_t _w = 0;\n while (_w < _len && _w < sizeof(data) - 1) { data[_w] = user_input[_w]; ++_w; }\n data[_w] = '\\0';\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "48cf3ac0b1c871296743ac08075478e54e42cfd819d39a07efa8004fdbc0b343", "structural_hash": "9485168698096e6a43e12dca825e891c4118c739267f1cf74a2e397a8d4ff18b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02632.py", "upstream_id": "BenchmarkTest02632", "language": "python", "code": "from flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n origin_value = request.headers.get('Origin', '')\n 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 return jsonify({'error': str(data), 'stack': repr(locals())}), 500", "label": 1, "cwe": ["CWE-209"], "category": "errormessage", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:debug_code_production", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "091e92474074d27629bae0b8a766e441ae811700ee146c5bba922f65edad1dd1", "structural_hash": "943024db8c57b064cda743069c8576ec5f39953d09da8441ca5ce6020b971b24", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01086.cpp", "upstream_id": "BenchmarkTest01086", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"PATH_INFO\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "69b45f63574026fd9cdb6c07ef8d73de63f78eebaa90e3c5360c7ed0a5f3ac2e", "structural_hash": "70be2efaa5590e791dea8d09fd945d2484854f43a19c04b38c673dfcc535e014", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03126.cpp", "upstream_id": "BenchmarkTest03126", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input + std::string(\"?trace=v\");\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0bb3c2aa0e1701b4f997fdbf2fe4e3e091c1b2776e51b40dbb28282a303243db", "structural_hash": "8cf5971c6c6e3d0c4388686b053cfeb49a71f942372138d39e432069d4c6b068", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01398.c", "upstream_id": "BenchmarkTest01398", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n FILE *_src_fp = fopen(\"/tmp/data\", \"r\");\n if (_src_fp != NULL) {\n if (fgets(user_input_buf, sizeof(user_input_buf), _src_fp) == NULL) user_input_buf[0] = '\\0';\n fclose(_src_fp);\n }\n const char *user_input = user_input_buf;\n const char *data = (strlen(user_input) > 0) ? user_input : \"\";\n regex_t _re;\n const char *safe = data;\n if (regcomp(&_re, \"^[a-zA-Z0-9_-]+$\", REG_EXTENDED) == 0) {\n if (regexec(&_re, data, 0, NULL, 0) != 0) safe = \"config\";\n regfree(&_re);\n }\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", safe); fclose(_f); }\n}", "label": 0, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3e58f8aac6225a98c89a1619617db4831f047ac0069ccbd2229444d20d8873d2", "structural_hash": "f207746b4e091591706b44b1fb6a4c8233567f545eee80ad85e2860957a1af3c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_32838.go", "upstream_id": "BenchmarkTest32838", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tfieldValue := c.PostForm(\"field\")\n\tform := FormData{Payload: fieldValue}\n\tdata := form.Payload\n\tcheckedPath := filepath.Join(\"/var/app/data\", filepath.Base(data))\n\tcontent, err := os.ReadFile(checkedPath)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 0, "cwe": ["CWE-73"], "category": "external_control_path", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "10655cb3b3c4d4056e95cbb53299370ec4eee59f61256df104651632fb38084a", "structural_hash": "462e9ed3a3953746e2912cd4a7747905d633ea619cdfffd823247e333c4b6c9a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_01002.ts", "upstream_id": "BenchmarkTest01002", "language": "typescript", "code": "import { Controller, Post, BadRequestException } from \"@nestjs/common\";\nimport * as shared from \"./shared\";\nconst { db } = shared;\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\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 pending: string[] = String(userInput).split(',');\n const collected: string[] = [];\n while (pending.length) { collected.push(pending.shift() ?? \"\"); }\n const data: string = collected.join(',');\n if (![\"asc\",\"desc\",\"name\",\"created\"].includes(data)) { throw new BadRequestException({error:\"invalid\"}); }\n const processed = data;\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + processed + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 0, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "63123751c64f94dadd1a3043341c8d3b4b9496c864f433969838239c68a60af8", "structural_hash": "b05ecaffc43ce890d57a744b57a0111dc4c5816746fdaa1701e642e32e72f6f1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "koa/testcode/benchmark_test_14002.js", "upstream_id": "BenchmarkTest14002", "language": "javascript", "code": "const { db } = require(\"./shared\");\nconst benchmark_case = async (ctx) => {\n const userInput = (ctx.request.body && ctx.request.body.payload) || \"\";\n const tokens = String(userInput).split(',');\n const data = tokens.join(',');\n db.execute(\"UPDATE accounts SET locked = 1 WHERE owner = ?\", [String(data)]);\n ctx.body = { ack: true };\n}\nmodule.exports = { benchmark_case };", "label": 1, "cwe": ["CWE-391"], "category": "unchecked_error", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:koa:error_condition_detect", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "916a7cc0b056b8cc0fce5dd68453aa1211208652c488f73448542ac278c1b6da", "structural_hash": "35e9a96a5c2920eccf32e7ce6e67c4bc1edfde760c686239c08d8af8ab61c620", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08578.sh", "upstream_id": "BenchmarkTest08578", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_ORIGIN\"\n if _parsed=$(printf \"%d\" \"${user_input}\" 2>/dev/null); then\n data=\"$_parsed\"\n else\n data=\"${user_input}\"\n fi\n case \"$data\" in */public|*/static|*/.) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-424"], "category": "improper_alt_path_protect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2af233ad6477f71ec695fea32418b70663333314147c404ac38062237e2c3f07", "structural_hash": "2cfa48a04a39b5e52e9c82ae24773ad9bd3a915fdb785de15d94473cb9403ebb", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_32983.sh", "upstream_id": "BenchmarkTest32983", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_COOKIE\"\n _body=$(curl -s \"$user_input\")\n _want=$(curl -sI \"$user_input\" | grep -i \"^X-Content-SHA256:\" | tr -d \"\\r\" | cut -d\" \" -f2)\n if [ \"$(printf \"%s\" \"$_body\" | sha256sum | cut -d\" \" -f1)\" != \"$_want\" ]; then echo \"integrity check failed\" >&2; exit 1; fi\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-829"], "category": "untrusted_func_inclusion", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "0e716d997ef6ca9dbf7b06371170210106414fb666cf00cc5cae5816f679ba94", "structural_hash": "39375ea133cdc8d891417ef694b8dfc19bd23387b7e18bcd51af9d18c4c45b5a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_04988.ts", "upstream_id": "BenchmarkTest04988", "language": "typescript", "code": "import { Controller, Headers, Post } from \"@nestjs/common\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Headers(\"authorization\") auth: string): Promise {\n const userInput = auth || \"\";\n const data = String(userInput).replace(/\\u0000/g, \"\");\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "7019348a71e863e5642b408a3f30cc57bc249373f71a90e7c673c1cd605ee0f7", "structural_hash": "6910e8286289592e4d527ff26e9143d2f15db4c8cfbe7c29ee4a848889887afd", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_01767.php", "upstream_id": "BenchmarkTest01767", "language": "php", "code": "getContent();\n $data = sprintf('%s', $userInput);\n file_put_contents('/var/data/output', (string)$data);\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-522"], "category": "credprotection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:cleartextstorage", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ead22da7eb8106c6b80b919cc746d55dccfb939f115ec74a19f38f05e97dd71e", "structural_hash": "cd5b61633e04d473f94b240671c07e96ba2723ac5852c0d99bbcfade936de492", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_00825.php", "upstream_id": "BenchmarkTest00825", "language": "php", "code": "header('Origin', '');\n $data = ($userInput !== null) ? $userInput : '';\n logger()->info('Action: ' . $data);\n return response()->json(['ok' => 1]);\n }\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "50e1ba856dbdb0c36ec119525ff60bb05aae647ae877456a7285e67538ef9795", "structural_hash": "5cb63cf75d524ea055037d754364b76013027015f00c4442aa641a88eb25e134", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_05410.rs", "upstream_id": "BenchmarkTest05410", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(mut multipart: axum::extract::Multipart) -> impl IntoResponse {\n let multipart_value = {\n let mut _mv = String::new();\n if let Ok(Some(_field)) = multipart.next_field().await {\n _mv = _field.text().await.unwrap_or_default();\n }\n _mv\n };\n let data = multipart_value.split_whitespace().collect::>().join(\" \");\n let _ciphertext = crate::shared::encrypt(&data);\n tokio::fs::write(\"/var/data/cipher.bin\", _ciphertext.as_bytes()).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 0, "cwe": ["CWE-327"], "category": "weakcipher", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:weakcipher", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "bf92917c2b456ec0a4fe05a79e1c891e163f71a18dac1c83acf5d1dfb1abf701", "structural_hash": "54b2e61906b5c621d6fcd2ef2e0d962c5399daf9279b8296d6a573d5eba3cf93", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_04210.php", "upstream_id": "BenchmarkTest04210", "language": "php", "code": "headers->get('Authorization', '');\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $userInput, $allowedActions, true)) { return new JsonResponse([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "3f3bbf4f67eb2f422b4a399510eb14de85311ee6150a24dbc9a418801133e2cf", "structural_hash": "90738b85546adde655a06a0a53e4a796b6d0198197589a9da1cb899e5fada808", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_00069.py", "upstream_id": "BenchmarkTest00069", "language": "python", "code": "import hashlib\nimport os\nfrom flask import Flask, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n env_value = os.environ.get('USER_INPUT', '')\n collected = None\n def on_ready(value):\n nonlocal collected\n collected = value\n on_ready(env_value)\n data = collected\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return jsonify({'digest': str(digest)}), 200", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "093815e7968444d4e66802d5596ce17bbbe79b734e9800a49c84edb8be106222", "structural_hash": "3d3a3ee56a81feac29820fb66c323c19da9fe28d81353462386ddc0c2c3ae034", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02144.py", "upstream_id": "BenchmarkTest02144", "language": "python", "code": "import json\nfrom flask import Flask, request, jsonify\nimport socket\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n data = json.loads(graphql_var).get('value', '')\n s = socket.create_connection((str(data), 80))\n s.close()\n return jsonify({\"result\": \"success\"})", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8968c621cdbf72da6a09a38963bf5a240dcdeedf4830b5ecc70c79b954eaf3dc", "structural_hash": "40c084ae966103ea9551d3f381638b4234bbb6ad50b23d56320852999ef42293", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02748.rs", "upstream_id": "BenchmarkTest02748", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let host_value = headers.get(\"host\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(host_value.clone());\n crate::shared::set_cookie(&format!(\"session={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4da9e34ffdfa31518d11e547ed438e1d15cee5a617b581965ac56787c4f0b50e", "structural_hash": "77f7aebb258c36e87684b444521cef071f0da460827f356dea36f2cae892d7ce", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01453.sh", "upstream_id": "BenchmarkTest01453", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(cat /dev/stdin)\"\n strutils::require() { [ -n \"$1\" ] || return 1; printf \"%s\" \"$1\"; }\n data=$(strutils::require \"$user_input\") || data=\"$user_input\"\n case \"$data\" in localhost|internal-gateway) echo \"granted\" >> /var/log/auth.audit; exit 0;; esac\n}\nbenchmark_case \"$@\"", "label": 1, "cwe": ["CWE-940"], "category": "unverified_comm_source", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e2306f43dbf0f2ecb16a169d64324e780ceb98e9753b9c5f06fb01c3d82dc830", "structural_hash": "25024f07dd5ba8ec39da6a83b1386b6e5e30c66d9bd624cd6ffe1827a17cb31b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_04717.rb", "upstream_id": "BenchmarkTest04717", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n enable :sessions\n post \"/benchmark_case\" do\n user_input = request.env[\"HTTP_USER_AGENT\"].to_s\n data = !user_input.empty? ? user_input : ''\n unless session[:role] == \"admin\"\n halt 403, JSON.generate({ error: \"forbidden\" })\n return\n end\n _decision = data.to_s\n end\nend", "label": 0, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "88c6f70dd0df42e776ae9617e3e67e93a1bb58893cc5249ffc7c87a1764899eb", "structural_hash": "7c43e7af780e9e0b8e2fca1b4f7cac34ec02fc741ac9a6f40bf8510c741c1db0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00021.java", "upstream_id": "BenchmarkTest00021", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"text/plain\")\n public void benchmark_case(@RequestBody String rawBody, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String rawData = rawBody != null ? rawBody : \"\";\n java.util.Deque pending = new java.util.ArrayDeque<>(java.util.Arrays.asList(rawData.split(\",\")));\n java.util.List lowered = new java.util.ArrayList<>();\n while (!pending.isEmpty()) { lowered.add(pending.poll().toLowerCase()); }\n String data = String.join(\",\", lowered);\n response.addCookie(new Cookie(\"session\", data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "ef6896890c6a986cbc3b4e917ff197f2cd739ce24df1bb61a17c5edbbab560f5", "structural_hash": "a6ff9d6be53665f7ccbf4794938fe6dc0946d8a6f4c63bd293d04d7617c7bd93", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "rails/testcode/benchmark_test_03911.rb", "upstream_id": "BenchmarkTest03911", "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.gsub(\"\\u0000\", \"\")\n token = rand(1000000)\n render json: { status: \"ok\" }\n end\nend", "label": 1, "cwe": ["CWE-330"], "category": "weakrand", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:rails:weakrand", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "57396899a6ee502eeeea831c8ce12ee48eab14c73ea7ada22b7996df9c8fda86", "structural_hash": "aeddebe99d26ba710a2567dbd931616869f9c2ab60466d54f75a4b530fb6dad0", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "nestjs/testcode/benchmark_test_02849.ts", "upstream_id": "BenchmarkTest02849", "language": "typescript", "code": "import { Controller, Post, Req } from \"@nestjs/common\";\nimport { Request } from \"express\";\nimport * as xpath from \"xpath\";\nimport * as xmldom from \"@xmldom/xmldom\";\n@Controller(\"benchmark\")\nexport class BenchmarkController {\n @Post(\"benchmark_case\")\n async benchmark_case(@Req() req: Request): Promise {\n const userInput = (req.body as string) || \"\";\n const capture = (v: string) => (): string => v;\n const readInput = capture(userInput);\n const data: string = readInput();\n const xmlDoc = new (xmldom.DOMParser)().parseFromString(\"\", \"text/xml\");\n xpath.select(\"//user[name='\" + data + \"']\", xmlDoc);\n return { created: true };\n }\n}", "label": 1, "cwe": ["CWE-643"], "category": "xpathi", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:typescript:nestjs:xpathi", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f1561c0d6cd0c33ce7fca7220b0cd38509e38db6a30de24d7cc2fc72d873c213", "structural_hash": "35d85dc924f59c7a38d097b4cf61f5daeb59997c0c502a21d2d6a85805196a42", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_00886.rb", "upstream_id": "BenchmarkTest00886", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:q].to_s\n _accessor = :to_s\n data = user_input.public_send(_accessor)\n Process::Sys.setuid(65534)\n content_type :json\n JSON.generate({ result: \"ok\" })\n end\nend", "label": 0, "cwe": ["CWE-269"], "category": "privescalation", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1d89520b602e8367506b687f6ab8a0a286fd3734a40cb7838fe8a249024c278d", "structural_hash": "d61bfa4f5daa0b6ee41abefb74493880cf46a0369a9a75a1cc3667374d095e82", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "laravel/testcode/benchmark_test_02229.php", "upstream_id": "BenchmarkTest02229", "language": "php", "code": "header('X-Forwarded-For', '');\n return response('' . (string)$userInput . '')->header('Content-Type', 'text/html')->header('X-Frame-Options', 'DENY')->header('Content-Security-Policy', \"frame-ancestors 'none'\");\n }\n}", "label": 0, "cwe": ["CWE-1021"], "category": "clickjacking", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:laravel:clickjacking", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "260cbf2e1cede0337f203d6ad33c2339b36da5e7228348e3e31ed88b5dc7c9da", "structural_hash": "1ac90bcaf1a75009a5199bdb97926588a95558ee470f0485f5be393477f7e2f5", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_03782.php", "upstream_id": "BenchmarkTest03782", "language": "php", "code": "headers->get('Referer', '');\n $data = '' . $userInput;\n if (!hash_equals((string)($request->getSession()->get('user', '')), (string)($data))) { throw new HttpException(403, 'forbidden'); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 0, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "365eb792dc74af5ea6ee98ec9aec7bec8472fda8f6e577e16741ab4f1e508e1f", "structural_hash": "4259719012d1bce255a8b32968f5ad5d1ad84cfde88402eb35628a78488e592a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05486.py", "upstream_id": "BenchmarkTest05486", "language": "python", "code": "from fastapi import FastAPI, Request\nfrom pydantic import BaseModel\nfrom app_runtime import db, User\nclass UserInput(BaseModel):\n payload: str = ''\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request, req: UserInput):\n json_value = req.payload\n if json_value:\n data = json_value\n else:\n data = ''\n db.session.query(User).filter(User.id == data).all()\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-89"], "category": "sqli", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:sqli", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "5e489a0c9730e5f2a6f48bfced1fa9689134c6f223ce70a20caa38a51292e74a", "structural_hash": "e6cc1f39ef709a3e8f637e805d71446542535d4f781b88405207a80024143798", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_03198.sh", "upstream_id": "BenchmarkTest03198", "language": "bash", "code": "benchmark_case() {\n user_input=\"$HTTP_REFERER\"\n _len_guard() { [ \"${#1}\" -le 8192 ]; }\n _normalize() { printf \"%s\" \"$1\" | sed \"s/^[[:blank:]]*//;s/[[:blank:]]*$//\"; }\n declare -A _handlers=([guard]=_len_guard [normalize]=_normalize)\n data=\"\"\n if \"${_handlers[guard]}\" \"$user_input\"; then data=$(\"${_handlers[normalize]}\" \"$user_input\"); fi\n if [ \"$USER_ROLE\" != \"admin\" ]; then echo \"forbidden\" >&2; exit 1; fi\n if [ \"$data\" = \"S3cr3tToken\" ]; then echo \"granted\" >> /var/log/auth.audit; exit 0; fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-1390"], "category": "weak_auth_generic", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:auth_bypass_alt_name", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "4e06be188c98c371ac9f381dd6a9fe40b694e6a7b9a0baeb0590b7d0cecb0f7b", "structural_hash": "bc4f46899640e6b9aa7b5c176b55ce7ce0cb5704e1be30901a0b40a2adb24626", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01292.cpp", "upstream_id": "BenchmarkTest01292", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Carrier { std::string value; void set(const std::string &v) { value = v; } const std::string &get() const { return value; } };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Carrier _carrier;\n _carrier.set(user_input);\n std::string data = _carrier.get();\n if (std::time(nullptr) > 1735689600LL) {\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n }\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "6e6d6bc81136c4dc22650727350b5c7b07565eb49442ac1bc0d4f7cdfc6e5091", "structural_hash": "0d6462307b94b54a265004ad16da1583d28ae302c8f46c97439e60cfe42e2f8d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "gin/testcode/benchmark_test_20209.go", "upstream_id": "BenchmarkTest20209", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"os\"\n\t\"strings\"\n\t\"github.com/gin-gonic/gin\"\n)\nfunc benchmark_case(c *gin.Context) {\n\tforwardedIP := c.GetHeader(\"X-Forwarded-For\")\n\t_prefix := \"\"\n\tif len(forwardedIP) > 0 {\n\t\t_prefix = strings.ToLower(forwardedIP[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = forwardedIP\n\tcase \"f\":\n\t\tdata = forwardedIP\n\tdefault:\n\t\tdata = forwardedIP\n\t}\n\tcontent, err := os.ReadFile(\"/var/app/data/\" + data)\n\tif err != nil {\n\t\tc.String(http.StatusNotFound, \"not found\")\n\t\treturn\n\t}\n\tc.Data(200, \"text/plain\", content)\n}", "label": 1, "cwe": ["CWE-36"], "category": "absolute_path_traversal", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:gin:absolute_path_traversal", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "21f22c9209784c455b6c3e665f3e7e36f1483532dcc982e61704994bfa8f004a", "structural_hash": "3c1ec52980c36b6ae73ac83bdd4eb1da95931212f30ddf4c12dd8f9e8980564f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest05309.java", "upstream_id": "BenchmarkTest05309", "language": "java", "code": "import jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport java.net.*;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static final java.util.concurrent.atomic.AtomicReference holder = new java.util.concurrent.atomic.AtomicReference<>();\n @GetMapping(\"/benchmark_case\")\n public void benchmark_case(HttpServletRequest request, HttpServletResponse response) throws Exception {\n String dotenvValue = java.util.Optional.ofNullable(System.getenv(\"DOTENV_VAR\")).orElse(\"\");\n holder.set(dotenvValue);\n String data = holder.get();\n if (!data.matches(\"^[^\\\\x00-\\\\x08\\\\x0e-\\\\x1f\\\\x7f]+$\")) {\n response.sendError(400, \"forbidden\"); return;\n }\n URL url = java.net.URI.create(\"http://api.svc.local/data?ref=\" + java.net.URLEncoder.encode(data, java.nio.charset.StandardCharsets.UTF_8)).toURL();\n HttpURLConnection conn = (HttpURLConnection) url.openConnection();\n try {\n conn.connect();\n conn.getInputStream().close();\n } finally { conn.disconnect(); }\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-319"], "category": "cleartexttransmit", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cleartexttransmit", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2540d1b6b223ad5ec8a4f1398a99121db6673a90f052df01da8468ab42c2d13c", "structural_hash": "db43f7a6bbdf93b38d24137aa085ebe4779c0cc7b16fed0288bc70257800989a", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10131.c", "upstream_id": "BenchmarkTest10131", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *c_shared_input;\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n const char *user_input = getenv(\"DB_ROW_VALUE\");\n if (user_input == NULL) user_input = \"\";\n c_shared_input = user_input;\n const char *data = c_shared_input;\n if (getenv(\"APP_ENV\") == NULL || strcmp(getenv(\"APP_ENV\"), \"test\") != 0) {\n FILE *_f = fopen(\"/var/app/hooks/generated.sh\", \"w\");\n if (_f) { fprintf(_f, \"%s\\n\", data); fclose(_f); }\n }\n}", "label": 1, "cwe": ["CWE-96"], "category": "static_code_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:static_code_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "37076f9d94e7b0b180bcad696e8317f2d0816ff0a63f7d70cd1f84bd6b10a47c", "structural_hash": "aea12f4ca7d57d9d81a4392166b05c24700fc1a9f35a399e41fe822f465ca039", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_05366.rb", "upstream_id": "BenchmarkTest05366", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = DB[:comments].first&.fetch(:text, \"\").to_s\n _prefix = user_input[0,1].downcase\n data = case _prefix\n when 'h' then user_input.downcase\n when 'f' then user_input.upcase\n else user_input.strip\n end\n if %w[read write admin].include?(data.to_s)\n halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "1b012934eca41eba6275300937336a9e6cd873a5752735ef2ce41905c390330c", "structural_hash": "a64bf76bf1ee26066e0188797fa0b76d84ccf88c7490fd05cdccb239ee8b0b96", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05508.py", "upstream_id": "BenchmarkTest05508", "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 = '%s' % (multipart_value,)\n return JSONResponse({'status': 'ok'}, status_code=200, headers={'Content-Language': str(data)})", "label": 1, "cwe": ["CWE-93"], "category": "crlfinjection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:crlfinjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8c49cb95a5a3b46070fca262c4d07d977016fd8349e3f572815096c02032aa51", "structural_hash": "8b0028f733ab7270d5af3fe9aad2b732bcf1969f9eceed1d3e1b8f5103483ece", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_08621.c", "upstream_id": "BenchmarkTest08621", "language": "c", "code": "#define _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 *_dst = malloc(16);\n if (_dst) { strncpy(_dst, user_input, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "00ebbea8210850cc4d9421e51769c89ef3f628d8a791d8d82e19741f673a92a5", "structural_hash": "497753f6c49c7f2fef6478f31aae202cccace4b4b317c64211433e0fb122288e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_02866.rs", "upstream_id": "BenchmarkTest02866", "language": "rust", "code": "use axum::response::IntoResponse;\nuse axum::response::Json;\nuse base64::Engine;\nuse base64::engine::general_purpose;\npub async fn benchmark_case() -> impl IntoResponse {\n let db_value = crate::shared::db_fetch_one(\"SELECT name FROM users LIMIT 1\");\n let data = String::from_utf8_lossy(&general_purpose::STANDARD.decode(&db_value).unwrap_or_default()).to_string();\n tokio::fs::remove_file(format!(\"/var/app/data/{}\", data)).await.ok();\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-22"], "category": "pathtraver", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:pathtraver", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "b88e03abfc3c71e6b01c24c162a7982693bf850d1fae35f1004811fe51fc6923", "structural_hash": "f1d43c5bfc1b92998db36c2ad8bd47b1ac24ac8f4c89f560ea57cc180dde24d8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_10482.c", "upstream_id": "BenchmarkTest10482", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \nvoid benchmark_case(int argc, char **argv)\n{\n const char *user_input = (argc > 1) ? argv[1] : \"\";\n char data[512];\n size_t _li = 0;\n for (; user_input[_li] != '\\0' && _li < sizeof(data) - 1; ++_li) data[_li] = user_input[_li];\n data[_li] = '\\0';\n char *_dst = malloc(16);\n if (_dst) { strncpy(_dst, data, 15); _dst[15] = '\\0'; printf(\"%s\\n\", _dst); free(_dst); }\n}", "label": 0, "cwe": ["CWE-122"], "category": "heap_buffer_overflow", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:heap_buffer_overflow", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "89cc10da9aa69f2ec9c4294cee3ee5b8d328b75e66c19529aa40bdc1957594b1", "structural_hash": "c70e85e1e2f4db180df4ac1b02f26aeda883553535660bd7ef5e1c99b7e2f818", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01085.cpp", "upstream_id": "BenchmarkTest01085", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstruct Payload { std::string value; };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"USER_INPUT\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n Payload _pd{user_input};\n std::string data = _pd.value;\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e7c7e2a7bd48593a8852928f9de28e15a30a9ad1ffe202a09938fce547c65996", "structural_hash": "0a56763ce63c0f17aafd3572d00122c8739d6f1ef044839671172cbcc278283c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04189.rs", "upstream_id": "BenchmarkTest04189", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse serde_yaml;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let forwarded_ip = req.headers().get(\"x-forwarded-for\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let mut pending: std::collections::VecDeque = forwarded_ip.split(',').map(String::from).collect();\n let mut data = String::new();\n while let Some(item) = pending.pop_front() { data = item; }\n let _: serde_yaml::Value = serde_yaml::from_str(&data).unwrap_or_default();\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-502"], "category": "deserial", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:deserial", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "e9d8012027d86bd09917daeaa6ecb2f98a36690d32e9a9676a990532e21ace4a", "structural_hash": "c216d8bf6d640e2a2088ecc0e9ff93202f1dc626fad71d8da42c381301fea869", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest03340.java", "upstream_id": "BenchmarkTest03340", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\n@RestController\npublic class benchmark_case {\n private static String normalize(String v) { return v.strip(); }\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"multipart_field\") String multipartField, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String multipartValue = multipartField != null ? multipartField : \"\";\n String data = normalize(multipartValue);\n Cookie cookie = new Cookie(\"session\", data);\n cookie.setSecure(true);\n cookie.setHttpOnly(true);\n cookie.setAttribute(\"SameSite\", \"Strict\");\n cookie.setMaxAge(28800);\n response.addCookie(cookie);\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 0, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "86ef8d56721b30a76f2586bfb33306689aaf358d921730e775091b3ca384a8a9", "structural_hash": "214b736d4738b0075072c3b1f1b6e499d09619dab48bc1d0b9a5c0c097aaa96b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_00707.cpp", "upstream_id": "BenchmarkTest00707", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_COOKIE\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data;\n switch (user_input.empty() ? '\\0' : user_input[0]) {\n case '\\0':\n data.clear();\n break;\n default:\n data = user_input;\n break;\n }\n std::string _hurl = data;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 1, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "edd0cdfb438f66ac162b9b7cf8ba30aef929569512dfa2b07768ab41566bbb5b", "structural_hash": "d0f6031da207268f5f3ba440d26746f1e5043e0d636c75004295496f18b3cd2f", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_03462.rs", "upstream_id": "BenchmarkTest03462", "language": "rust", "code": "use axum::body::Bytes;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(body: Bytes) -> impl IntoResponse {\n let graphql_var = serde_json::from_slice::(&body).ok().and_then(|v| v.get(\"variables\").and_then(|vs| vs.get(\"input\")).and_then(|i| i.as_str()).map(|s| s.to_string())).unwrap_or_default();\n crate::shared::set_cookie(&format!(\"session={}\", graphql_var));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "f30ef1b6750e61461094a0c6eba60311ae385267f14cbfeaa945f37917ff4a5b", "structural_hash": "13df27d11b0d32d157555356cc332b539149719fbf5835bf9d9316120997b995", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "sinatra/testcode/benchmark_test_02992.rb", "upstream_id": "BenchmarkTest02992", "language": "ruby", "code": "require \"sinatra\"\nrequire \"json\"\nrequire \"uri\"\nrequire \"openssl\"\nclass benchmark_case < Sinatra::Base\n post \"/benchmark_case\" do\n user_input = params[:upload][:filename].to_s rescue \"\"\n holder = Struct.new(:value).new(user_input.to_s)\n data = holder.value\n if %w[read write admin].include?(data.to_s)\n halt 200, JSON.generate({ access: \"granted\", role: \"admin\" })\n end\n end\nend", "label": 1, "cwe": ["CWE-862"], "category": "authzfailure", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:ruby:sinatra:authzfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "74d8cd6c8ba19fa5d7faf564a23ac23a2aadec5e97a5b1e094dd1613f9e16eec", "structural_hash": "a7904fab1bdcf36d9cee3e73b50087daf5d5f2c6bbe0c29fce131240c1d1cbd1", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_01123.sh", "upstream_id": "BenchmarkTest01123", "language": "bash", "code": "benchmark_case() {\n user_input=\"$(tr '&' '\\n' | grep '^field=' | cut -d= -f2-)\"\n data=$(printf \"%s\" \"$user_input\")\n _body=$(curl -s \"$data\")\n _want=$(curl -sI \"$data\" | grep -i \"^X-Content-SHA256:\" | tr -d \"\\r\" | cut -d\" \" -f2)\n if [ \"$(printf \"%s\" \"$_body\" | sha256sum | cut -d\" \" -f1)\" != \"$_want\" ]; then echo \"integrity check failed\" >&2; exit 1; fi\n printf \"%s\" \"$_body\" > /var/app/feed.dat\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-353"], "category": "missing_integrity_check", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:download_no_integrity", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "482890bfb0c71080eece1f2a02130dea0b627fcacc222703555e9d730e8ff570", "structural_hash": "54479d4a12b50e9213a891c5ac742dacfa8b0574012ca10c45bc96c454200746", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "net_http/testcode/benchmark_test_37298.go", "upstream_id": "BenchmarkTest37298", "language": "go", "code": "package testcode\nimport (\n\t\"net/http\"\n\t\"strings\"\n)\nfunc benchmark_case(w http.ResponseWriter, r *http.Request) {\n\tforwardedIP := r.Header.Get(\"X-Forwarded-For\")\n\t_prefix := \"\"\n\tif len(forwardedIP) > 0 {\n\t\t_prefix = strings.ToLower(forwardedIP[:1])\n\t}\n\tvar data string\n\tswitch _prefix {\n\tcase \"h\":\n\t\tdata = forwardedIP\n\tcase \"f\":\n\t\tdata = forwardedIP\n\tdefault:\n\t\tdata = forwardedIP\n\t}\n\tauthVerify(\"user\", data)\n\tRespondJSON(w, http.StatusOK, map[string]string{\"auth\": \"ok\"})\n}", "label": 1, "cwe": ["CWE-258"], "category": "empty_password_config", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:go:net_http:cleartext_in_file", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "8689793ae31d99bbae9c9a05a684ee4805f67658bd8183c7aa2bc0dcae1bf44d", "structural_hash": "aeb3d46276ff00c5ab32e24786fbc36519ee54cd00f10641d2e11508359f2b2d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "axum/testcode/benchmark_test_00418.rs", "upstream_id": "BenchmarkTest00418", "language": "rust", "code": "use axum::http::HeaderMap;\nuse axum::response::IntoResponse;\nuse axum::response::Json;\npub async fn benchmark_case(headers: HeaderMap) -> impl IntoResponse {\n let auth_header = headers.get(\"authorization\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let data = auth_header.replace(\"\\t\", \" \");\n crate::shared::set_cookie(&format!(\"session={}\", data));\n Json(serde_json::json!({\"count\": 0})).into_response()\n}", "label": 1, "cwe": ["CWE-1004"], "category": "cookie_no_httponly", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:axum:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "a6b945fc96d98052b48c13c8fd96eb03e0ef95dc1293e09bf6980f85912779ba", "structural_hash": "83a59ad33c872e30d7d64c3496b8ed963257c428c4236a52583278ef5b26ad7e", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_28906.sh", "upstream_id": "BenchmarkTest28906", "language": "bash", "code": "benchmark_case() {\n user_input=\"$USER_COMMENT\"\n REQUEST_LAST_INPUT=\"$user_input\"\n data=\"$REQUEST_LAST_INPUT\"\n _schema_re='^[A-Za-z0-9_ @-]+$'\n if [[ ! \"$data\" =~ $_schema_re ]]; then echo \"invalid schema\" >&2; exit 1; fi\n processed=\"$data\"\n input_value=\"$processed\"\n if [[ \"$input_value\" =~ [a-zA-Z0-9_-]+ ]]; then\n printf \"X-Validated: %s\\r\\n\" \"$input_value\"\n fi\n}\nbenchmark_case \"$@\"", "label": 0, "cwe": ["CWE-20"], "category": "inputval", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:bash:standalone:inputval", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "99909a391d08407408c4b0357f3b196e990fadf4533c7a9e434afb3e5f0261ec", "structural_hash": "2a745f015da9f247baab7ece7e4459f02c3706b8439af926390fc3014bc25560", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "fastapi/testcode/benchmark_test_05909.py", "upstream_id": "BenchmarkTest05909", "language": "python", "code": "from fastapi import FastAPI, Request\nimport subprocess\napp = FastAPI()\n@app.post(\"/benchmark_case\")\nasync def benchmark_case(request: Request):\n ua_value = request.headers.get('user-agent', '')\n data = str(ua_value).replace('\\x00', '')\n subprocess.run(['echo', data], shell=False)\n return {\"updated\": True}", "label": 0, "cwe": ["CWE-88"], "category": "argument_injection", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:fastapi:argument_injection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "224370d628c17752e8b3ea43a712627ce8ee8fcdd80636bc302625f3292266d8", "structural_hash": "5206e9ce142bce52029a808bf9483d76b2d1a0e0976fea9ac6d5f915062c697c", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_03595.py", "upstream_id": "BenchmarkTest03595", "language": "python", "code": "from urllib.parse import urlparse\nimport ipaddress\nimport socket\nfrom flask import Flask, request, jsonify\nimport json\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n graphql_var = (request.get_json(silent=True) or {}).get('variables', {}).get('input', '')\n try:\n data = json.loads(graphql_var).get('value', graphql_var)\n except (json.JSONDecodeError, AttributeError):\n data = graphql_var\n parsed = urlparse(data)\n resolved = socket.gethostbyname(parsed.hostname or data)\n if ipaddress.ip_address(resolved).is_private:\n return jsonify({'error': 'private range blocked'}), 403\n target_url = data.replace(parsed.hostname, resolved) if parsed.hostname else data\n s = socket.create_connection((str(target_url), 80))\n s.close()\n return jsonify({\"result\": \"success\"})", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "367f7973a56f9d3be9576c67e754e227cbeb26564630e46fb30847664464db5c", "structural_hash": "091746bb37cdca5ea730d08937023314d81b25d509f363773e4e5bdf4071bb8d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_11801.c", "upstream_id": "BenchmarkTest11801", "language": "c", "code": "#define _XOPEN_SOURCE 700\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nstatic const char *_shared;\nstatic pthread_mutex_t _mu = PTHREAD_MUTEX_INITIALIZER;\nstatic const char *c_passthrough(const char *s) { return s; }\nvoid benchmark_case(int argc, char **argv)\n{\n (void)argc; (void)argv;\n char user_input_buf[256];\n user_input_buf[0] = '\\0';\n long _clen = 0;\n const char *_cl = getenv(\"CONTENT_LENGTH\");\n if (_cl != NULL) _clen = strtol(_cl, NULL, 10);\n if (_clen > 0) {\n size_t _rn = (size_t)_clen < sizeof(user_input_buf) - 1 ? (size_t)_clen : sizeof(user_input_buf) - 1;\n size_t _got = fread(user_input_buf, 1, _rn, stdin);\n user_input_buf[_got] = '\\0';\n }\n const char *user_input = user_input_buf;\n const char *data = c_passthrough(user_input);\n _shared = data;\n}", "label": 1, "cwe": ["CWE-362"], "category": "race_condition", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:c:standalone:race_condition", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "c9fdcb5b43278c39c9a294f977874572e2c47f80b4fe9a585964c074edcc8e3b", "structural_hash": "9592be73e2ec9f76953371ad5c74c4b55692e6fea08e6005ce5486bed1c768cc", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02471.cpp", "upstream_id": "BenchmarkTest02471", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nstd::string cpp_module_transform(const std::string &s);\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"REQUEST_BODY\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = cpp_module_transform(user_input);\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "70bfedb41b8add101bf95dabbe79ba85966181543dd548710d0273414e835cec", "structural_hash": "e7cd6869176279537309852d9acdf0be0d4f9b6365afc442e349bb4b2a827b89", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02647.py", "upstream_id": "BenchmarkTest02647", "language": "python", "code": "import hashlib\nfrom flask import Flask, request, jsonify\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n xml_value = request.get_data(as_text=True)\n data = f'{xml_value!s}'\n digest = hashlib.md5(str(data).encode()).hexdigest()\n return jsonify({'digest': str(digest)}), 200", "label": 1, "cwe": ["CWE-328"], "category": "weakhash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "62ffab795b5418f726d3f884ae6e2e689c69f3827465f8b153151b0bbcb075ef", "structural_hash": "cfc9ac935dd39d1bc70526f4f1c9c8f3a968cef2189c3c2a5a98bacc68f925aa", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "flask/testcode/benchmark_test_02429.py", "upstream_id": "BenchmarkTest02429", "language": "python", "code": "import hashlib\nfrom flask import Flask, jsonify\nfrom app_runtime import db\napp = Flask(__name__)\n@app.route(\"/benchmark_case\", methods=[\"POST\"])\ndef benchmark_case():\n db_value = db.fetch_one('SELECT name FROM users LIMIT 1')\n data, _sep, _rest = str(db_value).partition('\\x00')\n digest = hashlib.sha256(str(data).encode()).hexdigest()\n return jsonify({'digest': str(digest)}), 200", "label": 1, "cwe": ["CWE-916"], "category": "weak_password_hash", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:python:flask:weak_password_hash", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "fe70ce1a9bb807d0e0b0900239ea787aa0b9cd4ec875c9d8faf2b7f92dd8c8f5", "structural_hash": "32bca35f0d8141cf305ac60810db31665c4974472f1d1e177e17d47a89d9e35d", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_00859.js", "upstream_id": "BenchmarkTest00859", "language": "javascript", "code": "const http = require(\"http\");\nconst zod = require(\"zod\");\nconst { passthrough } = require(\"./shared\");\nasync function benchmark_case(req, res) {\n const userInput = req.body.payload || \"\";\n const data = passthrough(userInput);\n const _parsed = zod.z.string().regex(/^[^\\x00]+$/).safeParse(data);\n if (!_parsed.success) { res.status(400).json({error: 'invalid'}); return; }\n const processed = _parsed.data;\n http.get(processed);\n res.json({ done: 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:express:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "dafaba8450bb2720602bf6d971c50dce5e45f858f0f29dbe6a87794b9b60071f", "structural_hash": "b8b305b24fde91a737903cac6c998ae1c5405385873230ac233b4dfff4aa2358", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "actix_web/testcode/benchmark_test_04195.rs", "upstream_id": "BenchmarkTest04195", "language": "rust", "code": "use actix_web::{HttpRequest, HttpResponse};\nuse log;\n#[actix_web::post(\"/benchmark_case\")]\npub async fn benchmark_case(req: HttpRequest) -> HttpResponse {\n let header_value = req.headers().get(\"x-custom-header\").and_then(|v| v.to_str().ok()).unwrap_or(\"\").to_string();\n let transform = |v: String| v.trim().to_string();\n let data = transform(header_value.clone());\n log::info!(\"User action: {}\", data);\n HttpResponse::Ok().json(serde_json::json!({\"stored\": true}))\n}", "label": 1, "cwe": ["CWE-532"], "category": "sensinlogs", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:rust:actix_web:loginjection", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2cc48176eb68e38c50cf783317bba973e353daa0a3800ebe92df5d5edae8e6db", "structural_hash": "2b7d4645fcf0b0db00b5c37a746edbe00aab60ddee5fa286c9e0bd20cf156322", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "standalone/testcode/benchmark_test_02150.cpp", "upstream_id": "BenchmarkTest02150", "language": "cpp", "code": "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \ntypedef void CURL;\nextern \"C\" CURL *curl_easy_init(void);\nextern \"C\" int curl_easy_setopt(CURL *, int, ...);\nextern \"C\" int curl_easy_perform(CURL *);\nextern \"C\" void curl_easy_cleanup(CURL *);\nenum { CURLOPT_URL = 10002, CURLOPT_SSL_VERIFYPEER = 64, CURLOPT_SSL_VERIFYHOST = 81, CURLOPT_POSTFIELDS = 10015 };\nvoid benchmark_case(int, char **)\n{\n const char *user_input_env = std::getenv(\"HTTP_X_CUSTOM_HEADER\");\n std::string user_input = user_input_env ? std::string(user_input_env) : std::string();\n std::string data = user_input;\n for (char &_c : data) if (_c == '\\n') _c = ' ';\n std::string _hurl = data;\n if (data.rfind(\"https://api.internal.example.com/\", 0) != 0) return;\n CURL *_curl = curl_easy_init();\n curl_easy_setopt(_curl, CURLOPT_URL, _hurl.c_str());\n curl_easy_perform(_curl);\n curl_easy_cleanup(_curl);\n}", "label": 0, "cwe": ["CWE-918"], "category": "ssrf", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:cpp:standalone:ssrf", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "893e0d227a89d1946ba036d5df3f3d4d588096051b07979ad40bbe9b4ae93d69", "structural_hash": "44d8853e4e1a60be7de364c2bd99a133f853f8c480a452d0e251f6e109ed74fc", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "symfony/testcode/benchmark_test_02611.php", "upstream_id": "BenchmarkTest02611", "language": "php", "code": "getContent();\n $payload = new class($userInput) { public function __construct(private string $raw) {} public function value(): string { return $this->raw; } };\n $data = $payload->value();\n $allowedActions = ['read', 'write', 'admin'];\n if (in_array((string) $data, $allowedActions, true)) { return new JsonResponse([\"access\" => \"granted\", \"role\" => \"admin\"], 200); }\n return new JsonResponse([\"committed\" => true]);\n }\n}", "label": 1, "cwe": ["CWE-863"], "category": "authzincorrect", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:php:symfony:authnfailure", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "025c0ab937a8d409c8666f39ebde1a16571cddcb78404b927cf5999fa3ff7b73", "structural_hash": "4f2502b703f9deeba4542dd4b09c774d2d962116d58dffb5d6f7647c0418606b", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "express/testcode/benchmark_test_15457.js", "upstream_id": "BenchmarkTest15457", "language": "javascript", "code": "const http = require(\"http\");\nasync function benchmark_case(req, res) {\n const userInput = req.headers.referer || \"\";\n const fields = [userInput, 'http'];\n const [data] = fields;\n const allowedHosts = [\"api.trustmesh.internal\", \"assets.trustcdn.io\"];\n let parsedHost = \"\";\n try { parsedHost = new URL(data).hostname; } catch (e) { res.status(403).json({error:\"host not allowed\"}); return; }\n if (!allowedHosts.includes(parsedHost)) { res.status(403).json({error:\"host not allowed\"}); return; }\n const targetUrl = data;\n http.get(targetUrl);\n res.json({ done: true });\n}\nmodule.exports = { benchmark_case };", "label": 0, "cwe": ["CWE-830"], "category": "untrusted_cdn", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:javascript:express:cloud_ssrf_metadata", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "13ffa7d277ffab0ccadd5d8618e062b6e3a7853a0ad83770365c4727a21f6741", "structural_hash": "a4d34c64389fd17b328ee0ca31ee6a4b9c636ae2a2af3e0f0574d4240a345ee8", "split": "test"} {"source": "benchproctor", "revision": "ad70ff85c2325626ccbda2a6565d354732d032ff", "source_path": "spring/testcode/BenchmarkTest00065.java", "upstream_id": "BenchmarkTest00065", "language": "java", "code": "import jakarta.servlet.http.Cookie;\nimport jakarta.servlet.http.HttpServletRequest;\nimport jakarta.servlet.http.HttpServletResponse;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n@RestController\npublic class benchmark_case {\n @PostMapping(path=\"/benchmark_case\", consumes=\"multipart/form-data\")\n public void benchmark_case(@RequestPart(\"file\") MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws Exception {\n String uploadName = file != null ? file.getOriginalFilename() : \"\";\n java.io.StringWriter sw = new java.io.StringWriter();\n new java.io.PrintWriter(sw).printf(\"%s\", uploadName);\n String data = sw.toString();\n response.addCookie(new Cookie(\"session\", data));\n response.setContentType(\"application/json\");\n response.getWriter().print(\"{\\\"id\\\":0}\");\n }\n}", "label": 1, "cwe": ["CWE-614"], "category": "securecookie", "license": "Apache-2.0", "native_split": null, "group": "benchproctor:java:spring:cookie_no_httponly", "label_scope": "benchmark target weakness; safe is not proof of absence of all vulnerabilities", "id": "2ebda18d07689806160415e15db8d4cf548d7dd59d6c3d08f42ac83b3d4aafa7", "structural_hash": "0471a40e87b7b15dac6948b7143892fb562063e2e5ac114fc4b86d79261ba4f4", "split": "test"}