diff --git "a/data/train.jsonl" "b/data/train.jsonl"
deleted file mode 100644--- "a/data/train.jsonl"
+++ /dev/null
@@ -1,171 +0,0 @@
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-113-8cf3ec3f7174", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE113_HTTP_Response_Splitting__Web_Connect_tcp_addCookie_01.cs\r\nLabel Definition File: CWE113_HTTP_Response_Splitting__Web.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 113 HTTP Response Splitting\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks: addCookie\r\n* GoodSink: URLEncode input\r\n* BadSink : querystring to AppendCookie()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\nusing System.Text;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE113_HTTP_Response_Splitting\r\n{\r\nclass CWE113_HTTP_Response_Splitting__Web_Connect_tcp_addCookie_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n HttpCookie cookieSink = new HttpCookie(\"lang\", data);\r\n /* POTENTIAL FLAW: Input not verified before inclusion in the cookie */\r\n resp.AppendCookie(cookieSink);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n GoodB2G(req, resp);\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n if (data != null)\r\n {\r\n HttpCookie cookieSink = new HttpCookie(\"lang\", data);\r\n /* POTENTIAL FLAW: Input not verified before inclusion in the cookie */\r\n resp.AppendCookie(cookieSink);\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n HttpCookie cookieSink = new HttpCookie(\"lang\", HttpUtility.UrlEncode(data, Encoding.UTF8));\r\n /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */\r\n resp.AppendCookie(cookieSink);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-113 (HTTP Response Splitting). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-113\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-113\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE113_HTTP_Response_Splitting/s01/CWE113_HTTP_Response_Splitting__Web_Connect_tcp_addCookie_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8cf3ec3f7174cba10988df9694b70212f7e420938dc7102c9606e444230ad9d2\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-113\", \"target_weakness\": \"HTTP Response Splitting\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-114-48342b108b6a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE114_Process_Control__basic_01.cs\r\nLabel Definition File: CWE114_Process_Control__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 114 Process Control\r\n* Sinks:\r\n* GoodSink: use Assembly.LoadFrom() to load a library\r\n* BadSink : use Assembly.Load() to load a library\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Reflection;\r\n\r\nnamespace testcases.CWE114_Process_Control\r\n{\r\nclass CWE114_Process_Control__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string libraryName = \"test.dll\";\r\n /* FLAW: Attempt to load a library with Assembly.Load() without the full path to the library. */\r\n Assembly.Load(libraryName);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n int p = (int)Environment.OSVersion.Platform;\r\n string root;\r\n string libraryName = \"test.dll\";\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\libs\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/libs/\";\r\n }\r\n /* FIX: Use Assembly.LoadFrom() which allows you to specify a full path to the library */\r\n Assembly.LoadFrom(root + libraryName);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-114 (Process Control). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-114\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-114\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE114_Process_Control/CWE114_Process_Control__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"48342b108b6a229cb0c85dc4b8cc96ff265f5460b44367e72e7e926ccc206514\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-114\", \"target_weakness\": \"Process Control\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-117-a71dab00b9dc", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE117_Improper_Output_Neutralization_for_Logs__Connect_tcp_01.cs\r\nLabel Definition File: CWE117_Improper_Output_Neutralization_for_Logs.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 117 Improper Output Neutralization for Logs\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks: readFile\r\n* GoodSink: Logging output is neutralized\r\n* BadSink : Logging output is not neutralized\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE117_Improper_Output_Neutralization_for_Logs\r\n{\r\nclass CWE117_Improper_Output_Neutralization_for_Logs__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n try\r\n {\r\n int value = int.Parse(data);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n /* POTENTIAL FLAW: Logging output is not neutralized */\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Failed to parse value = \" + data);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n try\r\n {\r\n int value = int.Parse(data);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n /* POTENTIAL FLAW: Logging output is not neutralized */\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Failed to parse value = \" + data);\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n try\r\n {\r\n int value = int.Parse(data);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n /* FIX: Logging output is neutralized */\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Failed to parse value. Exception: \" + exceptNumberFormat);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-117 (Improper Output Neutralization for Logs). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-117\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-117\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE117_Improper_Output_Neutralization_for_Logs/CWE117_Improper_Output_Neutralization_for_Logs__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a71dab00b9dc6ddd9a17f1a9d9c2bf438aea791b5eb9abe5e7fb7f2753ed83b4\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-117\", \"target_weakness\": \"Improper Output Neutralization for Logs\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-129-060c9f5b3d18", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE129_Improper_Validation_of_Array_Index__Connect_tcp_array_read_check_max_01.cs\r\nLabel Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 129 Improper Validation of Array Index\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: array_read_check_max\r\n* GoodSink: Read from array after verifying index is at least 0 and less than array.length\r\n* BadSink : Read from array after verifying that data less than array.length (but not verifying that data is at least 0)\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE129_Improper_Validation_of_Array_Index\r\n{\r\nclass CWE129_Improper_Validation_of_Array_Index__Connect_tcp_array_read_check_max_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int data;\r\n data = int.MinValue; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n String stringNumber = \"\";\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n stringNumber = sr.ReadLine();\r\n }\r\n }\r\n if (stringNumber != null) /* avoid NPD incidental warnings */\r\n {\r\n try\r\n {\r\n data = int.Parse(stringNumber.Trim());\r\n }\r\n catch(FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int[] array = { 0, 1, 2, 3, 4 };\r\n /* POTENTIAL FLAW: Verify that data < array.Length, but don't verify that data > 0, so may be attempting to read out of the array bounds */\r\n if (data < array.Length)\r\n {\r\n IO.WriteLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"Array index out of bounds\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n int data;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int[] array = { 0, 1, 2, 3, 4 };\r\n /* POTENTIAL FLAW: Verify that data < array.Length, but don't verify that data > 0, so may be attempting to read out of the array bounds */\r\n if (data < array.Length)\r\n {\r\n IO.WriteLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"Array index out of bounds\");\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n int data;\r\n data = int.MinValue; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n String stringNumber = \"\";\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n stringNumber = sr.ReadLine();\r\n }\r\n }\r\n if (stringNumber != null) /* avoid NPD incidental warnings */\r\n {\r\n try\r\n {\r\n data = int.Parse(stringNumber.Trim());\r\n }\r\n catch(FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int[] array = { 0, 1, 2, 3, 4 };\r\n /* FIX: Fully verify data before reading from array at location data */\r\n if (data >= 0 && data < array.Length)\r\n {\r\n IO.WriteLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"Array index out of bounds\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-129 (Improper Validation of Array Index). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-129\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-129\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE129_Improper_Validation_of_Array_Index/s01/CWE129_Improper_Validation_of_Array_Index__Connect_tcp_array_read_check_max_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"060c9f5b3d1858d1e7b735f9e3ec3e3708f12ffd294a188567a6af060a2531d2\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-129\", \"target_weakness\": \"Improper Validation of Array Index\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-15-2e53a8d4e26d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE15_External_Control_of_System_or_Configuration_Setting__Connect_tcp_01.cs\r\nLabel Definition File: CWE15_External_Control_of_System_or_Configuration_Setting.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 15 External Control of System or Configuration Setting\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: Set the catalog name with the value of data\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE15_External_Control_of_System_or_Configuration_Setting\r\n{\r\n\r\nclass CWE15_External_Control_of_System_or_Configuration_Setting__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n SqlConnection dbConnection = null;\r\n try\r\n {\r\n dbConnection = IO.GetDBConnection();\r\n /* POTENTIAL FLAW: Set the database user name with the value of data\r\n * allowing unauthorized access to a portion of the DB */\r\n dbConnection.ConnectionString = @\"Data Source=\" + \"\" + \";Initial Catalog=\" + \"\" + \";User ID=\" + data + \";Password=\" + \"\";\r\n dbConnection.Open();\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error getting database connection\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.Close();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error closing Connection\");\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n SqlConnection dbConnection = null;\r\n try\r\n {\r\n dbConnection = IO.GetDBConnection();\r\n /* POTENTIAL FLAW: Set the database user name with the value of data\r\n * allowing unauthorized access to a portion of the DB */\r\n dbConnection.ConnectionString = @\"Data Source=\" + \"\" + \";Initial Catalog=\" + \"\" + \";User ID=\" + data + \";Password=\" + \"\";\r\n dbConnection.Open();\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error getting database connection\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.Close();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error closing Connection\");\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-15 (External Control of System or Configuration Setting). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-15\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-15\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE15_External_Control_of_System_or_Configuration_Setting/CWE15_External_Control_of_System_or_Configuration_Setting__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2e53a8d4e26d93978c81247ffb4104a229f2b3bc742e10ee17791af7534223c0\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-15\", \"target_weakness\": \"External Control of System or Configuration Setting\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-190-e984367b62ef", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE190_Integer_Overflow__Byte_console_readLine_add_01.cs\r\nLabel Definition File: CWE190_Integer_Overflow.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 190 Integer Overflow\r\n* BadSource: console_readLine Read data from the console using readLine\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: add\r\n* GoodSink: Ensure there will not be an overflow before adding 1 to data\r\n* BadSink : Add 1 to data, which can cause an overflow\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE190_Integer_Overflow\r\n{\r\nclass CWE190_Integer_Overflow__Byte_console_readLine_add_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n byte data;\r\n /* init data */\r\n data = 0;\r\n /* POTENTIAL FLAW: Read data from console with ReadLine*/\r\n try\r\n {\r\n string stringNumber = Console.ReadLine();\r\n if (stringNumber != null)\r\n {\r\n data = byte.Parse(stringNumber.Trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n /* POTENTIAL FLAW: if data == byte.MaxValue, this will overflow */\r\n byte result = (byte)(data + 1);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n byte data;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n /* POTENTIAL FLAW: if data == byte.MaxValue, this will overflow */\r\n byte result = (byte)(data + 1);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n byte data;\r\n /* init data */\r\n data = 0;\r\n /* POTENTIAL FLAW: Read data from console with ReadLine*/\r\n try\r\n {\r\n string stringNumber = Console.ReadLine();\r\n if (stringNumber != null)\r\n {\r\n data = byte.Parse(stringNumber.Trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n /* FIX: Add a check to prevent an overflow from occurring */\r\n if (data < byte.MaxValue)\r\n {\r\n byte result = (byte)(data + 1);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"data value is too large to perform addition.\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-190 (Integer Overflow). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-190\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-190\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE190_Integer_Overflow/s01/CWE190_Integer_Overflow__Byte_console_readLine_add_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e984367b62ef5e277f583851e6e3d922d9c3f9febb45758d2ad94829d454099b\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-190\", \"target_weakness\": \"Integer Overflow\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-191-fd9a38e95f75", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE191_Integer_Underflow__Byte_console_ReadLine_multiply_01.cs\r\nLabel Definition File: CWE191_Integer_Underflow.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 191 Integer Underflow\r\n* BadSource: console_ReadLine Read data from the console using ReadLine\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: multiply\r\n* GoodSink: Ensure there will not be an underflow before multiplying data by 2\r\n* BadSink : If data is negative, multiply by 2, which can cause an underflow\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE191_Integer_Underflow\r\n{\r\nclass CWE191_Integer_Underflow__Byte_console_ReadLine_multiply_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n byte data;\r\n /* init data */\r\n data = 0;\r\n /* POTENTIAL FLAW: Read data from console with ReadLine*/\r\n try\r\n {\r\n string stringNumber = Console.ReadLine();\r\n if (stringNumber != null)\r\n {\r\n data = byte.Parse(stringNumber.Trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* POTENTIAL FLAW: if (data * 2) < byte.MinValue, this will underflow */\r\n byte result = (byte)(data * 2);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n byte data;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* POTENTIAL FLAW: if (data * 2) < byte.MinValue, this will underflow */\r\n byte result = (byte)(data * 2);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n byte data;\r\n /* init data */\r\n data = 0;\r\n /* POTENTIAL FLAW: Read data from console with ReadLine*/\r\n try\r\n {\r\n string stringNumber = Console.ReadLine();\r\n if (stringNumber != null)\r\n {\r\n data = byte.Parse(stringNumber.Trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* FIX: Add a check to prevent an underflow from occurring */\r\n if (data > (byte.MinValue/2))\r\n {\r\n byte result = (byte)(data * 2);\r\n IO.WriteLine(\"result: \" + result);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"data value is too small to perform multiplication.\");\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-191 (Integer Underflow). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-191\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-191\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__Byte_console_ReadLine_multiply_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"fd9a38e95f755ed420b9a5e2d3afa4e121421bcb166513abdcce43cdc734cf83\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-191\", \"target_weakness\": \"Integer Underflow\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-197-e807e6a39ec8", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE197_Numeric_Truncation_Error__double_Environment_to_byte_01.cs\r\nLabel Definition File: CWE197_Numeric_Truncation_Error__double.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 197 Numeric Truncation Error\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* BadSink: to_byte Convert data to a byte\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE197_Numeric_Truncation_Error\r\n{\r\n\r\nclass CWE197_Numeric_Truncation_Error__double_Environment_to_byte_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n double data;\r\n data = double.MinValue; /* Initialize data */\r\n /* get environment variable ADD */\r\n /* FLAW: Read data from an environment variable */\r\n {\r\n string stringNumber = Environment.GetEnvironmentVariable(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = double.Parse(stringNumber.Trim());\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n {\r\n /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */\r\n IO.WriteLine((byte)data);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n double data;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n {\r\n /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */\r\n IO.WriteLine((byte)data);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-197 (Numeric Truncation Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-197\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-197\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE197_Numeric_Truncation_Error/s01/CWE197_Numeric_Truncation_Error__double_Environment_to_byte_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e807e6a39ec8a65bf57fe5eb3140589060be3bf12792e4e4197dead7470416fb\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-197\", \"target_weakness\": \"Numeric Truncation Error\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-209-c167cb9c2bfd", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE209_Information_Leak_Error__StackTrace_01.cs\r\nLabel Definition File: CWE209_Information_Leak_Error.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 209 Information exposure through error message\r\n* Sinks: StackTrace\r\n* GoodSink: Print generic error message to console\r\n* BadSink : Print stack trace to console\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE209_Information_Leak_Error\r\n{\r\nclass CWE209_Information_Leak_Error__StackTrace_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n try\r\n {\r\n throw new InvalidOperationException();\r\n }\r\n catch (InvalidOperationException exceptInvalidOperationException)\r\n {\r\n IO.WriteLine(exceptInvalidOperationException.ToString()); /* FLAW: Print stack trace to console on error */\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n try\r\n {\r\n throw new InvalidOperationException();\r\n }\r\n catch (InvalidOperationException exceptInvalidOperationException)\r\n {\r\n IO.WriteLine(\"There was an invalid operation error\"); /* FIX: print a generic message */\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-209 (Information Leak Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-209\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-209\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE209_Information_Leak_Error/CWE209_Information_Leak_Error__StackTrace_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"c167cb9c2bfdd4761437700fb3a13c09a0e4eee56d3905907b502f6e01ef38f7\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-209\", \"target_weakness\": \"Information Leak Error\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-226-762fb8470434", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01.cs\r\nLabel Definition File: CWE226_Sensitive_Information_Uncleared_Before_Release__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 226 Sensitive Information Uncleared Before Release\r\n* Sinks:\r\n* GoodSink: Sensitive info (password) is stored in a mutable object, but is cleared after use\r\n* BadSink : Sensitive info (password) is stored in a mutable object and is uncleared\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\nnamespace testcases.CWE226_Sensitive_Information_Uncleared_Before_Release\r\n{\r\nclass CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n StringBuilder password = new StringBuilder();\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(Console.OpenStandardInput()))\r\n {\r\n password.Append(sr.ReadLine());\r\n using (SqlConnection dBConnection = new SqlConnection(\"Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password = \" + password.ToString() + \";\"))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n /* FLAW: the password is stored in a mutable object (StringBuilder) and it is not cleared */\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n StringBuilder password = new StringBuilder();\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(Console.OpenStandardInput()))\r\n {\r\n password.Append(sr.ReadLine());\r\n using (SqlConnection dBConnection = new SqlConnection(\"Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password = \" + password.ToString() + \";\"))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n /* FIX: Zeroize the password */\r\n password.Remove(0, password.Length);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-226 (Sensitive Information Uncleared Before Release). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-226\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-226\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE226_Sensitive_Information_Uncleared_Before_Release/CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"762fb8470434b9feec00a32b5241f03f1ea6db5dfd8f616c3f3dd3e8aa5cafe9\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-226\", \"target_weakness\": \"Sensitive Information Uncleared Before Release\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-23-36b0835026a2", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE23_Relative_Path_Traversal__Connect_tcp_01.cs\r\nLabel Definition File: CWE23_Relative_Path_Traversal.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 23 Relative Path Traversal\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: readFile no validation\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nusing System.Web;\r\n\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE23_Relative_Path_Traversal\r\n{\r\n\r\nclass CWE23_Relative_Path_Traversal__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n int p = (int)Environment.OSVersion.Platform;\r\n string root;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\uploads\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/uploads/\";\r\n }\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: no validation of concatenated value */\r\n if (File.Exists(root + data))\r\n {\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(root + data))\r\n {\r\n IO.WriteLine(sr.ReadLine());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n int p = (int)Environment.OSVersion.Platform;\r\n string root;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\uploads\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/uploads/\";\r\n }\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: no validation of concatenated value */\r\n if (File.Exists(root + data))\r\n {\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(root + data))\r\n {\r\n IO.WriteLine(sr.ReadLine());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-23 (Relative Path Traversal). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-23\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-23\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE23_Relative_Path_Traversal/CWE23_Relative_Path_Traversal__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"36b0835026a2b1b70c49f50b69be9dc580e67c4d771da697c434a7b8cdd58fe0\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-23\", \"target_weakness\": \"Relative Path Traversal\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-248-424d58da19ad", "input": "/*\r\n * @description Explicitly throw a SystemException that will not be caught by any code.\r\n *\r\n * */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE248_Uncaught_Exception\r\n{\r\n class CWE248_Uncaught_Exception__basic_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: Exception not caught */\r\n throw new SystemException(\"Really bad Exception\");\r\n }\r\n#endif // OMITBAD\r\n#if (!OMITGOOD)\r\n private void Good1()\r\n {\r\n /* FIX: Exception caught */\r\n try\r\n {\r\n throw new SystemException(\"Really bad Exception\");\r\n }\r\n catch (SystemException exception)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Caught an Exception\", exception);\r\n }\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n /* Override runTest for this test case so that it doesn't catch the Exception */\r\n public override void RunTest(string className)\r\n {\r\n IO.WriteLine(\"Starting tests for Class \" + className);\r\n#if (!OMITGOOD)\r\n Good();\r\n IO.WriteLine(\"Completed Good() for Class \" + className);\r\n#endif // OMITGOOD\r\n#if (!OMITBAD)\r\n Bad();\r\n IO.WriteLine(\"Completed Bad() for Class \" + className);\r\n#endif // OMITBAD\r\n }\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-248 (Uncaught Exception). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-248\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-248\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE248_Uncaught_Exception/CWE248_Uncaught_Exception__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"424d58da19ad373ae67d845ae68cd3f81feb38960908c97915a488b6f8ebf049\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-248\", \"target_weakness\": \"Uncaught Exception\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-252-9f1c403ed6b1", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE252_Unchecked_Return_Value__MemoryStream_01.cs\r\nLabel Definition File: CWE252_Unchecked_Return_Value__MemoryStream.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 252 Unchecked Return Value\r\n* Sinks:\r\n* GoodSink: Check the return value from MemoryStream.Read()\r\n* BadSink : Do not check the return value of MemoryStream.Read()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE252_Unchecked_Return_Value\r\n{\r\nclass CWE252_Unchecked_Return_Value__MemoryStream_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n using (Stream s = new MemoryStream())\r\n {\r\n for (int i = 0; i < 122; i++)\r\n {\r\n s.WriteByte((byte)i);\r\n }\r\n s.Position = 0;\r\n try\r\n {\r\n while (true)\r\n {\r\n // Now read s into a byte buffer with a little padding.\r\n byte[] bytes = new byte[s.Length + 10];\r\n int numBytesToRead = (int)s.Length;\r\n int numBytesRead = 0;\r\n int n = s.Read(bytes, numBytesRead, 1);\r\n /* FLAW: Do not check the return value of Read(), for EOF */\r\n }\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"IOException reading file\", exceptIO);\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n using (Stream s = new MemoryStream())\r\n {\r\n for (int i = 0; i < 122; i++)\r\n {\r\n s.WriteByte((byte)i);\r\n }\r\n s.Position = 0;\r\n try\r\n {\r\n while (true)\r\n {\r\n // Now read s into a byte buffer with a little padding.\r\n byte[] bytes = new byte[s.Length + 10];\r\n int numBytesToRead = (int)s.Length;\r\n int numBytesRead = 0;\r\n int n = s.Read(bytes, numBytesRead, 1);\r\n /* FIX: Check the return value of read() for EOF */\r\n if (n == 0)\r\n {\r\n IO.WriteLine(\"The end of the file has been reached.\");\r\n break;\r\n }\r\n }\r\n s.Close();\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"IOException reading file\", exceptIO);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-252 (Unchecked Return Value). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-252\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-252\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE252_Unchecked_Return_Value/CWE252_Unchecked_Return_Value__MemoryStream_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9f1c403ed6b160e8c023d01d33afdc88c4f9144ef9116bd18fe915b4835c013d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-252\", \"target_weakness\": \"Unchecked Return Value\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-253-a12270cb4ab5", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01.cs\r\nLabel Definition File: CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 253 Incorrect Check of Function Return Value\r\n* Sinks:\r\n* GoodSink: Check the return value from FileInputStream.read() and handle possible errors\r\n* BadSink : Check the return value of FileInputStream.read() for the wrong value\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE253_Incorrect_Check_of_Function_Return_Value\r\n{\r\nclass CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n using (Stream s = new MemoryStream())\r\n {\r\n for (int i = 0; i < 122; i++)\r\n {\r\n s.WriteByte((byte)i);\r\n }\r\n s.Position = 0;\r\n try\r\n {\r\n while (true)\r\n {\r\n // Now read s into a byte buffer with a little padding.\r\n byte[] bytes = new byte[s.Length + 10];\r\n int numBytesToRead = (int)s.Length;\r\n int numBytesRead = 0;\r\n int n = s.Read(bytes, numBytesRead, 1);\r\n /* FLAW: Incorrect check of return value, which should be 0 for EOF */\r\n if (n == -1)\r\n {\r\n IO.WriteLine(\"The end of the file has been reached.\");\r\n break;\r\n }\r\n }\r\n /* INCIDENTAL: CWE561 dead code */\r\n s.Close();\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"IOException reading file\", exceptIO);\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n using (Stream s = new MemoryStream())\r\n {\r\n for (int i = 0; i < 122; i++)\r\n {\r\n s.WriteByte((byte)i);\r\n }\r\n s.Position = 0;\r\n try\r\n {\r\n while (true)\r\n {\r\n // Now read s into a byte buffer with a little padding.\r\n byte[] bytes = new byte[s.Length + 10];\r\n int numBytesToRead = (int)s.Length;\r\n int numBytesRead = 0;\r\n int n = s.Read(bytes, numBytesRead, 1);\r\n /* FIX: Check the return value of read() for EOF */\r\n if (n == 0)\r\n {\r\n IO.WriteLine(\"The end of the file has been reached.\");\r\n break;\r\n }\r\n }\r\n s.Close();\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"IOException reading file\", exceptIO);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-253 (Incorrect Check of Function Return Value). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-253\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-253\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE253_Incorrect_Check_of_Function_Return_Value/CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a12270cb4ab5539464d4ad3ba7016442db75fe1e2cb3fd1a2e9f496cb05a45af\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-253\", \"target_weakness\": \"Incorrect Check of Function Return Value\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-256-ede2fd9a9ec2", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE256_Unprotected_Storage_of_Credentials__basic_01.cs\r\nLabel Definition File: CWE256_Unprotected_Storage_of_Credentials__basic.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 256 Unprotected Storage of Credentials\r\n* BadSource: Read password from a .txt file\r\n* GoodSource: Read password from a .txt file (from the property named password) and then decrypt it\r\n* Sinks:\r\n* GoodSink: Decrypt password and use decrypted password as password to connect to DB\r\n* BadSink : Use password as password to connect to DB\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\nusing System.Security.Cryptography;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\nnamespace testcases.CWE256_Unprotected_Storage_of_Credentials\r\n{\r\nclass CWE256_Unprotected_Storage_of_Credentials__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string password;\r\n password = \"\"; /* init password */\r\n /* retrieve the password */\r\n try\r\n {\r\n password = Encoding.UTF8.GetString(File.ReadAllBytes(\"../../../common/strong_password_file.txt\"));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with file reading\", exceptIO);\r\n }\r\n /* POTENTIAL FLAW: The raw password read from the .txt file is passed on (without being decrypted) */\r\n /* POTENTIAL FLAW: Use password as a password to connect to a DB (without being decrypted) */\r\n using (SqlConnection dBConnection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=\" + \"sa\" + \";Password=\" + password))\r\n {\r\n try\r\n {\r\n dBConnection.Open();\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string password;\r\n password = \"\"; /* init password */\r\n /* retrieve the password */\r\n try\r\n {\r\n password = Encoding.UTF8.GetString(File.ReadAllBytes(\"../../../common/strong_password_file.txt\"));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with file reading\", exceptIO);\r\n }\r\n /* FIX: password is decrypted before being passed on */\r\n {\r\n using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())\r\n {\r\n aesAlg.Key = Encoding.UTF8.GetBytes(\"ABCDEFGHABCDEFGH\");\r\n aesAlg.IV = new byte[16];\r\n // Create a decryptor to perform the stream transform.\r\n ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for decryption.\r\n using (MemoryStream msDecrypt = new MemoryStream(File.ReadAllBytes(\"../../../common/strong_password_file.txt\")))\r\n {\r\n using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))\r\n {\r\n using (StreamReader srDecrypt = new StreamReader(csDecrypt))\r\n {\r\n // Read the decrypted bytes from the decrypting stream\r\n // and place them in a string.\r\n password = srDecrypt.ReadToEnd();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /* POTENTIAL FLAW: Use password as a password to connect to a DB (without being decrypted) */\r\n using (SqlConnection dBConnection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=\" + \"sa\" + \";Password=\" + password))\r\n {\r\n try\r\n {\r\n dBConnection.Open();\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n string password;\r\n password = \"\"; /* init password */\r\n /* retrieve the password */\r\n try\r\n {\r\n password = Encoding.UTF8.GetString(File.ReadAllBytes(\"../../../common/strong_password_file.txt\"));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with file reading\", exceptIO);\r\n }\r\n /* POTENTIAL FLAW: The raw password read from the .txt file is passed on (without being decrypted) */\r\n /* FIX: password is decrypted before being used as a database password */\r\n {\r\n using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())\r\n {\r\n aesAlg.Key = Encoding.UTF8.GetBytes(\"ABCDEFGHABCDEFGH\");\r\n aesAlg.IV = new byte[16];\r\n // Create a decryptor to perform the stream transform.\r\n ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for decryption.\r\n using (MemoryStream msDecrypt = new MemoryStream(File.ReadAllBytes(\"../../../common/strong_password_file.txt\")))\r\n {\r\n using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))\r\n {\r\n using (StreamReader srDecrypt = new StreamReader(csDecrypt))\r\n {\r\n // Read the decrypted bytes from the decrypting stream\r\n // and place them in a string.\r\n password = srDecrypt.ReadToEnd();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n using (SqlConnection dBConnection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=sa;Password=\" + password))\r\n {\r\n try\r\n {\r\n dBConnection.Open();\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-256 (Unprotected Storage of Credentials). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-256\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-256\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE256_Unprotected_Storage_of_Credentials/CWE256_Unprotected_Storage_of_Credentials__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ede2fd9a9ec28053117c97c4048c4ae6037f489a1948df3975ef5147759aa876\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-256\", \"target_weakness\": \"Unprotected Storage of Credentials\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-261-3cac48611340", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE261_Weak_Cryptography_for_Passwords__NetworkCredential_01.cs\r\nLabel Definition File: CWE261_Weak_Cryptography_for_Passwords__NetworkCredential.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 261 Weak Cryptography for Passwords\r\n* Sinks:\r\n* GoodSink:\r\n* BadSink :\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Text;\r\nusing System.Net;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE261_Weak_Cryptography_for_Passwords\r\n{\r\nclass CWE261_Weak_Cryptography_for_Passwords__NetworkCredential_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string password = \"\";\r\n StreamReader sr;\r\n /* FLAW: Weak encryption of password and a malicious person may have access to file. */\r\n sr = new StreamReader(\"../../../common/weak_password_file.txt\");\r\n password = sr.ReadLine();\r\n string decPass = Encoding.UTF8.GetString(Convert.FromBase64String(password));\r\n NetworkCredential netCred = new NetworkCredential(\"CWE261\", decPass, \"\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n byte[] encryptedPassword;\r\n /* FIX: String encryption of password (128 bit). */\r\n encryptedPassword = File.ReadAllBytes(\"../../../common/strong_password_file.txt\");\r\n string decPass = null;\r\n using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())\r\n {\r\n aesAlg.Key = Encoding.UTF8.GetBytes(\"ABCDEFGHABCDEFGH\");\r\n aesAlg.IV = new byte[16];\r\n // Create a decryptor to perform the stream transform.\r\n ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for decryption.\r\n using (MemoryStream msDecrypt = new MemoryStream(encryptedPassword))\r\n {\r\n using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))\r\n {\r\n using (StreamReader srDecrypt = new StreamReader(csDecrypt))\r\n {\r\n // Read the decrypted bytes from the decrypting stream\r\n // and place them in a string.\r\n decPass = srDecrypt.ReadToEnd();\r\n }\r\n }\r\n }\r\n }\r\n NetworkCredential netCred = new NetworkCredential(\"CWE261\", decPass, \"\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-261 (Weak Cryptography for Passwords). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-261\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-261\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE261_Weak_Cryptography_for_Passwords/CWE261_Weak_Cryptography_for_Passwords__NetworkCredential_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3cac4861134061c3cb1fa443dfc24c9484b8be0d12b03f7a21d78f9124341fb7\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-261\", \"target_weakness\": \"Weak Cryptography for Passwords\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-284-2621429d1dce", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE284_Improper_Access_Control__File_01.cs\r\nLabel Definition File: CWE284_Improper_Access_Control.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 284 Improper Access Control\r\n* Sinks: File\r\n* GoodSink: Create a file without excessive privileges\r\n* BadSink : Create a file with excessive privileges\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Security.AccessControl;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE284_Improper_Access_Control\r\n{\r\nclass CWE284_Improper_Access_Control__File_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: Create a file with excessive privileges */\r\n string path = @\"C:\\Temp\\WriteText.txt\";\r\n File.Create(path);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: Create a file without excessive privileges */\r\n string user = Environment.UserDomainName + \"\\\\\" + Environment.UserName;\r\n string path = @\"C:\\Temp\\WriteText.txt\";\r\n FileSecurity fSecurity = new FileSecurity();\r\n fSecurity.AddAccessRule(new FileSystemAccessRule(user, FileSystemRights.Read, AccessControlType.Allow));\r\n fSecurity.AddAccessRule(new FileSystemAccessRule(user, FileSystemRights.Write, AccessControlType.Deny));\r\n File.Create(path, 1024, FileOptions.WriteThrough, fSecurity);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-284 (Improper Access Control). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-284\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-284\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE284_Improper_Access_Control/CWE284_Improper_Access_Control__File_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2621429d1dcee9bdb378db6b995b0b108f868acfc7061719d30dcd4fb080d171\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-284\", \"target_weakness\": \"Improper Access Control\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-313-7cd8b8a8e1ba", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE313_Cleartext_Storage_in_a_File_or_on_Disk__Connect_tcp_01.cs\r\nLabel Definition File: CWE313_Cleartext_Storage_in_a_File_or_on_Disk.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 313 Cleartext storage in a File or on Disk\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks:\r\n* GoodSink: Hash data before storing in registry\r\n* BadSink : Store data directly in a file\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Security;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.IO;\r\nusing System.Web;\r\n\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE313_Cleartext_Storage_in_a_File_or_on_Disk\r\n{\r\nclass CWE313_Cleartext_Storage_in_a_File_or_on_Disk__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n using (SecureString secureData = new SecureString())\r\n {\r\n for (int i = 0; i < data.Length; i++)\r\n {\r\n secureData.AppendChar(data[i]);\r\n }\r\n /* POTENTIAL FLAW: Store data directly in a file */\r\n File.WriteAllText(@\"C:\\Users\\Public\\WriteText.txt\", secureData.ToString());\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n using (SecureString secureData = new SecureString())\r\n {\r\n for (int i = 0; i < data.Length; i++)\r\n {\r\n secureData.AppendChar(data[i]);\r\n }\r\n /* POTENTIAL FLAW: Store data directly in a file */\r\n File.WriteAllText(@\"C:\\Users\\Public\\WriteText.txt\", secureData.ToString());\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* FIX: Hash data before storing in a file */\r\n {\r\n string salt = \"ThisIsMySalt\";\r\n using (SHA512CryptoServiceProvider sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n byte[] buffer = Encoding.UTF8.GetBytes(string.Concat(salt, data));\r\n byte[] hashedCredsAsBytes = sha512.ComputeHash(buffer);\r\n data = IO.ToHex(hashedCredsAsBytes);\r\n }\r\n }\r\n using (SecureString secureData = new SecureString())\r\n {\r\n for (int i = 0; i < data.Length; i++)\r\n {\r\n secureData.AppendChar(data[i]);\r\n }\r\n File.WriteAllText(@\"C:\\Users\\Public\\WriteText.txt\", secureData.ToString());\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-313 (Cleartext Storage in a File or on Disk). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-313\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-313\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE313_Cleartext_Storage_in_a_File_or_on_Disk/CWE313_Cleartext_Storage_in_a_File_or_on_Disk__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7cd8b8a8e1ba49252dd7f342df5e406e103837db4f0e6a67537be93b36a889bd\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-313\", \"target_weakness\": \"Cleartext Storage in a File or on Disk\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-315-dd9f42455fdf", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE315_Cleartext_Storage_in_Cookie__Web_01.cs\r\nLabel Definition File: CWE315_Cleartext_Storage_in_Cookie__Web.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 315 Cleartext storage of data in a cookie\r\n* BadSource: Set data to credentials (without hashing or encryption)\r\n* GoodSource: Set data to a hash of credentials\r\n* Sinks:\r\n* GoodSink: Hash data before storing in cookie\r\n* BadSink : Store data directly in cookie\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web;\r\n\r\nusing System.Security;\r\n\r\nnamespace testcases.CWE315_Cleartext_Storage_in_Cookie\r\n{\r\nclass CWE315_Cleartext_Storage_in_Cookie__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n using (SecureString securePwd = new SecureString())\r\n {\r\n using (SecureString secureUser = new SecureString())\r\n {\r\n for (int i = 0; i < \"AP@ssw0rd\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"AP@ssw0rd\"[i]);\r\n }\r\n for (int i = 0; i < \"user\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"user\"[i]);\r\n }\r\n /* POTENTIAL FLAW: Set data to credentials (without hashing or encryption) */\r\n data = secureUser.ToString() + \":\" + securePwd.ToString();\r\n }\r\n }\r\n /* NOTE: potential incidental issues with not setting secure or HttpOnly flag */\r\n /* POTENTIAL FLAW: Store data directly in cookie */\r\n resp.AppendCookie(new HttpCookie(\"auth\", data));\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n GoodB2G(req, resp);\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n using (SecureString securePwd = new SecureString())\r\n {\r\n using( SecureString secureUser = new SecureString())\r\n {\r\n for (int i = 0; i < \"AP@ssw0rd\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"AP@ssw0rd\"[i]);\r\n }\r\n for (int i = 0; i < \"user\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"user\"[i]);\r\n }\r\n /* FIX: Set data to a hash of credentials */\r\n {\r\n string salt = \"ThisIsMySalt\";\r\n using (SHA512CryptoServiceProvider sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n string credentialsToHash = secureUser.ToString() + \":\" + securePwd.ToString();\r\n byte[] buffer = Encoding.UTF8.GetBytes(string.Concat(salt, credentialsToHash));\r\n byte[] hashedCredsAsBytes = sha512.ComputeHash(buffer);\r\n data = IO.ToHex(hashedCredsAsBytes);\r\n }\r\n }\r\n }\r\n }\r\n /* NOTE: potential incidental issues with not setting secure or HttpOnly flag */\r\n /* POTENTIAL FLAW: Store data directly in cookie */\r\n resp.AppendCookie(new HttpCookie(\"auth\", data));\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n using (SecureString securePwd = new SecureString())\r\n {\r\n using (SecureString secureUser = new SecureString())\r\n {\r\n for (int i = 0; i < \"AP@ssw0rd\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"AP@ssw0rd\"[i]);\r\n }\r\n for (int i = 0; i < \"user\".Length; i++)\r\n {\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n securePwd.AppendChar(\"user\"[i]);\r\n }\r\n /* POTENTIAL FLAW: Set data to credentials (without hashing or encryption) */\r\n data = secureUser.ToString() + \":\" + securePwd.ToString();\r\n }\r\n }\r\n /* FIX: Hash data before storing in cookie */\r\n {\r\n string salt = \"ThisIsMySalt\";\r\n using (SHA512CryptoServiceProvider sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n byte[] buffer = Encoding.UTF8.GetBytes(string.Concat(salt, data));\r\n byte[] hashedCredsAsBytes = sha512.ComputeHash(buffer);\r\n data = IO.ToHex(hashedCredsAsBytes);\r\n }\r\n }\r\n resp.AppendCookie(new HttpCookie(\"auth\", data));\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-315 (Cleartext Storage in Cookie). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-315\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-315\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE315_Cleartext_Storage_in_Cookie/CWE315_Cleartext_Storage_in_Cookie__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"dd9f42455fdfcc4bdbaa125cf5f4ce68b66a093474c87e4d65b342dae2c5f9f9\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-315\", \"target_weakness\": \"Cleartext Storage in Cookie\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-319-9f2783a697e2", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE319_Cleartext_Tx_Sensitive_Info__NetClient_SqlConnection_01.cs\r\nLabel Definition File: CWE319_Cleartext_Tx_Sensitive_Info.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 319 Cleartext Transmission of Sensitive Information\r\n* BadSource: NetClient Read password from a web server with WebClient\r\n* GoodSource: Set password to a hardcoded value (one that was not sent over the network)\r\n* Sinks: SqlConnection\r\n* GoodSink: Decrypt the password from the source before using it in database connection\r\n* BadSink : Use password directly from source in database connection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\nusing System.Security.Cryptography;\r\nusing System.IO;\r\nusing System.Text;\r\n\r\nusing System.Net;\r\n\r\nnamespace testcases.CWE319_Cleartext_Tx_Sensitive_Info\r\n{\r\nclass CWE319_Cleartext_Tx_Sensitive_Info__NetClient_SqlConnection_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string password;\r\n password = \"\"; /* init password */\r\n /* read input from WebClient */\r\n {\r\n try\r\n {\r\n using (WebClient client = new WebClient())\r\n {\r\n using (StreamReader sr = new StreamReader(client.OpenRead(\"http://www.example.org/\")))\r\n {\r\n /* POTENTIAL FLAW: Read password from a web server with WebClient */\r\n /* This will be reading the first \"line\" of the response body,\r\n * which could be very long if there are no newlines in the HTML */\r\n password = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n }\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in SqlConnection() */\r\n using (SqlConnection connection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=\" + \"sa\" + \";Password=\" + password))\r\n {\r\n connection.Open();\r\n using (SqlCommand command = new SqlCommand(\"select * from test_table\", connection))\r\n {\r\n command.ExecuteNonQuery();\r\n }\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string password;\r\n /* FIX: Use a hardcoded password as the password (it was not sent over the network) */\r\n /* INCIDENTAL FLAW: CWE-259 Hard Coded Password */\r\n password = \"Password1234!\";\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in SqlConnection() */\r\n using (SqlConnection connection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=\" + \"sa\" + \";Password=\" + password))\r\n {\r\n connection.Open();\r\n using (SqlCommand command = new SqlCommand(\"select * from test_table\", connection))\r\n {\r\n command.ExecuteNonQuery();\r\n }\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n string password;\r\n password = \"\"; /* init password */\r\n /* read input from WebClient */\r\n {\r\n try\r\n {\r\n using (WebClient client = new WebClient())\r\n {\r\n using (StreamReader sr = new StreamReader(client.OpenRead(\"http://www.example.org/\")))\r\n {\r\n /* POTENTIAL FLAW: Read password from a web server with WebClient */\r\n /* This will be reading the first \"line\" of the response body,\r\n * which could be very long if there are no newlines in the HTML */\r\n password = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n }\r\n if (password != null)\r\n {\r\n /* FIX: Decrypt password before using in getConnection() */\r\n {\r\n using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())\r\n {\r\n aesAlg.Padding = PaddingMode.None;\r\n aesAlg.Key = Encoding.UTF8.GetBytes(\"ABCDEFGHABCDEFGH\");\r\n // Create a decryptor to perform the stream transform.\r\n ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for decryption.\r\n using (MemoryStream msDecrypt = new MemoryStream(Encoding.UTF8.GetBytes(password)))\r\n {\r\n using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))\r\n {\r\n using (StreamReader srDecrypt = new StreamReader(csDecrypt))\r\n {\r\n // Read the decrypted bytes from the decrypting stream\r\n // and place them in a string.\r\n password = srDecrypt.ReadToEnd();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in SqlConnection() */\r\n using (SqlConnection connection = new SqlConnection(@\"Data Source=(local);Initial Catalog=CWE256;User ID=\" + \"sa\" + \";Password=\" + password))\r\n {\r\n connection.Open();\r\n using (SqlCommand command = new SqlCommand(\"select * from test_table\", connection))\r\n {\r\n command.ExecuteNonQuery();\r\n }\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with database connection\", exceptSql);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-319 (Cleartext Tx Sensitive Info). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-319\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-319\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE319_Cleartext_Tx_Sensitive_Info/CWE319_Cleartext_Tx_Sensitive_Info__NetClient_SqlConnection_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9f2783a697e2f9c37c64d8781bac6fcb37446b65e0ec69a7f728bb4d26a7e557\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-319\", \"target_weakness\": \"Cleartext Tx Sensitive Info\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-321-337fad5e303e", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE321_Hard_Coded_Cryptographic_Key__basic_01.cs\r\nLabel Definition File: CWE321_Hard_Coded_Cryptographic_Key__basic.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 321 Hard coded crypto key\r\n* BadSource: Set data to a hardcoded value\r\n* GoodSource: Read data from the console using readLine()\r\n* BadSink: Use data as a cryptographic key\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.IO;\r\n\r\n\r\nnamespace testcases.CWE321_Hard_Coded_Cryptographic_Key\r\n{\r\n\r\nclass CWE321_Hard_Coded_Cryptographic_Key__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n /* FLAW: Set data to a hardcoded value */\r\n data = \"23 ~j;asn!@#/>as\";\r\n if (data != null)\r\n {\r\n string stringToEncrypt = \"Super secret Squirrel\";\r\n byte[] byteCipherText = null;\r\n /* POTENTIAL FLAW: Use data as a cryptographic key */\r\n using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())\r\n {\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aes.CreateEncryptor(Encoding.UTF8.GetBytes(data), aes.IV);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))\r\n {\r\n //Write all data to the stream.\r\n swEncrypt.Write(stringToEncrypt);\r\n }\r\n byteCipherText = msEncrypt.ToArray();\r\n }\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n /* FIX: Read data from the console using readLine() */\r\n data = Console.ReadLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n if (data != null)\r\n {\r\n string stringToEncrypt = \"Super secret Squirrel\";\r\n byte[] byteCipherText = null;\r\n /* POTENTIAL FLAW: Use data as a cryptographic key */\r\n using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())\r\n {\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aes.CreateEncryptor(Encoding.UTF8.GetBytes(data), aes.IV);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))\r\n {\r\n //Write all data to the stream.\r\n swEncrypt.Write(stringToEncrypt);\r\n }\r\n byteCipherText = msEncrypt.ToArray();\r\n }\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-321 (Hard Coded Cryptographic Key). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-321\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-321\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE321_Hard_Coded_Cryptographic_Key/CWE321_Hard_Coded_Cryptographic_Key__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"337fad5e303e5af4be603d550ade1dda7fca5ade48fd90da92014f4f0d612fd8\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-321\", \"target_weakness\": \"Hard Coded Cryptographic Key\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-325-24174eb0e901", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE325_Missing_Required_Cryptographic_Step__CryptoStream_01.cs\r\nLabel Definition File: CWE325_Missing_Required_Cryptographic_Step.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 325 Missing Required Cryptographic Step\r\n* Sinks: CryptoStream\r\n* GoodSink: Include call to swEncrypt.Write(plainText)\r\n* BadSink : Missing call to swEncrypt.Write(plainText)\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE325_Missing_Required_Cryptographic_Step\r\n{\r\nclass CWE325_Missing_Required_Cryptographic_Step__CryptoStream_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string plainText = \"ABCDEFG123456\";\r\n byte[] encrypted;\r\n using (Aes aesAlg = Aes.Create())\r\n {\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n /* FLAW: Missing required step (using CryptoStream). This will result in the payload to remain in plaintext form */\r\n using (StreamWriter swEncrypt = new StreamWriter(msEncrypt))\r\n {\r\n swEncrypt.Write(plainText);\r\n }\r\n encrypted = msEncrypt.ToArray();\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(encrypted));\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string plainText = \"ABCDEFG123456\";\r\n byte[] encrypted;\r\n using (Aes aesAlg = Aes.Create())\r\n {\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n /* FIX: Include required step (using CryptoStream) */\r\n using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))\r\n {\r\n swEncrypt.Write(plainText);\r\n }\r\n encrypted = msEncrypt.ToArray();\r\n }\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(encrypted));\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-325 (Missing Required Cryptographic Step). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-325\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-325\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE325_Missing_Required_Cryptographic_Step/CWE325_Missing_Required_Cryptographic_Step__CryptoStream_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"24174eb0e901aaa08aac5dbf9c96e18aa6e9ffd6ff08a7afe67bef43e4c90328\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-325\", \"target_weakness\": \"Missing Required Cryptographic Step\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-327-0417747d0785", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE327_Use_Broken_Crypto__3DES_01.cs\r\nLabel Definition File: CWE327_Use_Broken_Crypto.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 327 Use of Broken or Risky Cryptographic Algorithm\r\n* Sinks: 3DES\r\n* GoodSink: use AES\r\n* BadSink : use 3DES\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE327_Use_Broken_Crypto\r\n{\r\nclass CWE327_Use_Broken_Crypto__3DES_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n const string CIPHER_INPUT = \"ABCDEFG123456\";\r\n byte[] encrypted;\r\n using (TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider())\r\n {\r\n /* FLAW: Use a weak crypto algorithm, 3DES */\r\n ICryptoTransform encryptor = tdes.CreateEncryptor(tdes.Key, tdes.IV);\r\n using (MemoryStream ms = new MemoryStream())\r\n {\r\n using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter sw = new StreamWriter(cs))\r\n {\r\n sw.Write(CIPHER_INPUT);\r\n }\r\n encrypted = ms.ToArray();\r\n }\r\n }\r\n }\r\n string encPhrase = System.Text.Encoding.UTF8.GetString(encrypted);\r\n IO.WriteLine(IO.ToHex(encrypted));\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n const string CIPHER_INPUT = \"ABCDEFG123456\";\r\n byte[] encrypted;\r\n using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())\r\n {\r\n /* FIX: Use a stronger crypto algorithm, AES */\r\n ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV);\r\n using (MemoryStream ms = new MemoryStream())\r\n {\r\n using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter sw = new StreamWriter(cs))\r\n {\r\n sw.Write(CIPHER_INPUT);\r\n }\r\n encrypted = ms.ToArray();\r\n }\r\n }\r\n }\r\n string encPhrase = System.Text.Encoding.UTF8.GetString(encrypted);\r\n IO.WriteLine(IO.ToHex(encrypted));\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-327 (Use Broken Crypto). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-327\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-327\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE327_Use_Broken_Crypto/CWE327_Use_Broken_Crypto__3DES_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0417747d078500dab8df4d698bc8579706352c47dce5ca611405ae4aa7de455a\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-327\", \"target_weakness\": \"Use Broken Crypto\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-328-9989d43e25c8", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE328_Reversible_One_Way_Hash__MD5_01.cs\r\nLabel Definition File: CWE328_Reversible_One_Way_Hash.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 328 Reversible One Way Hash\r\n* Sinks: MD5\r\n* GoodSink: SHA512\r\n* BadSink : MD5\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Text;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE328_Reversible_One_Way_Hash\r\n{\r\nclass CWE328_Reversible_One_Way_Hash__MD5_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n using (HashAlgorithm md5 = new MD5CryptoServiceProvider())\r\n {\r\n /* FLAW: Insecure cryptographic hashing algorithm (MD5) */\r\n byte[] textWithUTF8 = Encoding.UTF8.GetBytes(\"Test Input\"); /* INCIDENTAL FLAW: Hard-coded input to hash algorithm */\r\n byte[] textWithReversibleHash = md5.ComputeHash(textWithUTF8);\r\n IO.WriteLine(IO.ToHex(textWithReversibleHash));\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n using (HashAlgorithm sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n /* FIX: Secure cryptographic hashing algorithm (SHA-512) */\r\n byte[] textWithUTF8 = Encoding.UTF8.GetBytes(\"Test Input\"); /* INCIDENTAL FLAW: Hard-coded input to hash algorithm */\r\n byte[] textWithReversibleHash = sha512.ComputeHash(textWithUTF8);\r\n IO.WriteLine(IO.ToHex(textWithReversibleHash));\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-328 (Reversible One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-328\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-328\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE328_Reversible_One_Way_Hash/CWE328_Reversible_One_Way_Hash__MD5_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9989d43e25c85f0b47045c196ca2df50ffb3f3443022dfa61a722c3b4104e108\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-328\", \"target_weakness\": \"Reversible One Way Hash\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-329-2dfee7f7b3bc", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01.cs\r\nLabel Definition File: CWE329_Not_Using_Random_IV_with_CBC_Mode__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 329 Not using random IV with CBC Mode\r\n* Sinks:\r\n* GoodSink: use random iv\r\n* BadSink : use hardcoded iv\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE329_Not_Using_Random_IV_with_CBC_Mode\r\n{\r\nclass CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string text = \"asdf\";\r\n /* FLAW: hardcoded initialization vector used */\r\n byte[] initializationVector =\r\n {\r\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r\n };\r\n byte[] byteCipherText = null;\r\n using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())\r\n {\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, initializationVector);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))\r\n {\r\n //Write all data to the stream.\r\n swEncrypt.Write(text);\r\n }\r\n byteCipherText = msEncrypt.ToArray();\r\n }\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string text = \"asdf\";\r\n byte[] byteCipherText = null;\r\n using (AesCryptoServiceProvider aes = new AesCryptoServiceProvider())\r\n {\r\n int blockSize = aes.BlockSize;\r\n byte[] initializationVector = new byte[blockSize/8];\r\n /* FIX: using cryptographically secure pseudo-random number as initialization vector */\r\n using (RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider())\r\n {\r\n provider.GetBytes(initializationVector);\r\n }\r\n // Create an encryptor to perform the stream transform.\r\n ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, initializationVector);\r\n // Create the streams used for encryption.\r\n using (MemoryStream msEncrypt = new MemoryStream())\r\n {\r\n using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))\r\n {\r\n using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))\r\n {\r\n //Write all data to the stream.\r\n swEncrypt.Write(text);\r\n }\r\n byteCipherText = msEncrypt.ToArray();\r\n }\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-329 (Not Using Random IV with CBC Mode). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-329\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-329\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE329_Not_Using_Random_IV_with_CBC_Mode/CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2dfee7f7b3bc50e4208d49c6f08e66c3e1970e5b35e587b00a538a244dff026b\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-329\", \"target_weakness\": \"Not Using Random IV with CBC Mode\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-336-2f5fa2de9570", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE336_Same_Seed_in_PRNG__basic_01.cs\r\nLabel Definition File: CWE336_Same_Seed_in_PRNG__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 336 Same Seed in PRNG\r\n* Sinks:\r\n* GoodSink: no explicit seed specified\r\n* BadSink : hardcoded seed\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE336_Same_Seed_in_PRNG\r\n{\r\nclass CWE336_Same_Seed_in_PRNG__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int SEED = 10;\r\n /* FLAW: using the same seed can make the PRNG sequence predictable if the seed is known */\r\n Random random = new Random(SEED);\r\n IO.WriteLine(\"\" + random.Next()); /* run this several times and notice that the bad values are always the same */\r\n IO.WriteLine(\"\" + random.Next());\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n Random random = new Random();\r\n /* FIX: no explicit seed specified; produces far less predictable PRNG sequence */\r\n IO.WriteLine(\"\" + random.Next());\r\n IO.WriteLine(\"\" + random.Next());\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-336 (Same Seed in PRNG). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-336\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-336\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE336_Same_Seed_in_PRNG/CWE336_Same_Seed_in_PRNG__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2f5fa2de9570aee84ae1acac9ce1e8b5e855a2ebd16478a60e2a7de0ce39b4b3\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-336\", \"target_weakness\": \"Same Seed in PRNG\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-338-fc9c00267f3c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE338_Weak_PRNG__random_01.cs\r\nLabel Definition File: CWE338_Weak_PRNG.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 338 Use of Cryptographically Weak PRNG\r\n* Sinks: random\r\n* GoodSink: stronger PRNG\r\n* BadSink : weak PRNG\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\n\r\nnamespace testcases.CWE338_Weak_PRNG\r\n{\r\nclass CWE338_Weak_PRNG__random_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: use a weak PRNG */\r\n IO.WriteLine(\"\" + new Random().NextDouble());\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: use a strong PRNG */\r\n using (RNGCryptoServiceProvider secureRandom = new RNGCryptoServiceProvider())\r\n {\r\n byte[] randomNumber = new byte[10];\r\n secureRandom.GetNonZeroBytes(randomNumber);\r\n IO.WriteLine(\"\" + Encoding.Default.GetString(randomNumber));\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-338 (Weak PRNG). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-338\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-338\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE338_Weak_PRNG/CWE338_Weak_PRNG__random_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"fc9c00267f3c45d4169e654c35c21bd28a53f80e51a34e0222c465c094a8b93f\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-338\", \"target_weakness\": \"Weak PRNG\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-350-b5a1496869d5", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action__GetHostEntry_01.cs\r\nLabel Definition File: CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action__GetHostEntry.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 350 Reliance on Reverse DNS Resolution for Security Action\r\n* Sinks: GetHostEntry\r\n* GoodSink: Log host name without using it in a security decision\r\n* BadSink : Use the reverse DNS of the client to determine whether to allow the connection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Net;\r\n\r\nnamespace testcases.CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action\r\n{\r\nclass CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action__GetHostEntry_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string secret_hostname = \"www.domain.nonexistanttld\";\r\n IPAddress hostIPAddress = IPAddress.Parse(\"127.0.0.1\");\r\n IPHostEntry hostInfo = Dns.GetHostEntry(hostIPAddress);\r\n /* FLAW: Using the reverse DNS of the client to determine whether to allow the connection */\r\n if (hostInfo.HostName.Equals(secret_hostname))\r\n {\r\n IO.WriteLine(\"Access granted.\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string secret_hostname = \"www.domain.nonexistanttld\";\r\n IPAddress hostIPAddress = IPAddress.Parse(\"127.0.0.1\");\r\n IPHostEntry hostInfo = Dns.GetHostEntry(hostIPAddress);\r\n /* FIX: Copy the host name to a log - do not attempt to use the host name in a security decision */\r\n if (hostInfo.HostName.Equals(secret_hostname))\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Info, hostInfo.HostName);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-350 (Reliance on Reverse DNS Resolution for Security Action). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-350\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-350\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action/CWE350_Reliance_on_Reverse_DNS_Resolution_for_Security_Action__GetHostEntry_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"b5a1496869d5b7b134b1fb30fdd8d0e691c8c1c44d084dacd8626f80d330aa00\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-350\", \"target_weakness\": \"Reliance on Reverse DNS Resolution for Security Action\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-36-8ef43d7da336", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE36_Absolute_Path_Traversal__Connect_tcp_01.cs\r\nLabel Definition File: CWE36_Absolute_Path_Traversal.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 36 Absolute Path Traversal\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: readFile read line from file from disk\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nusing System.Web;\r\n\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE36_Absolute_Path_Traversal\r\n{\r\n\r\nclass CWE36_Absolute_Path_Traversal__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* POTENTIAL FLAW: unvalidated or sandboxed value */\r\n if (data != null)\r\n {\r\n if (File.Exists(data))\r\n {\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(data))\r\n {\r\n IO.WriteLine(sr.ReadLine());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n /* POTENTIAL FLAW: unvalidated or sandboxed value */\r\n if (data != null)\r\n {\r\n if (File.Exists(data))\r\n {\r\n try\r\n {\r\n using (StreamReader sr = new StreamReader(data))\r\n {\r\n IO.WriteLine(sr.ReadLine());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-36 (Absolute Path Traversal). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-36\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-36\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE36_Absolute_Path_Traversal/CWE36_Absolute_Path_Traversal__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8ef43d7da33607a24ad3c1b926f5f8e7547b8d6bb5e7bcc775267d17915c4695\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-36\", \"target_weakness\": \"Absolute Path Traversal\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-366-01ecd9229005", "input": "/*\r\n * @description Demonstrates a race condition in multithreaded code that accesses a globally shared variable.\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.Threading;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE366_Race_Condition_within_a_Thread\r\n{\r\n class CWE366_Race_Condition_within_a_Thread__Global_Variable_01 : AbstractTestCase\r\n {\r\n static private readonly object mainLock = new object();\r\n int result = 0;\r\n\r\n void Work_Bad()\r\n {\r\n for (int i = 0; i < 100000; i++)\r\n {\r\n\t\t\t\t/* FLAW: This global variable is accessed without a lock */\r\n result = result + 1;\r\n }\r\n }\r\n\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n CWE366_Race_Condition_within_a_Thread__Global_Variable_01 badInst = new CWE366_Race_Condition_within_a_Thread__Global_Variable_01();\r\n Thread worker1 = new Thread(badInst.Work_Bad);\r\n Thread worker2 = new Thread(badInst.Work_Bad);\r\n Thread worker3 = new Thread(badInst.Work_Bad);\r\n worker1.Start();\r\n worker2.Start();\r\n worker3.Start();\r\n IO.WriteLine(badInst.result);\r\n }\r\n#endif // OMITBAD\r\n\r\n void Work_Good()\r\n {\r\n for (int i = 0; i < 100000; i++)\r\n {\r\n\t\t\t\t/* FIX: Provide lock to protect the integrity of the global variable */\r\n Monitor.Enter(mainLock);\r\n result = result + 1;\r\n Monitor.Exit(mainLock);\r\n }\r\n }\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n CWE366_Race_Condition_within_a_Thread__Global_Variable_01 goodInst = new CWE366_Race_Condition_within_a_Thread__Global_Variable_01();\r\n Thread worker1 = new Thread(goodInst.Work_Good);\r\n Thread worker2 = new Thread(goodInst.Work_Good);\r\n Thread worker3 = new Thread(goodInst.Work_Good);\r\n worker1.Start();\r\n worker2.Start();\r\n worker3.Start();\r\n IO.WriteLine(goodInst.result);\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-366 (Race Condition within a Thread). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-366\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-366\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE366_Race_Condition_within_a_Thread/CWE366_Race_Condition_within_a_Thread__Global_Variable_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"01ecd9229005c57712223582313832376984aeb978a523100ffd832038ddb58d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-366\", \"target_weakness\": \"Race Condition within a Thread\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-369-f35c41ef6632", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE369_Divide_by_Zero__float_Environment_divide_01.cs\r\nLabel Definition File: CWE369_Divide_by_Zero__float.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 369 Divide by zero\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero number (two)\r\n* Sinks: divide\r\n* GoodSink: Check for zero before dividing\r\n* BadSink : Dividing by a value that may be zero\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE369_Divide_by_Zero\r\n{\r\nclass CWE369_Divide_by_Zero__float_Environment_divide_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n float data;\r\n data = -1.0f; /* Initialize data */\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n string stringNumber = Environment.GetEnvironmentVariable(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = int.Parse(stringNumber.Trim());\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n /* POTENTIAL FLAW: Possibly divide by zero */\r\n int result = (int)(100.0 / data);\r\n IO.WriteLine(result);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n float data;\r\n /* FIX: Use a hardcoded number that won't a divide by zero */\r\n data = 2.0f;\r\n /* POTENTIAL FLAW: Possibly divide by zero */\r\n int result = (int)(100.0 / data);\r\n IO.WriteLine(result);\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n float data;\r\n data = -1.0f; /* Initialize data */\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n string stringNumber = Environment.GetEnvironmentVariable(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = int.Parse(stringNumber.Trim());\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n /* FIX: Check for value of or near zero before dividing */\r\n if (Math.Abs(data) > 0.000001)\r\n {\r\n int result = (int)(100.0 / data);\r\n IO.WriteLine(result);\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"This would result in a divide by zero\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-369 (Divide by Zero). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-369\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-369\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE369_Divide_by_Zero/s01/CWE369_Divide_by_Zero__float_Environment_divide_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f35c41ef66321a532f623a2422d3b074f1a43ce5f07caa9e0e50fb08c07634dc\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-369\", \"target_weakness\": \"Divide by Zero\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-379-ac8bd2a84b51", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01.cs\r\nLabel Definition File: CWE379_Temporary_File_Creation_in_Insecure_Dir__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 379 File Creation in Insecure Directory\r\n* Sinks:\r\n* GoodSink: Restrict permissions on directory\r\n* BadSink : Permissions never set on directory\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE379_Temporary_File_Creation_in_Insecure_Dir\r\n{\r\nclass CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string tempPath = Path.GetTempFileName();\r\n int p = (int)Environment.OSVersion.Platform;\r\n string directoryName;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n directoryName = \"C:\\\\testcases\\\\insecureDir\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n directoryName = \"/home/user/testcases/insecureDir/\";\r\n }\r\n try\r\n {\r\n /* FLAW: Permissions never set on directory */\r\n Directory.CreateDirectory(directoryName);\r\n if (Directory.Exists(directoryName))\r\n {\r\n IO.WriteLine(\"Directory created\");\r\n using (StreamWriter sw = new StreamWriter(tempPath))\r\n {\r\n /* Set file as writable by owner, readable by owner, not executable (if file system supports it) */\r\n File.SetAttributes(tempPath, FileAttributes.Normal);\r\n /* Write something to the file */\r\n sw.Write(42);\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error writing to temporary file\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Delete the temporary file */\r\n if (File.Exists(tempPath))\r\n {\r\n File.Delete(tempPath);\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string tempPath = Path.GetTempFileName();\r\n int p = (int)Environment.OSVersion.Platform;\r\n string directoryName;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n directoryName = \".\\\\src\\\\testcases\\\\CWE379_File_Creation_in_Insecure_Dir\\\\secureDir\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n directoryName = \"/home/user/testcases/CWE379_File_Creation_in_Insecure_Dir/secureDir/\";\r\n }\r\n try\r\n {\r\n /* FIX: Set newDirectory as writable by owner, readable by owner, not executable (if file system supports it) */\r\n File.SetAttributes(directoryName, FileAttributes.Normal);\r\n Directory.CreateDirectory(directoryName);\r\n if (Directory.Exists(directoryName))\r\n {\r\n IO.WriteLine(\"Directory created\");\r\n using (StreamWriter sw = new StreamWriter(tempPath))\r\n {\r\n /* Set file as writable by owner, readable by owner, not executable (if file system supports it) */\r\n File.SetAttributes(tempPath, FileAttributes.Normal);\r\n /* Write something to the file */\r\n sw.Write(42);\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error writing to temporary file\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Delete the temporary file */\r\n if (File.Exists(tempPath))\r\n {\r\n File.Delete(tempPath);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-379 (Temporary File Creation in Insecure Dir). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-379\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-379\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE379_Temporary_File_Creation_in_Insecure_Dir/CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ac8bd2a84b51d1ef27b252cc61c0a152fa8c45fc2bb063cb6ae6d4cf9bcdeafd\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-379\", \"target_weakness\": \"Temporary File Creation in Insecure Dir\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-390-f1c458601a1d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE390_Error_Without_Action__CreateDirectory_01.cs\r\nLabel Definition File: CWE390_Error_Without_Action.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 390 Detection of Error Condition Without Action\r\n* Sinks: CreateDirectory\r\n* GoodSink: Throw Exception if newDirectory cannot be created\r\n* BadSink : Do nothing if newDirectory cannot be created\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE390_Error_Without_Action\r\n{\r\nclass CWE390_Error_Without_Action__CreateDirectory_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int p = (int)Environment.OSVersion.Platform;\r\n string newDirectory = null;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n newDirectory = \"C:\\\\lvl_1\\\\lvl_2\\\\lvl_3\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n newDirectory = \"/home/user/lvl_1/lvl_2/lvl_3/\";\r\n }\r\n if (!Directory.CreateDirectory(newDirectory).Exists)\r\n {\r\n /* FLAW: do nothing if newDirectory cannot be created */\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n int p = (int)Environment.OSVersion.Platform;\r\n string newDirectory = null;\r\n if (p == (int)PlatformID.Win32NT || p == (int)PlatformID.Win32Windows || p == (int)PlatformID.Win32S || p == (int)PlatformID.WinCE)\r\n {\r\n /* running on Windows */\r\n newDirectory = \"C:\\\\lvl_1\\\\lvl_2\\\\lvl_3\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n newDirectory = \"/home/user/lvl_1/lvl_2/lvl_3/\";\r\n }\r\n /* FIX: report the CreateDirectory failure and throw a new Exception */\r\n try\r\n {\r\n Directory.CreateDirectory(newDirectory);\r\n }\r\n catch (Exception except)\r\n {\r\n throw except;\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-390 (Error Without Action). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-390\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-390\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE390_Error_Without_Action/CWE390_Error_Without_Action__CreateDirectory_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f1c458601a1d6a43f112635a1b852340e59e5aae61b83d303cf54aaedb5a964a\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-390\", \"target_weakness\": \"Error Without Action\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-395-e9beca4eea34", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE395_Catch_NullPointerException__basic_01.cs\r\nLabel Definition File: CWE395_Catch_NullPointerException__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 395 Use of NullPointerException Catch to Detect NULL Pointer Dereference\r\n* Sinks:\r\n* GoodSink: Check for null before taking action\r\n* BadSink : Catch NullReferenceException to detect null\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE395_Catch_NullPointerException\r\n{\r\nclass CWE395_Catch_NullPointerException__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n String catchingNull = null;\r\n if (new Random().Next(2) == 1)\r\n {\r\n catchingNull = \"CWE395\";\r\n }\r\n try\r\n {\r\n /* INCIDENTAL: Possible Null Pointer Dereference (CWE476 / CWE690) */\r\n if (catchingNull.Equals(\"CWE395\"))\r\n {\r\n IO.WriteLine(\"catchingNull is CWE395\");\r\n }\r\n }\r\n catch (NullReferenceException exceptNullPointer) /* FLAW: Use of catch block to detect null dereferences */\r\n {\r\n IO.WriteLine(\"catchingNull is null\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n String catchingNull = null;\r\n if (new Random().Next(2) == 1)\r\n {\r\n catchingNull = \"CWE395\";\r\n }\r\n if (catchingNull != null) /* FIX: Check for null before calling equals() */\r\n {\r\n if (catchingNull.Equals(\"CWE395\"))\r\n {\r\n IO.WriteLine(\"catchingNull is CWE395\");\r\n }\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"catchingNull is null\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-395 (Catch NullPointerException). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-395\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-395\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE395_Catch_NullPointerException/CWE395_Catch_NullPointerException__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e9beca4eea341bf1134fa6d25b4f0fae24cde9e92d40b867209890f176eb5940\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-395\", \"target_weakness\": \"Catch NullPointerException\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-396-77870319f898", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE396_Catch_Generic_Exception__Exception_01.cs\r\nLabel Definition File: CWE396_Catch_Generic_Exception.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 396 An overly broad catch statement may cause errors in program execution if unexpected exceptions are thrown\r\n* Sinks: Exception\r\n* GoodSink: Catch specific exception type (NumberFormatException)\r\n* BadSink : Catch Exception, which is overly generic\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE396_Catch_Generic_Exception\r\n{\r\nclass CWE396_Catch_Generic_Exception__Exception_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n try\r\n {\r\n int.Parse(\"Test\"); /* Will throw FormatException */\r\n }\r\n catch (Exception exception) /* FLAW: Catch Exception, which is overly generic */\r\n {\r\n IO.WriteLine(\"Caught Exception\");\r\n throw exception; /* Rethrow */\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n try\r\n {\r\n int.Parse(\"Test\"); /* Will throw FormatException */\r\n }\r\n catch (FormatException exceptNumberFormat) /* FIX: Catch FormatException */\r\n {\r\n IO.WriteLine(\"Caught Exception\");\r\n throw exceptNumberFormat; /* Rethrow */\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-396 (Catch Generic Exception). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-396\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-396\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE396_Catch_Generic_Exception/CWE396_Catch_Generic_Exception__Exception_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"77870319f898e117d937c796bff5b06c9a64fe4a8cd86494a15da1d1e70e0b80\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-396\", \"target_weakness\": \"Catch Generic Exception\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-397-230acf68163c", "input": "/*\r\n * @description Throw Generic Exception\r\n *\r\n * */\r\n\r\nusing System;\r\nusing System.IO;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE397_Throw_Generic_Exception\r\n{\r\n class CWE397_Throw_Generic_Exception__throw_Exception_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n try\r\n {\r\n using (StreamReader streamFileInput = new StreamReader(\"filename.txt\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tIO.WriteLine(\"File 'filename.txt' exists\");\r\n\t\t\t\t}\r\n }\r\n catch (Exception exception)\r\n {\r\n throw exception; /* FLAW: Throwing a very generic exception */\r\n }\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n private void Good1()\r\n {\r\n try\r\n {\r\n using (StreamReader streamFileInput = new StreamReader(\"filename.txt\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tIO.WriteLine(\"File 'filename.txt' exists\");\r\n\t\t\t\t}\r\n }\r\n catch (FileNotFoundException exception)\r\n {\r\n throw exception; /* FIX: Throwing a specific exception */\r\n }\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-397 (Throw Generic Exception). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-397\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-397\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE397_Throw_Generic_Exception/CWE397_Throw_Generic_Exception__throw_Exception_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"230acf68163cccb3a2a95fa3767fda11e59034b4efc00ea5926e310f42c3a055\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-397\", \"target_weakness\": \"Throw Generic Exception\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-398-ac6dbd4e3f56", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE398_Code_Quality__empty_block_01.cs\r\nLabel Definition File: CWE398_Code_Quality.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 398 One of the 7 Pernicious Kingdoms - Code Quality\r\n* Sinks: empty_block\r\n* GoodSink: Include some code inside a block\r\n* BadSink : An empty code block has no effect\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE398_Code_Quality\r\n{\r\nclass CWE398_Code_Quality__empty_block_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: The empty block on the next line has no effect */\r\n {\r\n }\r\n IO.WriteLine(\"Hello from Bad()\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: Include some code inside the block */\r\n {\r\n String sentence = \"Inside the block\"; /* Define a variable to justify having a block for scoping */\r\n IO.WriteLine(sentence);\r\n }\r\n IO.WriteLine(\"Hello from Good()\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-398 (Code Quality). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-398\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-398\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE398_Code_Quality/CWE398_Code_Quality__empty_block_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ac6dbd4e3f56f6c7501277e6cca1d4fc438f35f5bd5eeb65a6bcd22411a02c70\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-398\", \"target_weakness\": \"Code Quality\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-404-58fce7658f8e", "input": "/*\r\n * @description Improper Resource Shutdown. Performs some, but not all, necessary resource cleanup (FileReader is not closed properly).\r\n * \r\n * */\r\n\r\nusing TestCaseSupport;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE404_Improper_Resource_Shutdown\r\n{\r\n\r\n class CWE404_Improper_Resource_Shutdown__FileReader_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n StreamReader sr = null;\r\n\r\n try\r\n {\r\n sr = new StreamReader(\"C:\\\\file.txt\");\r\n string readString = sr.ReadLine();\r\n\r\n IO.WriteLine(readString);\r\n\r\n /* FLAW: Attempts to close the streams should be in a finally block. */\r\n try\r\n {\r\n if (sr != null)\r\n {\r\n sr.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error closing StreamReader\", exceptIO);\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n }\r\n#endif // OMITBAD\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void Good1()\r\n {\r\n StreamReader sr = null;\r\n\r\n try\r\n {\r\n sr = new StreamReader(\"C:\\\\file.txt\");\r\n string readString = sr.ReadLine();\r\n\r\n IO.WriteLine(readString);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with stream reading\", exceptIO);\r\n }\r\n /* FIX: Streams closed appropriately */\r\n finally\r\n {\r\n try\r\n {\r\n if (sr != null)\r\n {\r\n sr.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error closing FileReader\", exceptIO);\r\n }\r\n }\r\n }\r\n#endif // OMITGOOD\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-404 (Improper Resource Shutdown). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-404\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-404\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE404_Improper_Resource_Shutdown/CWE404_Improper_Resource_Shutdown__FileReader_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"58fce7658f8e2d3011b46801683ea1dd2b9c7d705d0b531d17e3375ae11482d7\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-404\", \"target_weakness\": \"Improper Resource Shutdown\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-426-147fccf9e48c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE426_Untrusted_Search_Path__Process_01.cs\r\nLabel Definition File: CWE426_Untrusted_Search_Path.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 426 Untrusted Search Path\r\n* Sinks: Process\r\n* GoodSink: Execute the command with full path\r\n* BadSink : Execute the command without full path\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Runtime.InteropServices;\r\nusing System.Diagnostics;\r\n\r\nnamespace testcases.CWE426_Untrusted_Search_Path\r\n{\r\nclass CWE426_Untrusted_Search_Path__Process_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: Execute command without the full path */\r\n string badOsCommand;\r\n string commandArgs;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\r\n {\r\n badOsCommand = \"ls\";\r\n commandArgs = \"-la\";\r\n }\r\n else\r\n {\r\n badOsCommand = \"cmd.exe\";\r\n commandArgs = \"/C dir\";\r\n }\r\n using (Process process = new Process())\r\n {\r\n ProcessStartInfo startInfo = new ProcessStartInfo();\r\n startInfo.FileName = badOsCommand;\r\n startInfo.Arguments = commandArgs;\r\n process.StartInfo = startInfo;\r\n process.StartInfo.UseShellExecute = false;\r\n process.Start();\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: Execute command with the full path */\r\n string goodOsCommand;\r\n string commandArgs;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\r\n {\r\n goodOsCommand = \"/bin/ls\";\r\n commandArgs = \"-la\";\r\n }\r\n else\r\n {\r\n goodOsCommand = \"c:\\\\windows\\\\system32\\\\cmd.exe\";\r\n commandArgs = \"/C dir\";\r\n }\r\n using (Process process = new Process())\r\n {\r\n ProcessStartInfo startInfo = new ProcessStartInfo();\r\n startInfo.FileName = goodOsCommand;\r\n startInfo.Arguments = commandArgs;\r\n process.StartInfo = startInfo;\r\n process.StartInfo.UseShellExecute = false;\r\n process.Start();\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-426 (Untrusted Search Path). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-426\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-426\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE426_Untrusted_Search_Path/CWE426_Untrusted_Search_Path__Process_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"147fccf9e48c2773aaa615cf1baf171ccdcd85dd18f785371db8e85e19a75eb9\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-426\", \"target_weakness\": \"Untrusted Search Path\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-427-662f0aa50c47", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE427_Uncontrolled_Search_Path_Element__Connect_tcp_01.cs\r\nLabel Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 427 Uncontrolled Search Path Element\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: Use a hardcoded path\r\n* BadSink: Environment\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\nusing System.Runtime.InteropServices;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE427_Uncontrolled_Search_Path_Element\r\n{\r\n\r\nclass CWE427_Uncontrolled_Search_Path_Element__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */\r\n Environment.SetEnvironmentVariable(\"PATH\", data);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Set the path as the \"system\" path */\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\r\n {\r\n data = \"/bin\";\r\n }\r\n else\r\n {\r\n data = \"%SystemRoot%\\\\system32\";\r\n }\r\n /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */\r\n Environment.SetEnvironmentVariable(\"PATH\", data);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-427 (Uncontrolled Search Path Element). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-427\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-427\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE427_Uncontrolled_Search_Path_Element/CWE427_Uncontrolled_Search_Path_Element__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"662f0aa50c4721530edc8773367c095cda103144b4192c2fb7f9e702fba33af5\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-427\", \"target_weakness\": \"Uncontrolled Search Path Element\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-440-8464d2e52a94", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE440_Expected_Behavior_Violation__basic_Exception_01.cs\r\nLabel Definition File: CWE440_Expected_Behavior_Violation__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 440 Expected Behavior Violation\r\n* Sinks: Exception\r\n* GoodSink: Ensure user input is an integer\r\n* BadSink : Don't ensure that the user input is an integer, thus possibly causing unexepected behavior\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE440_Expected_Behavior_Violation\r\n{\r\nclass CWE440_Expected_Behavior_Violation__basic_Exception_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n IO.WriteLine(\"Please enter an integer:\");\r\n string userInput = Console.ReadLine();\r\n /* FLAW: Don't ensure that the user input is an integer, thus possibly causing unexepected behavior */\r\n string x = string.Format(\"{0:0000}\", userInput);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n IO.WriteLine(\"Please enter an integer:\");\r\n string userInput = Console.ReadLine();\r\n /* FIX: Ensure user input is an integer. */\r\n try\r\n {\r\n int.Parse(userInput);\r\n string x = string.Format(\"{0:0000}\", userInput);\r\n }\r\n catch (FormatException formatException)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error with int parsing\", formatException);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-440 (Expected Behavior Violation). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-440\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-440\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE440_Expected_Behavior_Violation/CWE440_Expected_Behavior_Violation__basic_Exception_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8464d2e52a9460241ff9fd53e597b813789992cdb41c5b384b91e79f366d5c21\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-440\", \"target_weakness\": \"Expected Behavior Violation\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-459-811aa8c547b7", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE459_Incomplete_Cleanup__temp_file_01.cs\r\nLabel Definition File: CWE459_Incomplete_Cleanup.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 459 Incomplete Cleanup\r\n* Sinks: temp_file\r\n* GoodSink: Delete the temporary file on exit\r\n* BadSink : Don't delete the temporary file\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE459_Incomplete_Cleanup\r\n{\r\nclass CWE459_Incomplete_Cleanup__temp_file_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string tempPath = Path.GetTempFileName();\r\n try\r\n {\r\n using (StreamWriter sw = File.CreateText(tempPath))\r\n {\r\n IO.WriteLine(sw.ToString());\r\n /* FLAW: Do not delete the temporary file */\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Could not create temporary file\", exceptIO);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string tempPath = Path.GetTempFileName();\r\n try\r\n {\r\n using (StreamWriter sw = File.CreateText(tempPath))\r\n {\r\n IO.WriteLine(sw.ToString());\r\n /* FIX: Call Delete() so that the file will be deleted */\r\n File.Delete(tempPath);\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Could not create temporary file\", exceptIO);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-459 (Incomplete Cleanup). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-459\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-459\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE459_Incomplete_Cleanup/CWE459_Incomplete_Cleanup__temp_file_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"811aa8c547b7a70cdd97d45659a52d6ef0b00dd597d1e3e3174c787128d6d855\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-459\", \"target_weakness\": \"Incomplete Cleanup\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-470-4c1f0588bca8", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE470_Unsafe_Reflection__Web_Connect_tcp_01.cs\r\nLabel Definition File: CWE470_Unsafe_Reflection__Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: Set data to a hardcoded class name\r\n* BadSink: Instantiate class named in data\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE470_Unsafe_Reflection\r\n{\r\n\r\nclass CWE470_Unsafe_Reflection__Web_Connect_tcp_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */\r\n var container = Activator.CreateInstance(null, data);\r\n Object tempClassObj = container.Unwrap();\r\n IO.WriteLine(tempClassObj.GetType().ToString()); /* Use tempClassObj in some way */\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded class name */\r\n data = \"Testing.test\";\r\n /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */\r\n var container = Activator.CreateInstance(null, data);\r\n Object tempClassObj = container.Unwrap();\r\n IO.WriteLine(tempClassObj.GetType().ToString()); /* Use tempClassObj in some way */\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-470 (Unsafe Reflection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-470\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-470\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE470_Unsafe_Reflection/CWE470_Unsafe_Reflection__Web_Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4c1f0588bca8763f7d26c1dab7df9c7104ba42253952a22720910ca144bd4766\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-470\", \"target_weakness\": \"Unsafe Reflection\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-476-427c0a20cc17", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE476_NULL_Pointer_Dereference__Integer_01.cs\r\nLabel Definition File: CWE476_NULL_Pointer_Dereference.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 476 Null Pointer Dereference\r\n* BadSource: Set data to null\r\n* GoodSource: Set data to a non-null value\r\n* Sinks:\r\n* GoodSink: add check to prevent possibility of null dereference\r\n* BadSink : possibility of null dereference\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE476_NULL_Pointer_Dereference\r\n{\r\nclass CWE476_NULL_Pointer_Dereference__Integer_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int? data;\r\n /* POTENTIAL FLAW: data is null */\r\n data = null;\r\n /* POTENTIAL FLAW: null dereference will occur if data is null */\r\n IO.WriteLine(\"\" + data.ToString());\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n int? data;\r\n /* FIX: hardcode data to non-null */\r\n data = Int32.Parse(\"5\");\r\n /* POTENTIAL FLAW: null dereference will occur if data is null */\r\n IO.WriteLine(\"\" + data.ToString());\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n int? data;\r\n /* POTENTIAL FLAW: data is null */\r\n data = null;\r\n /* FIX: validate that data is non-null */\r\n if (data != null)\r\n {\r\n IO.WriteLine(\"\" + data.ToString());\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"data is null\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-476 (NULL Pointer Dereference). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-476\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-476\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE476_NULL_Pointer_Dereference/CWE476_NULL_Pointer_Dereference__Integer_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"427c0a20cc17d00d1deef318c7cc7c312897f6fe5df5d1203167dbb6348f398f\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-476\", \"target_weakness\": \"NULL Pointer Dereference\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-478-75ea1d688b57", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE478_Missing_Default_Case_in_Switch__basic_01.cs\r\nLabel Definition File: CWE478_Missing_Default_Case_in_Switch__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 478 Missing Default Case in Switch\r\n* Sinks:\r\n* GoodSink: Use default case in switch statement\r\n* BadSink : No default case in a switch statement\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE478_Missing_Default_Case_in_Switch\r\n{\r\nclass CWE478_Missing_Default_Case_in_Switch__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string stringIntValue = \"\";\r\n int x = (new Random()).Next(3);\r\n switch (x)\r\n {\r\n case 0:\r\n stringIntValue = \"0\";\r\n break;\r\n case 1:\r\n stringIntValue = \"1\";\r\n break;\r\n /* FLAW: x could be 2, and there is no 'default' case for that */\r\n }\r\n IO.WriteLine(stringIntValue);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string stringIntValue = \"\";\r\n int x = (new Random()).Next(3);\r\n switch (x)\r\n {\r\n case 0:\r\n stringIntValue = \"0\";\r\n break;\r\n case 1:\r\n stringIntValue = \"1\";\r\n break;\r\n /* FIX: Add a default case */\r\n default:\r\n stringIntValue = \"2\";\r\n break;\r\n }\r\n IO.WriteLine(stringIntValue);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-478 (Missing Default Case in Switch). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-478\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-478\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE478_Missing_Default_Case_in_Switch/CWE478_Missing_Default_Case_in_Switch__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"75ea1d688b57a02736bf5ea77bd0f41a54a9bf77621a407a9536eef6d8076f29\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-478\", \"target_weakness\": \"Missing Default Case in Switch\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-481-3c9357da847d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE481_Assigning_Instead_of_Comparing__basic_01.cs\r\nLabel Definition File: CWE481_Assigning_Instead_of_Comparing__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 481 Assigning Instead of Comparing\r\n* Sinks:\r\n* GoodSink: Comparing\r\n* BadSink : Assigning instead of comparing\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE481_Assigning_Instead_of_Comparing\r\n{\r\nclass CWE481_Assigning_Instead_of_Comparing__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int zeroOrOne = (new Random()).Next(2);\r\n bool isZero = (zeroOrOne == 0);\r\n if (isZero = true) /* FLAW: should be == and INCIDENTIAL CWE 571 Expression Is Always True */\r\n {\r\n IO.WriteLine(\"zeroOrOne is 0\");\r\n }\r\n IO.WriteLine(\"isZero is: \" + isZero);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n int zeroOrOne = (new Random()).Next(2); /* i will be 0 or 1 */\r\n bool isZero = (zeroOrOne == 0);\r\n if (isZero == true) /* FIX: using == instead of = */\r\n {\r\n IO.WriteLine(\"zeroOrOne is 0\");\r\n }\r\n IO.WriteLine(\"isZero is: \" + isZero);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-481 (Assigning Instead of Comparing). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-481\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-481\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE481_Assigning_Instead_of_Comparing/CWE481_Assigning_Instead_of_Comparing__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3c9357da847db9b6dd1d4d7f5a5676423dc43e940359851240e4219f1d8ddc9f\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-481\", \"target_weakness\": \"Assigning Instead of Comparing\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-482-ca53a04a525a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE482_Comparing_Instead_of_Assigning__basic_01.cs\r\nLabel Definition File: CWE482_Comparing_Instead_of_Assigning__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 482 Comparing Instead of Assigning\r\n* Sinks:\r\n* GoodSink: Assigning\r\n* BadSink : Comparing instead of assigning\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE482_Comparing_Instead_of_Assigning\r\n{\r\nclass CWE482_Comparing_Instead_of_Assigning__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int zeroOrOne = (new Random()).Next(2);\r\n bool isZero = false;\r\n if ((isZero == (zeroOrOne == 0)) == true) /* FLAW: should be (isZero = (zeroOrOne == 0)) */\r\n {\r\n IO.WriteLine(\"zeroOrOne is 0\");\r\n }\r\n IO.WriteLine(\"isZero is: \" + isZero);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n int zeroOrOne = (new Random()).Next(2);\r\n bool isZero = false;\r\n if ((isZero = (zeroOrOne == 0)) == true) /* FIX: correct assignment */\r\n {\r\n IO.WriteLine(\"zeroOrOne is 0\");\r\n }\r\n IO.WriteLine(\"isZero is: \" + isZero);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-482 (Comparing Instead of Assigning). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-482\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-482\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE482_Comparing_Instead_of_Assigning/CWE482_Comparing_Instead_of_Assigning__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ca53a04a525a1053475b650b4cd9b655a34627392bb6453e2d6f8e9aa0bc86eb\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-482\", \"target_weakness\": \"Comparing Instead of Assigning\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-483-26e369185763", "input": "/*\r\n * @description Incorrect Block Delimitation\r\n *\r\n * */\r\n\r\nusing System;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE483_Incorrect_Block_Delimitation\r\n{\r\n class CWE483_Incorrect_Block_Delimitation__if_without_braces_multiline_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int x, y;\r\n\r\n x = (new Random()).Next(3);\r\n y = 0;\r\n\r\n /* FLAW: forgot to put these two statements within braces\r\n * (separate lines, but indentation hints at programmer's intent) */\r\n if (x == 0)\r\n IO.WriteLine(\"x == 0\");\r\n\t\t\t\ty = 1;\r\n\r\n if (y == 1)\r\n {\r\n IO.WriteLine(\"x was 0\");\r\n }\r\n }\r\n#endif // OMITBAD\r\n#if (!OMITGOOD)\r\n private void Good1()\r\n {\r\n int x, y;\r\n\r\n x = (new Random()).Next(3);\r\n y = 0;\r\n\r\n /* FIX: put the related statements within braces */\r\n if (x == 0)\r\n {\r\n IO.WriteLine(\"x == 0\");\r\n y = 1;\r\n }\r\n\r\n if (y == 1)\r\n {\r\n IO.WriteLine(\"x was 0\");\r\n }\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-483 (Incorrect Block Delimitation). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-483\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-483\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE483_Incorrect_Block_Delimitation/CWE483_Incorrect_Block_Delimitation__if_without_braces_multiline_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"26e3691857635a35d851a3fb29a3e1a9966fd7ea647abc3a867aac3d58de56a9\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-483\", \"target_weakness\": \"Incorrect Block Delimitation\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-486-4a145f050ab5", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE486_Compare_Classes_by_Name__basic_01.cs\r\nLabel Definition File: CWE486_Compare_Classes_by_Name__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 486 Compare Classes by Name\r\n* Sinks:\r\n* GoodSink: properly compare class\r\n* BadSink : Compare class names\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE486_Compare_Classes_by_Name\r\n{\r\nclass CWE486_Compare_Classes_by_Name__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: Differentiating by name is not enough, since different classes in different packages may use the same name */\r\n testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper helperClass = new testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper();\r\n testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper helperClassRoot = new testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper();\r\n if (helperClassRoot.GetType().Name.Equals(helperClass.GetType().Name))\r\n {\r\n IO.WriteLine(\"Classes are the same\");\r\n }\r\n else\r\n {\r\n /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */\r\n IO.WriteLine(\"Classes are different\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper helperClass = new testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper();\r\n testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper helperClassRoot = new testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper();\r\n /* FIX: Compare the class types and not the names */\r\n if (helperClassRoot.ToString().Equals(helperClass.ToString()))\r\n {\r\n /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */\r\n IO.WriteLine(\"Classes are the same\");\r\n }\r\n else\r\n {\r\n IO.WriteLine(\"Classes are different\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-486 (Compare Classes by Name). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-486\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-486\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE486_Compare_Classes_by_Name/CWE486_Compare_Classes_by_Name__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4a145f050ab58082ef9050e29edf401276c22a100ee0204a28a8fd3f332e25ee\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-486\", \"target_weakness\": \"Compare Classes by Name\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-506-40dd1a5604ca", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE506_Embedded_Malicious_Code__base64_encoded_payload_01.cs\r\nLabel Definition File: CWE506_Embedded_Malicious_Code.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 506 Embedded Malicious Code\r\n* Sinks: base64_encoded_payload\r\n* GoodSink: Use a plaintext command\r\n* BadSink : Use a base64 encoded payload in an attempt to hide the command\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Diagnostics;\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE506_Embedded_Malicious_Code\r\n{\r\nclass CWE506_Embedded_Malicious_Code__base64_encoded_payload_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: encoded \"calc.exe\" */\r\n string encodedPayload = \"Y2FsYy5leGU=\";\r\n byte[] data = Convert.FromBase64String(encodedPayload);\r\n string base64Decoded = System.Text.Encoding.ASCII.GetString(data);\r\n try\r\n {\r\n Process exeProcess = Process.Start(base64Decoded);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error executing command\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: plaintext command */\r\n String decodedPayload = \"calc.exe\";\r\n try\r\n {\r\n Process exeProcess = Process.Start(decodedPayload);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error executing command\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-506 (Embedded Malicious Code). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-506\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-506\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE506_Embedded_Malicious_Code/CWE506_Embedded_Malicious_Code__base64_encoded_payload_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"40dd1a5604caabc124181ee51f25563d32b933e7a93482192380c6248fdd4f67\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-506\", \"target_weakness\": \"Embedded Malicious Code\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-510-fae82f1f08bb", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE510_Trapdoor__hostname_based_logic_01.cs\r\nLabel Definition File: CWE510_Trapdoor.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 510 Trapdoor\r\n* Sinks: hostname_based_logic\r\n* GoodSink: No special code for a specific hostname\r\n* BadSink : Special code is executed upon connection of a specific hostname\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\nusing System.Net;\r\nusing System.Text;\r\n\r\nnamespace testcases.CWE510_Trapdoor\r\n{\r\nclass CWE510_Trapdoor__hostname_based_logic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n TcpListener listener = null;\r\n TcpClient tcpConn = null;\r\n Stream streamOutput = null;\r\n int port = 20000;\r\n try\r\n {\r\n listener = new TcpListener(IPAddress.Parse(\"10.10.1.10\"), port);\r\n listener.Start();\r\n tcpConn = listener.AcceptTcpClient(); /* INCIDENTAL: Use of Socket */\r\n /* FLAW: hostname-based Logic */\r\n IPEndPoint endPoint = (IPEndPoint)tcpConn.Client.RemoteEndPoint;\r\n IPAddress ipAddress = endPoint.Address;\r\n IPHostEntry hostEntry = Dns.GetHostEntry(ipAddress);\r\n if (hostEntry.HostName.Equals(\"admin.google.com\"))\r\n {\r\n streamOutput = tcpConn.GetStream();\r\n streamOutput.Write(Encoding.UTF8.GetBytes(\"Welcome, admin!\"), 0, \"Welcome, admin!\".Length);\r\n }\r\n else\r\n {\r\n streamOutput = tcpConn.GetStream();\r\n streamOutput.Write(Encoding.UTF8.GetBytes(\"Welcome, user.\"), 0, \"Welcome, user.\".Length);\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Could not connect to port \" + port.ToString());\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (streamOutput != null)\r\n {\r\n streamOutput.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n try\r\n {\r\n if (tcpConn != null)\r\n {\r\n tcpConn.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n try\r\n {\r\n if (listener != null)\r\n {\r\n listener.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n TcpListener listener = null;\r\n TcpClient tcpConn = null;\r\n Stream streamOutput = null;\r\n int port = 20000;\r\n try\r\n {\r\n listener = new TcpListener(IPAddress.Parse(\"10.10.1.10\"), port);\r\n listener.Start();\r\n tcpConn = listener.AcceptTcpClient();\r\n streamOutput = tcpConn.GetStream();\r\n IPEndPoint endPoint = (IPEndPoint)tcpConn.Client.RemoteEndPoint;\r\n IPAddress ipAddress = endPoint.Address;\r\n IPHostEntry hostEntry = Dns.GetHostEntry(ipAddress);\r\n /* FIX: No host-based Logic */\r\n streamOutput.Write(Encoding.UTF8.GetBytes((\"Welcome, \" + hostEntry.ToString())), 0, (\"Welcome, \" + hostEntry.ToString()).Length);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Could not connect to port \" + port.ToString());\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (streamOutput != null)\r\n {\r\n streamOutput.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n try\r\n {\r\n if (tcpConn != null)\r\n {\r\n tcpConn.Close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n try\r\n {\r\n if (listener != null)\r\n {\r\n listener.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing objects\");\r\n }\r\n\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-510 (Trapdoor). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-510\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-510\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE510_Trapdoor/CWE510_Trapdoor__hostname_based_logic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"fae82f1f08bbf62755cf287a01ab4047ffce0701c495516991b8d6b7a490556d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-510\", \"target_weakness\": \"Trapdoor\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-523-dd16929a0ba0", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE523_Unprotected_Cred_Transport__Web_01.cs\r\nLabel Definition File: CWE523_Unprotected_Cred_Transport__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 523 Unprotected Transport of Credentials\r\n* Sinks: non_ssl\r\n* GoodSink: Send across SSL connection\r\n* BadSink : Send across non-SSL connection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE523_Unprotected_Cred_Transport\r\n{\r\nclass CWE523_Unprotected_Cred_Transport__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n try\r\n {\r\n /* FLAW: transmitting login credentials across a non-SSL connection */\r\n resp.Write(\"
\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"There was a problem writing\", exceptIO);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n try\r\n {\r\n /* FIX: ensure the connection is secure (https) */\r\n resp.Write(\"\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"There was a problem writing\", exceptIO);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-523 (Unprotected Cred Transport). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-523\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-523\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE523_Unprotected_Cred_Transport/CWE523_Unprotected_Cred_Transport__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"dd16929a0ba0cd71d1ad93f159f96ed249ded4c1b831fc2e53a3d346bf80e432\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-523\", \"target_weakness\": \"Unprotected Cred Transport\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-526-56f512569e8a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE526_Info_Exposure_Environment_Variables__writeLine_01.cs\r\nLabel Definition File: CWE526_Info_Exposure_Environment_Variables.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 526 Information Exposure Through Environment Variables\r\n* Sinks: writeLine\r\n* GoodSink: no exposing\r\n* BadSink : expose the path variable to the user\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE526_Info_Exposure_Environment_Variables\r\n{\r\nclass CWE526_Info_Exposure_Environment_Variables__writeLine_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: environment variable information exposed */\r\n IO.WriteLine(\"Not in path: \" + Environment.GetEnvironmentVariable(\"PATH\"));\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: error message is general */\r\n IO.WriteLine(\"Not in path\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-526 (Info Exposure Environment Variables). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-526\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-526\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE526_Info_Exposure_Environment_Variables/CWE526_Info_Exposure_Environment_Variables__writeLine_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"56f512569e8a135ab0acbdfb08a9b200ce15212e3c72d3cd8a37af504546ee05\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-526\", \"target_weakness\": \"Info Exposure Environment Variables\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-532-6b9809383c81", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE532_Inclusion_of_Sensitive_Info_in_Log__Database_01.cs\r\nLabel Definition File: CWE532_Inclusion_of_Sensitive_Info_in_Log__Database.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 534 Inclusion of Sensitive Information in Log Files\r\n* Sinks:\r\n* GoodSink: log non-sensitive information to the debug log\r\n* BadSink : Expose the DB connection string (containing user ID and password) to debug log\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing NLog;\r\nusing System.Data.SqlClient;\r\n\r\nnamespace testcases.CWE532_Inclusion_of_Sensitive_Info_in_Log\r\n{\r\nclass CWE532_Inclusion_of_Sensitive_Info_in_Log__Database_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n Logger logger = LogManager.GetLogger(\"cwe_testcases_logger\");\r\n string dbConnectionString = @\"Data Source=(local);Initial Catalog=CWE256;User ID=sa;Password=P@ssW0rd\";\r\n try\r\n {\r\n using (SqlConnection dBConnection = new SqlConnection(dbConnectionString))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n /* FLAW: Expose the DB connection string (containing user ID and password) to debug log */\r\n logger.Log(LogLevel.Warn, \"Error getting database connection: \" + dbConnectionString, exceptSql);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n Logger logger = LogManager.GetLogger(\"cwe_testcases_logger\");\r\n string dbConnectionString = @\"Data Source=(local);Initial Catalog=CWE256;User ID=sa;Password=P@ssW0rd\";\r\n try\r\n {\r\n using (SqlConnection dBConnection = new SqlConnection(dbConnectionString))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n /* FIX: Log non-sensitive information to the debug log */\r\n logger.Log(LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-532 (Inclusion of Sensitive Info in Log). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-532\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-532\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE532_Inclusion_of_Sensitive_Info_in_Log/CWE532_Inclusion_of_Sensitive_Info_in_Log__Database_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"6b9809383c81a84aa575c5ff1e7c132c73c42465093604eb8fadd26a37b55269\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-532\", \"target_weakness\": \"Inclusion of Sensitive Info in Log\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-535-3285dc09c8a8", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE535_Info_Exposure_Shell_Error__Database_01.cs\r\nLabel Definition File: CWE535_Info_Exposure_Shell_Error__Database.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 535 Information Exposure through Shell Error\r\n* Sinks:\r\n* GoodSink: write non-sensitive information to Console.WriteLine\r\n* BadSink : Expose the DB connection string to Console.WriteLine\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\n\r\nnamespace testcases.CWE535_Info_Exposure_Shell_Error\r\n{\r\nclass CWE535_Info_Exposure_Shell_Error__Database_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string dbConnectionString = @\"Data Source=(local);Initial Catalog=CWE256;User ID=sa;Password=P@ssW0rd\";\r\n try\r\n {\r\n using (SqlConnection dBConnection = new SqlConnection(dbConnectionString))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n /* FLAW: Expose the DB connection string (containing user ID and password) to Console */\r\n Console.WriteLine(\"Error getting database connection: \" + dbConnectionString);\r\n Console.WriteLine(exceptSql);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n string dbConnectionString = @\"Data Source=(local);Initial Catalog=CWE256;User ID=sa;Password=P@ssW0rd\";\r\n try\r\n {\r\n using (SqlConnection dBConnection = new SqlConnection(dbConnectionString))\r\n {\r\n dBConnection.Open();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n /* FIX: Message written to Console does not contain the DB connection string */\r\n Console.WriteLine(exceptSql);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-535 (Info Exposure Shell Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-535\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-535\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE535_Info_Exposure_Shell_Error/CWE535_Info_Exposure_Shell_Error__Database_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3285dc09c8a8e7ce586006f25ab9490856dd007e9da88eefc04bf356df942f78\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-535\", \"target_weakness\": \"Info Exposure Shell Error\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-546-6cf0b37575c7", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE546_Suspicious_Comment__BUG_01.cs\r\nLabel Definition File: CWE546_Suspicious_Comment.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 546 Suspicious Comment\r\n* Sinks: BUG\r\n* GoodSink: does not contain suspicious comment\r\n* BadSink : contains suspicious comment\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE546_Suspicious_Comment\r\n{\r\nclass CWE546_Suspicious_Comment__BUG_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: This is the suspicious comment */\r\n /* BUG: There is a bug at this location...I'm not sure why! */\r\n IO.WriteLine(\"This a test of the emergency broadcast system\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n /* FIX: don't have those types of comments :) */\r\n IO.WriteLine(\"This a test of the emergency broadcast system\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-546 (Suspicious Comment). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-546\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-546\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE546_Suspicious_Comment/CWE546_Suspicious_Comment__BUG_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"6cf0b37575c754437622e95141c39eb779ba8850deacc763e42de783d2449f89\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-546\", \"target_weakness\": \"Suspicious Comment\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-549-1286ccd7f965", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE549_Missing_Password_Masking__Web_01.cs\r\nLabel Definition File: CWE549_Missing_Password_Masking__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 549 Passwords should be masked during entry to prevent others from stealing them\r\n* Sinks:\r\n* GoodSink: password field masked\r\n* BadSink : password field unmasked\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE549_Missing_Password_Masking\r\n{\r\nclass CWE549_Missing_Password_Masking__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Write(\"\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Write(\"\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-549 (Missing Password Masking). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-549\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-549\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE549_Missing_Password_Masking/CWE549_Missing_Password_Masking__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1286ccd7f965f265a2654d3778d105e1fbf67745858a596b63232bd36b9be577\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-549\", \"target_weakness\": \"Missing Password Masking\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-563-9c28543eb862", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE563_Assign_to_Variable_Without_Use__unused_init_variable_StringBuilder_01.cs\r\nLabel Definition File: CWE563_Assign_to_Variable_Without_Use__unused_init_variable.label.xml\r\nTemplate File: source-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 563 Assignment to Variable without Use\r\n* BadSource: Initialize data\r\n* Sinks:\r\n* GoodSink: Use data\r\n* BadSink : do nothing\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Text;\r\n\r\n\r\nnamespace testcases.CWE563_Assign_to_Variable_Without_Use\r\n{\r\nclass CWE563_Assign_to_Variable_Without_Use__unused_init_variable_StringBuilder_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* use badsource and badsink */\r\n public override void Bad()\r\n {\r\n StringBuilder data;\r\n /* POTENTIAL FLAW: Initialize, but do not use data */\r\n data = new StringBuilder(\"Good\");\r\n /* FLAW: Do not use the variable */\r\n /* do nothing */\r\n ; /* empty statement needed for some flow variants */\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodB2G();\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n StringBuilder data;\r\n /* POTENTIAL FLAW: Initialize, but do not use data */\r\n data = new StringBuilder(\"Good\");\r\n /* FIX: Use data */\r\n IO.WriteLine(data.ToString());\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-563 (Assign to Variable Without Use). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-563\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-563\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE563_Assign_to_Variable_Without_Use/CWE563_Assign_to_Variable_Without_Use__unused_init_variable_StringBuilder_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9c28543eb8625bcf394dccb549ea61917e1cc9279cf09d9fbfa63b5d021ed23c\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-563\", \"target_weakness\": \"Assign to Variable Without Use\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-566-d3e28dd7a5d4", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE566_Authorization_Bypass_Through_SQL_Primary__Web_01.cs\r\nLabel Definition File: CWE566_Authorization_Bypass_Through_SQL_Primary__Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 566 Authorization Bypass through SQL primary\r\n* BadSource: user id taken from url parameter\r\n* GoodSource: hardcoded user id\r\n* BadSink: writeConsole user authorization not checked\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\nusing System.Data;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE566_Authorization_Bypass_Through_SQL_Primary\r\n{\r\n\r\nclass CWE566_Authorization_Bypass_Through_SQL_Primary__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FLAW: Get the user ID from a URL parameter */\r\n data = req.Params.Get(\"id\");\r\n SqlConnection dBConnection = IO.GetDBConnection();\r\n SqlCommand preparedStatement = null;\r\n int id = 0;\r\n try\r\n {\r\n id = int.Parse(data);\r\n }\r\n catch (FormatException nfx)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, nfx, \"Could not parse int, setting to -1\");\r\n id = -1; /* Assuming this id does not exist */\r\n }\r\n try\r\n {\r\n dBConnection.Open();\r\n using (preparedStatement = new SqlCommand(null, dBConnection))\r\n {\r\n preparedStatement.CommandText = \"select * from invoices where uid=@id\";\r\n SqlParameter idParam = new SqlParameter(\"@id\", SqlDbType.Int, 0);\r\n idParam.Value = id;\r\n preparedStatement.ExecuteNonQuery();\r\n }\r\n /* POTENTIAL FLAW: no check to see whether the user has privileges to view the data */\r\n IO.WriteString(\"Bad() - result requested: \" + data + \"\\n\");\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error executing query\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.Close();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Could not close Connection\");\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded user ID */\r\n data = \"10\";\r\n SqlConnection dBConnection = IO.GetDBConnection();\r\n SqlCommand preparedStatement = null;\r\n int id = 0;\r\n try\r\n {\r\n id = int.Parse(data);\r\n }\r\n catch (FormatException nfx)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, nfx, \"Could not parse int, setting to -1\");\r\n id = -1; /* Assuming this id does not exist */\r\n }\r\n try\r\n {\r\n dBConnection.Open();\r\n using (preparedStatement = new SqlCommand(null, dBConnection))\r\n {\r\n preparedStatement.CommandText = \"select * from invoices where uid=@id\";\r\n SqlParameter idParam = new SqlParameter(\"@id\", SqlDbType.Int, 0);\r\n idParam.Value = id;\r\n preparedStatement.ExecuteNonQuery();\r\n }\r\n /* POTENTIAL FLAW: no check to see whether the user has privileges to view the data */\r\n IO.WriteString(\"Bad() - result requested: \" + data + \"\\n\");\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Error executing query\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.Close();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptSql, \"Could not close Connection\");\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-566 (Authorization Bypass Through SQL Primary). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-566\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-566\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE566_Authorization_Bypass_Through_SQL_Primary/CWE566_Authorization_Bypass_Through_SQL_Primary__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"d3e28dd7a5d440d055468df125121719ae0b2fc252cf080c038608ecfc8ec607\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-566\", \"target_weakness\": \"Authorization Bypass Through SQL Primary\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-570-887fb5281cf3", "input": "/*\r\n * @description statement always evaluates to false\r\n * \r\n * */\r\n\r\nusing System;\r\nusing TestCaseSupport;\r\nusing System.Security.Cryptography;\r\nusing System.Collections;\r\n\r\nnamespace testcases.CWE570_Expression_Always_False\r\n{\r\n class CWE570_Expression_Always_False__class_getClass_equal_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: always evaluates to false */\r\n Random random = new Random();\r\n RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();\r\n\r\n if (random.GetType() == rngCsp.GetType())\r\n {\r\n IO.WriteLine(\"never prints\");\r\n }\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n ArrayList objectArray = new ArrayList();\r\n objectArray.Add(new Random());\r\n objectArray.Add(new RNGCryptoServiceProvider());\r\n objectArray.Add(new RNGCryptoServiceProvider());\r\n\r\n int intSecureRandom = (new Random()).Next(3);\r\n\r\n /* FIX: may evaluate to true or false */\r\n if (objectArray[1].GetType() == objectArray[intSecureRandom].GetType())\r\n {\r\n IO.WriteLine(\"sometimes prints\");\r\n }\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-570 (Expression Always False). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-570\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-570\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE570_Expression_Always_False/CWE570_Expression_Always_False__class_getClass_equal_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"887fb5281cf3b321dd189f0bc99344ded6f494799ee7138f7bf39722668de08d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-570\", \"target_weakness\": \"Expression Always False\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-571-dcbdbdbd354d", "input": "/*\r\n * @description statement always evaluates to true\r\n * \r\n * */\r\n\r\nusing System;\r\nusing TestCaseSupport;\r\nusing System.Security.Cryptography;\r\nusing System.Collections;\r\n\r\nnamespace testcases.CWE571_Expression_Always_True\r\n{\r\n class CWE571_Expression_Always_True__class_getClass_equal_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n /* FLAW: always evaluates to true */\r\n Random random = new Random();\r\n RNGCryptoServiceProvider rngCsp = new RNGCryptoServiceProvider();\r\n\r\n if (!(random.GetType() == rngCsp.GetType()))\r\n {\r\n IO.WriteLine(\"always prints\");\r\n }\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n ArrayList objectArray = new ArrayList();\r\n objectArray.Add(new Random());\r\n objectArray.Add(new RNGCryptoServiceProvider());\r\n objectArray.Add(new RNGCryptoServiceProvider());\r\n\r\n int intSecureRandom = (new Random()).Next(3);\r\n\r\n /* FIX: may evaluate to true or false */\r\n if (objectArray[1].GetType() == objectArray[intSecureRandom].GetType())\r\n {\r\n IO.WriteLine(\"sometimes prints\");\r\n }\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-571 (Expression Always True). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-571\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-571\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE571_Expression_Always_True/CWE571_Expression_Always_True__class_getClass_equal_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"dcbdbdbd354d6ba4fbdc3446d135e42c534bfa4c7348de130c58e04b7cff2010\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-571\", \"target_weakness\": \"Expression Always True\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-598-898338bb6efa", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE598_Information_Exposure_QueryString__Web_01.cs\r\nLabel Definition File: CWE598_Information_Exposure_QueryString__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 598 Information Exposure Through Query Strings in GET Request\r\n* Sinks:\r\n* GoodSink: post password field\r\n* BadSink : get password field\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE598_Information_Exposure_QueryString\r\n{\r\nclass CWE598_Information_Exposure_QueryString__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Write(\"\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Write(\"\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-598 (Information Exposure QueryString). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-598\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-598\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE598_Information_Exposure_QueryString/CWE598_Information_Exposure_QueryString__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"898338bb6efaf4e4e7cd922105889df7096458539723c6db586471c1f0d3fc5a\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-598\", \"target_weakness\": \"Information Exposure QueryString\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-601-94b9803319e9", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE601_Open_Redirect__Web_Connect_tcp_01.cs\r\nLabel Definition File: CWE601_Open_Redirect__Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 601 Open Redirect\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: place redirect string directly into redirect api call\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE601_Open_Redirect\r\n{\r\n\r\nclass CWE601_Open_Redirect__Web_Connect_tcp_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n /* This prevents \\r\\n (and other chars) and should prevent incidentals such\r\n * as HTTP Response Splitting and HTTP Header Injection.\r\n */\r\n Uri uri;\r\n try\r\n {\r\n uri = new Uri(data);\r\n }\r\n catch (UriFormatException exceptURISyntax)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptURISyntax, \"Invalid redirect URL\");\r\n resp.Write(\"Invalid redirect URL\");\r\n return;\r\n }\r\n /* POTENTIAL FLAW: redirect is sent verbatim; escape the string to prevent ancillary issues like XSS, Response splitting etc */\r\n resp.Redirect(data);\r\n return;\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n if (data != null)\r\n {\r\n /* This prevents \\r\\n (and other chars) and should prevent incidentals such\r\n * as HTTP Response Splitting and HTTP Header Injection.\r\n */\r\n Uri uri;\r\n try\r\n {\r\n uri = new Uri(data);\r\n }\r\n catch (UriFormatException exceptURISyntax)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptURISyntax, \"Invalid redirect URL\");\r\n resp.Write(\"Invalid redirect URL\");\r\n return;\r\n }\r\n /* POTENTIAL FLAW: redirect is sent verbatim; escape the string to prevent ancillary issues like XSS, Response splitting etc */\r\n resp.Redirect(data);\r\n return;\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-601 (Open Redirect). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-601\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-601\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE601_Open_Redirect/CWE601_Open_Redirect__Web_Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"94b9803319e91f74af14dfb77b1295626198f24310c925e504d443e9e5d0db2d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-601\", \"target_weakness\": \"Open Redirect\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-605-8df584a84261", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE605_Multiple_Binds_Same_Port__basic_01.cs\r\nLabel Definition File: CWE605_Multiple_Binds_Same_Port__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 605 Multiple binds to the same port\r\n* Sinks:\r\n* GoodSink: two binds on different ports\r\n* BadSink : two binds on one port\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\nusing System.Net;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE605_Multiple_Binds_Same_Port\r\n{\r\nclass CWE605_Multiple_Binds_Same_Port__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n TcpListener socket1 = null;\r\n TcpListener socket2 = null;\r\n try\r\n {\r\n socket1 = new TcpListener(IPAddress.Parse(\"10.10.1.10\"), 15000);\r\n /* FLAW: This will bind a second Socket to port 15000, but only for connections from localhost */\r\n IPAddress localAddr = IPAddress.Parse(\"127.0.0.1\");\r\n socket2 = new TcpListener(localAddr, 15000);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Unable to bind a socket\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (socket2 != null)\r\n {\r\n socket2.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing Socket\");\r\n }\r\n\r\n try\r\n {\r\n if (socket1 != null)\r\n {\r\n socket1.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing Socket\");\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n TcpListener socket1 = null;\r\n TcpListener socket2 = null;\r\n try\r\n {\r\n socket1 = new TcpListener(IPAddress.Parse(\"10.10.1.10\"), 15000);\r\n /* FIX: This will bind the second Socket to a different port */\r\n IPAddress localAddr = IPAddress.Parse(\"127.0.0.1\");\r\n socket2 = new TcpListener(localAddr, 15001);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Unable to bind a socket\");\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (socket2 != null)\r\n {\r\n socket2.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing Socket\");\r\n }\r\n\r\n try\r\n {\r\n if (socket1 != null)\r\n {\r\n socket1.Stop();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error closing Socket\");\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-605 (Multiple Binds Same Port). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-605\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-605\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE605_Multiple_Binds_Same_Port/CWE605_Multiple_Binds_Same_Port__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8df584a8426134fd6da6bfeedea3eb04b0afe723807384e71fc4847c3f266e16\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-605\", \"target_weakness\": \"Multiple Binds Same Port\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-609-1dd7aacf6977", "input": "/*\r\n * @description Use of \"Double Checked Locking\" which can fail in certain circumstances. \r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.Threading.Tasks;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE609_Double_Checked_Locking\r\n{\r\n class CWE609_Double_Checked_Locking__Thread_01 : AbstractTestCase\r\n {\r\n /* Bad() - Use of Double Checked Locking */\r\n private static string stringBad = null;\r\n private static readonly object badLock = new object();\r\n#if (!OMITBAD)\r\n public static string helperBad()\r\n {\r\n if (stringBad == null)\r\n {\r\n lock (badLock)\r\n {\r\n if (stringBad == null)\r\n {\r\n stringBad = \"stringBad\";\r\n }\r\n }\r\n }\r\n return stringBad;\r\n }\r\n\r\n /* FLAW: Insufficient \"Double-Checked Locking\" in this method - in certain circumstances, this can lead to stringBad being initialized twice. */\r\n public override void Bad()\r\n {\r\n var task1 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperBad());\r\n });\r\n\r\n var task2 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperBad());\r\n });\r\n }\r\n#endif // OMITBAD\r\n private volatile static string stringGood1 = null; /* FIX: Added \"volatile\" here */\r\n private static readonly object goodLock = new object();\r\n#if (!OMITGOOD)\r\n public static string helperGood1()\r\n {\r\n if (stringGood1 == null)\r\n {\r\n lock (goodLock)\r\n {\r\n if (stringGood1 == null)\r\n {\r\n stringGood1 = \"stringGood1\";\r\n }\r\n }\r\n }\r\n return stringGood1;\r\n }\r\n\r\n public void Good1()\r\n {\r\n var task1 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperGood1());\r\n });\r\n\r\n var task2 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperGood1());\r\n });\r\n }\r\n\r\n private static string stringGood2 = null;\r\n\r\n public static string helperGood2() /* FIX: method avoids double checking */\r\n {\r\n if (stringGood2 == null)\r\n {\r\n stringGood2 = \"stringGood2\";\r\n }\r\n return stringGood2;\r\n }\r\n\r\n public void good2()\r\n {\r\n var task1 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperGood2());\r\n });\r\n\r\n var task2 = Task.Run(() =>\r\n {\r\n IO.WriteLine(helperGood2());\r\n });\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n good2();\r\n }\r\n#endif // OMITGOOD\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-609 (Double Checked Locking). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-609\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-609\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE609_Double_Checked_Locking/CWE609_Double_Checked_Locking__Thread_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1dd7aacf6977571e60ad95f6bf76d683b05b42748471142c02860e3f8d4110d3\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-609\", \"target_weakness\": \"Double Checked Locking\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-613-8dafb293f5d1", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE613_Insufficient_Session_Expiration__Web_01.cs\r\nLabel Definition File: CWE613_Insufficient_Session_Expiration__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 613 Insufficient Session Expiration\r\n* Sinks:\r\n* GoodSink: force session to expire\r\n* BadSink : set session to never expire\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\nusing System.Web.SessionState;\r\n\r\nnamespace testcases.CWE613_Insufficient_Session_Expiration\r\n{\r\nclass CWE613_Insufficient_Session_Expiration__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n HttpContext ctx = HttpContext.Current;\r\n HttpSessionState session = ctx.Session;\r\n /* FLAW: A negative time indicates the session should never expire */\r\n session.Timeout = -1;\r\n resp.Write(\"Bad(): Session still valid\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n HttpContext ctx = HttpContext.Current;\r\n HttpSessionState session = ctx.Session;\r\n /* FIX: enforce an absolute session timeout of 60 seconds */\r\n session.Timeout = 1;\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-613 (Insufficient Session Expiration). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-613\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-613\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE613_Insufficient_Session_Expiration/CWE613_Insufficient_Session_Expiration__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8dafb293f5d175a676721e2c66496bcdaaaff1001b8e994285b29d5db08bb3d6\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-613\", \"target_weakness\": \"Insufficient Session Expiration\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-614-25395124ceac", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE614_Sensitive_Cookie_Without_Secure__Web_01.cs\r\nLabel Definition File: CWE614_Sensitive_Cookie_Without_Secure__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 614 Sensitive Cookie Without Secure\r\n* Sinks:\r\n* GoodSink: secure flag set\r\n* BadSink : secure flag not set\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE614_Sensitive_Cookie_Without_Secure\r\n{\r\nclass CWE614_Sensitive_Cookie_Without_Secure__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n HttpCookie cookie = new HttpCookie(\"SecretMessage\", \"test\");\r\n if (req.IsSecureConnection)\r\n {\r\n /* FLAW: secure flag not set */\r\n resp.Cookies.Add(cookie);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n HttpCookie cookie = new HttpCookie(\"SecretMessage\", \"Drink your Ovaltine\");\r\n if (req.IsSecureConnection)\r\n {\r\n /* FIX: adds \"secure\" flag/attribute to cookie */\r\n cookie.Secure = true;\r\n resp.Cookies.Add(cookie);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-614 (Sensitive Cookie Without Secure). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-614\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-614\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE614_Sensitive_Cookie_Without_Secure/CWE614_Sensitive_Cookie_Without_Secure__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"25395124ceac1ce69353215bf6e615a4b97428e17dbe4cdc5844179f6ee8aa72\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-614\", \"target_weakness\": \"Sensitive Cookie Without Secure\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-615-0787b65b6331", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE615_Info_Exposure_by_Comment__Web_01.cs\r\nLabel Definition File: CWE615_Info_Exposure_by_Comment__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 615 Information Exposure by Comment\r\n* Sinks:\r\n* GoodSink: no disclosure of username and password\r\n* BadSink : disclose username and password\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE615_Info_Exposure_by_Comment\r\n{\r\nclass CWE615_Info_Exposure_by_Comment__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n /* FLAW: sensitive information exposed in client-side code comments */\r\n resp.Write(\"\" +\r\n \"\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n /* FIX: no info exposure in client-side code comments */\r\n resp.Write(\"\");\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-615 (Info Exposure by Comment). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-615\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-615\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE615_Info_Exposure_by_Comment/CWE615_Info_Exposure_by_Comment__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0787b65b6331621065d10332c8167939c323c888588577fd1085c58626aad714\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-615\", \"target_weakness\": \"Info Exposure by Comment\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-643-e69953a8c155", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE643_Xpath_Injection__Connect_tcp_01.cs\r\nLabel Definition File: CWE643_Xpath_Injection.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 643 Xpath Injection\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks:\r\n* GoodSink: validate input through SecurityElement.Escape\r\n* BadSink : user input is used without validate\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Runtime.InteropServices;\r\nusing System.Xml.XPath;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE643_Xpath_Injection\r\n{\r\nclass CWE643_Xpath_Injection__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n string xmlFile = null;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\r\n {\r\n /* running on Windows */\r\n xmlFile = \"..\\\\..\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"../../CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n string[] tokens = data.Split(\"||\".ToCharArray());\r\n if (tokens.Length < 2)\r\n {\r\n return;\r\n }\r\n string username = tokens[0];\r\n string password = tokens[1];\r\n /* build xpath */\r\n XPathDocument inputXml = new XPathDocument(xmlFile);\r\n XPathNavigator xPath = inputXml.CreateNavigator();\r\n /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize\r\n * The user input should be canonicalized before validation. */\r\n /* POTENTIAL FLAW: user input is used without validate */\r\n string query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n string secret = (string)xPath.Evaluate(query);\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n string xmlFile = null;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\r\n {\r\n /* running on Windows */\r\n xmlFile = \"..\\\\..\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"../../CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n string[] tokens = data.Split(\"||\".ToCharArray());\r\n if (tokens.Length < 2)\r\n {\r\n return;\r\n }\r\n string username = tokens[0];\r\n string password = tokens[1];\r\n /* build xpath */\r\n XPathDocument inputXml = new XPathDocument(xmlFile);\r\n XPathNavigator xPath = inputXml.CreateNavigator();\r\n /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize\r\n * The user input should be canonicalized before validation. */\r\n /* POTENTIAL FLAW: user input is used without validate */\r\n string query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n string secret = (string)xPath.Evaluate(query);\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n string xmlFile = null;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\r\n {\r\n /* running on Windows */\r\n xmlFile = \"..\\\\..\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"../../CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n string[] tokens = data.Split(\"||\".ToCharArray());\r\n if (tokens.Length < 2)\r\n {\r\n return;\r\n }\r\n /* FIX: validate input using StringEscapeUtils */\r\n string username = System.Security.SecurityElement.Escape(tokens[0]);\r\n string password = System.Security.SecurityElement.Escape(tokens[1]);\r\n /* build xpath */\r\n XPathDocument inputXml = new XPathDocument(xmlFile);\r\n XPathNavigator xPath = inputXml.CreateNavigator();\r\n string query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n string secret = (string)xPath.Evaluate(query);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-643 (Xpath Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-643\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-643\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE643_Xpath_Injection/CWE643_Xpath_Injection__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e69953a8c15577416c1a95dcaa0978e469a88610aed0bf34e263ed8e064a878b\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-643\", \"target_weakness\": \"Xpath Injection\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-674-3225921b7c52", "input": "/*\r\n * @description Recursion not limited to a managed level\r\n *\r\n * */\r\n\r\nusing System;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE674_Uncontrolled_Recursion\r\n{\r\n class CWE674_Uncontrolled_Recursion__long_01 : AbstractTestCase\r\n {\r\n private static readonly long RECURSION_LONG_MAX = 10;\r\n\r\n#if (!OMITBAD)\r\n private static void helperBad(long level)\r\n {\r\n /* FLAW: Although this cannot cause \"infinite\" recursion, it is essentially limited to Long.MaxValue\r\n * which is rather large */\r\n if (level == 0)\r\n {\r\n return;\r\n }\r\n\r\n helperBad(level - 1);\r\n }\r\n\r\n public override void Bad()\r\n {\r\n long longMax = long.MaxValue;\r\n\r\n helperBad(longMax);\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n private static void helperGood1(long level)\r\n {\r\n /* FIX: limit recursion to a sane level */\r\n if (level > RECURSION_LONG_MAX)\r\n {\r\n IO.WriteLine(\"ERROR IN RECURSION\");\r\n return;\r\n }\r\n\r\n if (level == 0)\r\n {\r\n return;\r\n }\r\n \r\n helperGood1(level - 1);\r\n }\r\n\r\n private void Good1()\r\n {\r\n long longMax = long.MaxValue;\r\n\r\n helperGood1(longMax);\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-674 (Uncontrolled Recursion). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-674\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-674\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE674_Uncontrolled_Recursion/CWE674_Uncontrolled_Recursion__long_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3225921b7c52989b788006d0f89252edcae19944b73044ba95d01f1221e96c90\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-674\", \"target_weakness\": \"Uncontrolled Recursion\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-675-663fedce2344", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE675_Duplicate_Operations_on_Resource__OpenText_01.cs\r\nLabel Definition File: CWE675_Duplicate_Operations_on_Resource.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 675 Duplicate Operations on Resource\r\n* BadSource: OpenText Open and close a file using OpenText and Close()\r\n* GoodSource: Open a file using OpenText()\r\n* Sinks:\r\n* GoodSink: Do nothing\r\n* BadSink : Close the StreamReader\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE675_Duplicate_Operations_on_Resource\r\n{\r\nclass CWE675_Duplicate_Operations_on_Resource__OpenText_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n StreamReader data;\r\n data = File.OpenText(@\"BadSource_OpenText.txt\");\r\n /* POTENTIAL FLAW: Close the file in the source */\r\n data.Close();\r\n /* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */\r\n data.Close();\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n StreamReader data;\r\n /* FIX: Open, but do not close the file in the source */\r\n data = File.OpenText(@\"GoodSource_OpenText.txt\");\r\n /* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */\r\n data.Close();\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n StreamReader data;\r\n data = File.OpenText(@\"BadSource_OpenText.txt\");\r\n /* POTENTIAL FLAW: Close the file in the source */\r\n data.Close();\r\n /* Do nothing */\r\n /* FIX: Don't close the file in the sink */\r\n ; /* empty statement needed for some flow variants */\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-675 (Duplicate Operations on Resource). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-675\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-675\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE675_Duplicate_Operations_on_Resource/CWE675_Duplicate_Operations_on_Resource__OpenText_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"663fedce2344e8f1e8f8b668f27f2c820dc3732225320a4a45a127aac3f9d9fd\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-675\", \"target_weakness\": \"Duplicate Operations on Resource\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-681-feac5aa38fa2", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01.cs\r\nLabel Definition File: CWE681_Incorrect_Conversion_Between_Numeric_Types.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 681 Incorrect Conversion Between Numeric Types\r\n* Sinks: double2float\r\n* GoodSink: check for conversion error\r\n* BadSink : explicit cast\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.IO;\r\n\r\nnamespace testcases.CWE681_Incorrect_Conversion_Between_Numeric_Types\r\n{\r\nclass CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n try\r\n {\r\n /* Enter: 1e50, result should be infinity (for bad case)\r\n *\r\n */\r\n double doubleNumber = 0;\r\n IO.WriteString(\"Enter double number (1e50): \");\r\n try\r\n {\r\n doubleNumber = Double.Parse(Console.ReadLine());\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.WriteLine(\"Error parsing number\");\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Error parsing number\");\r\n }\r\n /* FLAW: should not cast without checking if conversion is safe */\r\n IO.WriteLine(\"\" + (float)doubleNumber);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with console reading\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n try\r\n {\r\n double num = 0;\r\n IO.WriteString(\"Enter double number (1e50): \");\r\n try\r\n {\r\n num = Double.Parse(Console.ReadLine());\r\n }\r\n catch (FormatException exceptNumberFormat)\r\n {\r\n IO.WriteLine(\"Error parsing number\");\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Error parsing number\");\r\n }\r\n /* FIX: check for conversion error */\r\n if (num > float.MaxValue || num < float.MinValue)\r\n {\r\n IO.WriteLine(\"Error, cannot safely cast this number to a float!\");\r\n return;\r\n }\r\n IO.WriteLine(\"\" + (float)num);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with console reading\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-681 (Incorrect Conversion Between Numeric Types). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-681\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-681\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE681_Incorrect_Conversion_Between_Numeric_Types/CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"feac5aa38fa238780e9d6f8b2d83b14ac3be09dafe0014d51f4a624710084a1e\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-681\", \"target_weakness\": \"Incorrect Conversion Between Numeric Types\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-690-3d0d3e3af2a9", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE690_NULL_Deref_From_Return__Class_StringBuilder_01.cs\r\nLabel Definition File: CWE690_NULL_Deref_From_Return__Class.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 690 Unchecked return value is null, leading to a null pointer dereference.\r\n* BadSource: Use a custom method which may return null\r\n* GoodSource: Use a custom method that never returns null\r\n* Sinks: trim\r\n* GoodSink: Check data for null before calling trim()\r\n* BadSink : Call trim() on possibly null object\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Text;\r\n\r\nnamespace testcases.CWE690_NULL_Deref_From_Return\r\n{\r\nclass CWE690_NULL_Deref_From_Return__Class_StringBuilder_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n StringBuilder data;\r\n /* POTENTIAL FLAW: Call getStringBuilderBad(), which may return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderBad();\r\n /* POTENTIAL FLAW: data could be null */\r\n string stringTrimmed = data.ToString().Trim();\r\n IO.WriteLine(stringTrimmed);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n GoodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n StringBuilder data;\r\n /* FIX: call getStringBuilderGood(), which will never return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderGood();\r\n /* POTENTIAL FLAW: data could be null */\r\n string stringTrimmed = data.ToString().Trim();\r\n IO.WriteLine(stringTrimmed);\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n StringBuilder data;\r\n /* POTENTIAL FLAW: Call getStringBuilderBad(), which may return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderBad();\r\n /* FIX: explicit check for null */\r\n if (data != null)\r\n {\r\n string stringTrimmed = data.ToString().Trim();\r\n IO.WriteLine(stringTrimmed);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-690 (NULL Deref From Return). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-690\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-690\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE690_NULL_Deref_From_Return/CWE690_NULL_Deref_From_Return__Class_StringBuilder_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3d0d3e3af2a9e421cac6017a9a488d299f13989369186767e11b94a9de163727\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-690\", \"target_weakness\": \"NULL Deref From Return\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-698-7b9197ad175f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE698_Execution_After_Redirect__Web_01.cs\r\nLabel Definition File: CWE698_Execution_After_Redirect__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 698 Execution After Redirect (EAR)\r\n* Sinks:\r\n* GoodSink: return after redirect\r\n* BadSink : perform actions after redirect\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nnamespace testcases.CWE698_Execution_After_Redirect\r\n{\r\nclass CWE698_Execution_After_Redirect__Web_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Redirect(\"/test\");\r\n /* FLAW: code after the redirect is undefined */\r\n IO.WriteLine(\"doing some more things here after the redirect\");\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n Good1(req, resp);\r\n }\r\n\r\n private void Good1(HttpRequest req, HttpResponse resp)\r\n {\r\n resp.Redirect(\"/test\");\r\n /* FIX: no code after the redirect */\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-698 (Execution After Redirect). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-698\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-698\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE698_Execution_After_Redirect/CWE698_Execution_After_Redirect__Web_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7b9197ad175f5788724d46551f471bd4ac5d196210dd1769d6645e38a779c3c1\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-698\", \"target_weakness\": \"Execution After Redirect\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-759-cdf54ede6435", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE759_Unsalted_One_Way_Hash__basic_01.cs\r\nLabel Definition File: CWE759_Unsalted_One_Way_Hash__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 759 Use of one-way hash with no salt\r\n* Sinks:\r\n* GoodSink: use a sufficiently random salt\r\n* BadSink : SHA512 with no salt\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Text;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE759_Unsalted_One_Way_Hash\r\n{\r\nclass CWE759_Unsalted_One_Way_Hash__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n using (HashAlgorithm sha = new SHA512CryptoServiceProvider())\r\n {\r\n /* FLAW: SHA512 with no salt */\r\n byte[] textWithoutSaltBytes = Encoding.UTF8.GetBytes(\"hash me\");\r\n byte[] hashedBytes = sha.ComputeHash(textWithoutSaltBytes);\r\n sha.Clear();\r\n IO.WriteLine(IO.ToHex(hashedBytes));\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n using (HashAlgorithm sha = new SHA512CryptoServiceProvider())\r\n {\r\n /* FIX: Use a sufficiently random salt */\r\n var salt = new byte[32];\r\n using (var random = new RNGCryptoServiceProvider())\r\n {\r\n random.GetNonZeroBytes(salt);\r\n byte[] textWithSaltBytes = Encoding.UTF8.GetBytes(string.Concat(\"hash me\", salt));\r\n byte[] hashedBytes = sha.ComputeHash(textWithSaltBytes);\r\n sha.Clear();\r\n IO.WriteLine(IO.ToHex(hashedBytes));\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-759 (Unsalted One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-759\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-759\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE759_Unsalted_One_Way_Hash/CWE759_Unsalted_One_Way_Hash__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"cdf54ede643564292385ecb58700da42af23d8e00f3b699ac081f836189f1bd3\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-759\", \"target_weakness\": \"Unsalted One Way Hash\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-760-4635b9c36c03", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE760_Predictable_Salt_One_Way_Hash__basic_01.cs\r\nLabel Definition File: CWE760_Predictable_Salt_One_Way_Hash__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 760 Use of one-way hash with a predictable salt\r\n* Sinks:\r\n* GoodSink: SHA512 with a sufficiently random salt\r\n* BadSink : SHA512 with a predictable salt\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Text;\r\nusing System.Security.Cryptography;\r\n\r\nnamespace testcases.CWE760_Predictable_Salt_One_Way_Hash\r\n{\r\nclass CWE760_Predictable_Salt_One_Way_Hash__basic_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n Random random = new Random();\r\n byte[] hashedBytes;\r\n using (SHA512CryptoServiceProvider sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n /* FLAW: SHA512 with a predictable salt */\r\n byte[] textWithSaltBytes = Encoding.UTF8.GetBytes(string.Concat(\"hash me\", random.Next().ToString()));\r\n hashedBytes = sha512.ComputeHash(textWithSaltBytes);\r\n }\r\n IO.WriteLine(IO.ToHex(hashedBytes));\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n\r\n private void Good1()\r\n {\r\n byte[] hashedBytes;\r\n using (SHA512CryptoServiceProvider sha512 = new SHA512CryptoServiceProvider())\r\n {\r\n using (RNGCryptoServiceProvider random = new RNGCryptoServiceProvider())\r\n {\r\n var salt = new byte[32];\r\n /* FIX: Use a sufficiently random salt */\r\n random.GetNonZeroBytes(salt);\r\n byte[] textWithSaltBytes = Encoding.UTF8.GetBytes(string.Concat(\"hash me\", salt));\r\n hashedBytes = sha512.ComputeHash(textWithSaltBytes);\r\n }\r\n }\r\n IO.WriteLine(IO.ToHex(hashedBytes));\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-760 (Predictable Salt One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-760\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-760\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE760_Predictable_Salt_One_Way_Hash/CWE760_Predictable_Salt_One_Way_Hash__basic_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4635b9c36c030c560f96b87f7a54d3152e5950673b9e08c50d98a0cfdb11aa3b\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-760\", \"target_weakness\": \"Predictable Salt One Way Hash\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-764-458819291351", "input": "/*\r\n * @description Demonstrates use of Monitor.Enter() more times than Monitor.Exit() in multithreaded code that accesses a shared variable.\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.Threading;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE764_Multiple_Locks\r\n{\r\n class CWE764_Multiple_locks__Monitor_Object_Thread_01 : AbstractTestCase\r\n {\r\n /* Bad(): Use Monitor.Enter() twice and Monitor.Exit() once */\r\n static private readonly object badLock = new object();\r\n static private int intBad = 1;\r\n\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n Monitor.Enter(badLock);\r\n Monitor.Enter(badLock); /* FLAW: Code uses Monitor.Enter() twice (and Monitor.Exit() once), so the second thread will never be able to get lock */\r\n try\r\n {\r\n intBad = intBad * 2;\r\n }\r\n finally\r\n {\r\n Monitor.Exit(badLock);\r\n }\r\n }\r\n#endif // OMITBAD\r\n\r\n /* Good1(): Use a ReentrantLock properly (use Monitor.Enter() once and Monitor.Exit() once) */\r\n static private readonly object goodLock = new object();\r\n static private int intGood1 = 1;\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n Monitor.Enter(goodLock); /* FIX: Only use Monitor.Enter() once */\r\n try\r\n {\r\n intGood1 = intGood1 * 2;\r\n }\r\n finally\r\n {\r\n Monitor.Exit(goodLock);\r\n }\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-764 (Multiple Locks). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-764\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-764\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE764_Multiple_Locks/CWE764_Multiple_locks__Monitor_Object_Thread_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"458819291351d5569cd4ed90413e7abd6e867d71dde7f4d6fbfba693cbf09262\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-764\", \"target_weakness\": \"Multiple Locks\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-765-685698ee8e93", "input": "/*\r\n * @description Demonstrates use of Monitor.Exit() more times than Monitor.Enter() in multithreaded code that accesses a shared variable.\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.Threading;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE765_Multiple_Unlocks\r\n{\r\n class CWE765_Multiple_Unlocks__Monitor_Object_Thread_01 : AbstractTestCase\r\n {\r\n /* Bad(): Use Monitor.Enter() once and Monitor.Exit() twice */\r\n static private readonly object badLock;\r\n static private int intBad = 1;\r\n\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n Monitor.Enter(badLock);\r\n try\r\n {\r\n intBad = intBad * 2;\r\n }\r\n finally\r\n {\r\n Monitor.Exit(badLock);\r\n Monitor.Exit(badLock); /* FLAW: Code uses Monitor.Exit() twice (and Monitor.Enter() once), which will throw an SynchronizationLockException */\r\n }\r\n }\r\n#endif // OMITBAD\r\n\r\n /* Good1(): Use a ReentrantLock properly (use Monitor.Enter() once and Monitor.Exit() once) */\r\n static private readonly object goodLock;\r\n static private int intGood1 = 1;\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n Monitor.Enter(goodLock);\r\n try\r\n {\r\n intGood1 = intGood1 * 2;\r\n }\r\n finally\r\n {\r\n Monitor.Exit(goodLock); /* FIX: Only use Monitor.Exit() once */\r\n }\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-765 (Multiple Unlocks). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-765\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-765\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE765_Multiple_Unlocks/CWE765_Multiple_Unlocks__Monitor_Object_Thread_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"685698ee8e936ac19dda761eb09fff24a0409221103e146feb3e4bd6a3d567a7\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-765\", \"target_weakness\": \"Multiple Unlocks\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-78-92223de4451f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE78_OS_Command_Injection__Connect_tcp_01.cs\r\nLabel Definition File: CWE78_OS_Command_Injection.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 78 OS Command Injection\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: exec dynamic command execution with Runtime.getRuntime().exec()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Diagnostics;\r\nusing System.Runtime.InteropServices;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE78_OS_Command_Injection\r\n{\r\n\r\nclass CWE78_OS_Command_Injection__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n String osCommand;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\r\n {\r\n /* running on Windows */\r\n osCommand = \"c:\\\\WINDOWS\\\\SYSTEM32\\\\cmd.exe /c dir \";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n osCommand = \"/bin/ls \";\r\n }\r\n /* POTENTIAL FLAW: command injection */\r\n Process process = Process.Start(osCommand + data);\r\n process.WaitForExit();\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n String osCommand;\r\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\r\n {\r\n /* running on Windows */\r\n osCommand = \"c:\\\\WINDOWS\\\\SYSTEM32\\\\cmd.exe /c dir \";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n osCommand = \"/bin/ls \";\r\n }\r\n /* POTENTIAL FLAW: command injection */\r\n Process process = Process.Start(osCommand + data);\r\n process.WaitForExit();\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-78 (OS Command Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-78\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-78\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE78_OS_Command_Injection/CWE78_OS_Command_Injection__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"92223de4451fca5117e830938f94600416ffc09b9d64b5d81a66712489b73b7c\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-78\", \"target_weakness\": \"OS Command Injection\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-789-1c0e540d4ea9", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE789_Uncontrolled_Mem_Alloc__Connect_tcp_ArrayList_01.cs\r\nLabel Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 789 Uncontrolled Memory Allocation\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* BadSink: ArrayList Create an ArrayList using data as the initial size\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Collections;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE789_Uncontrolled_Mem_Alloc\r\n{\r\n\r\nclass CWE789_Uncontrolled_Mem_Alloc__Connect_tcp_ArrayList_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n int data;\r\n data = int.MinValue; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n String stringNumber = \"\";\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n stringNumber = sr.ReadLine();\r\n }\r\n }\r\n if (stringNumber != null) /* avoid NPD incidental warnings */\r\n {\r\n try\r\n {\r\n data = int.Parse(stringNumber.Trim());\r\n }\r\n catch(FormatException exceptNumberFormat)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptNumberFormat, \"Number format exception parsing data from string\");\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n /* POTENTIAL FLAW: Create an ArrayList using data as the initial size. data may be very large, creating memory issues */\r\n ArrayList intArrayList = new ArrayList(data);\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n int data;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n /* POTENTIAL FLAW: Create an ArrayList using data as the initial size. data may be very large, creating memory issues */\r\n ArrayList intArrayList = new ArrayList(data);\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-789 (Uncontrolled Mem Alloc). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-789\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-789\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE789_Uncontrolled_Mem_Alloc/s01/CWE789_Uncontrolled_Mem_Alloc__Connect_tcp_ArrayList_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1c0e540d4ea95f3f0073c27767920c9ff0e01e8670bac3d4d9126f818282c74b\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-789\", \"target_weakness\": \"Uncontrolled Mem Alloc\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-81-5ff2078a7174", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE81_XSS_Error_Message__Web_Connect_tcp_01.cs\r\nLabel Definition File: CWE81_XSS_Error_Message__Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 81 Cross Site Scripting (XSS) in Error Message\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: ErrorStatusCode XSS in StatusCode\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE81_XSS_Error_Message\r\n{\r\n\r\nclass CWE81_XSS_Error_Message__Web_Connect_tcp_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: script code (e.g. id=) is sent to the client; */\r\n resp.StatusCode = 404;\r\n resp.StatusDescription = \"
Bad() - Parameter name has value \" + data;\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: script code (e.g. id=) is sent to the client; */\r\n resp.StatusCode = 404;\r\n resp.StatusDescription = \"
Bad() - Parameter name has value \" + data;\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-81 (XSS Error Message). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-81\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-81\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE81_XSS_Error_Message/CWE81_XSS_Error_Message__Web_Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5ff2078a71745060c13e46e6550015583c349f2dd264c801ffdbb254d2db50b2\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-81\", \"target_weakness\": \"XSS Error Message\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-83-c46343e81a66", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE83_XSS_Attribute__Web_Connect_tcp_01.cs\r\nLabel Definition File: CWE83_XSS_Attribute__Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 83 Cross Site Scripting (XSS) in attributes; Examples(replace QUOTE with an actual double quote): ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEalert(1) and ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEjavascript:alert(1)\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: Write XSS in img src attribute\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE83_XSS_Attribute\r\n{\r\n\r\nclass CWE83_XSS_Attribute__Web_Connect_tcp_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */\r\n resp.Write(\"
Bad() -
\");\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */\r\n resp.Write(\"
Bad() -
\");\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-83 (XSS Attribute). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-83\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-83\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE83_XSS_Attribute/CWE83_XSS_Attribute__Web_Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"c46343e81a66660d5a8e8c0328e55c24091eb2b5451d74ca13c135633fd60096\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-83\", \"target_weakness\": \"XSS Attribute\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-832-d055cd4c14a8", "input": "/*\r\n * @description Demonstrates use of unlock() on a lock that is not locked in multithreaded code that accesses a shared variable.\r\n *\r\n * */\r\n\r\nusing System;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE832_Unlock_Not_Locked\r\n{\r\n class CWE832_Unlock_Not_Locked__Object_Thread_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n object lock1 = new object();\r\n object lock2 = new object();\r\n IO.WriteLine(\"Starting...\");\r\n var task1 = Task.Run(() =>\r\n {\r\n Monitor.Enter(lock1);\r\n {\r\n Thread.Sleep(1000);\r\n IO.WriteLine(\"Finished Thread 1\");\r\n }\r\n /* FLAW: Exiting (unlocking) a lock that is not locked. */\r\n Monitor.Exit(lock2);\r\n });\r\n\r\n Task.WaitAll(task1);\r\n IO.WriteLine(\"Finished...\");\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n object lock1 = new object();\r\n object lock2 = new object();\r\n IO.WriteLine(\"Starting...\");\r\n var task1 = Task.Run(() =>\r\n {\r\n Monitor.Enter(lock1);\r\n {\r\n Thread.Sleep(1000);\r\n IO.WriteLine(\"Finished Thread 1\");\r\n }\r\n /* FIX: Exiting (unlocking) a lock that is locked. */\r\n Monitor.Exit(lock1);\r\n });\r\n\r\n Task.WaitAll(task1);\r\n IO.WriteLine(\"Finished...\");\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-832 (Unlock Not Locked). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-832\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-832\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE832_Unlock_Not_Locked/CWE832_Unlock_Not_Locked__Object_Thread_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"d055cd4c14a883ac2f09e683b7b5a6e01d7690485b02ca3070abcb17b6e10ffa\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-832\", \"target_weakness\": \"Unlock Not Locked\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-833-46e50cbf0ae8", "input": "/*\r\n * @description Demonstrates a deadlock caused by obtaining locks in a different order in different functions in multithreaded code that accesses shared variables.\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.Threading;\r\nusing System.Threading.Tasks;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE833_Deadlock\r\n{\r\n class CWE833_Deadlock__Nested_Lock_Thread_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n object lock1 = new object();\r\n object lock2 = new object();\r\n IO.WriteLine(\"Starting...\");\r\n var task1 = Task.Run(() =>\r\n {\r\n lock (lock1)\r\n {\r\n Thread.Sleep(1000);\r\n /* FLAW: 2nd thread acquires lock2 thus this thread cannot acquire it */\r\n lock (lock2)\r\n {\r\n IO.WriteLine(\"Finished Thread 1\");\r\n }\r\n }\r\n });\r\n\r\n var task2 = Task.Run(() =>\r\n {\r\n lock (lock2)\r\n {\r\n Thread.Sleep(1000);\r\n /* FLAW: 1st thread acquires lock1 thus this thread cannot acquire it */\r\n lock (lock1)\r\n {\r\n IO.WriteLine(\"Finished Thread 2\");\r\n }\r\n }\r\n });\r\n\r\n Task.WaitAll(task1, task2);\r\n IO.WriteLine(\"Finished...\");\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n object lock1 = new object();\r\n object lock2 = new object();\r\n IO.WriteLine(\"Starting...\");\r\n /* FIX: nest the locks in the same order */\r\n var task1 = Task.Run(() =>\r\n {\r\n lock (lock1)\r\n {\r\n Thread.Sleep(1000);\r\n lock (lock2)\r\n {\r\n IO.WriteLine(\"Finished Thread 1\");\r\n }\r\n }\r\n });\r\n\r\n var task2 = Task.Run(() =>\r\n {\r\n lock (lock1)\r\n {\r\n Thread.Sleep(1000);\r\n lock (lock2)\r\n {\r\n IO.WriteLine(\"Finished Thread 2\");\r\n }\r\n }\r\n });\r\n\r\n Task.WaitAll(task1, task2);\r\n IO.WriteLine(\"Finished...\");\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-833 (Deadlock). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-833\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-833\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE833_Deadlock/CWE833_Deadlock__Nested_Lock_Thread_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"46e50cbf0ae80c53b06c4d9262b368656217110671df31aec268f8b1a609652d\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-833\", \"target_weakness\": \"Deadlock\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-835-7c9c497d549c", "input": "/*\r\n * @description Infinite loop - do{}while()\r\n *\r\n * */\r\n\r\nusing System;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE835_Infinite_Loop\r\n{\r\n class CWE835_Infinite_Loop__do_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int i = 0;\r\n\r\n /* FLAW: Infinite Loop - do..while() with no break point */\r\n do\r\n {\r\n IO.WriteLine(i);\r\n i = (i + 1) % 256;\r\n } while (i >= 0);\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n private void Good1()\r\n {\r\n int i = 0;\r\n\r\n do\r\n {\r\n /* FIX: Add a break point for the loop if i = 10 */\r\n if (i == 10)\r\n {\r\n break;\r\n }\r\n IO.WriteLine(i);\r\n i = (i + 1) % 256;\r\n } while (i >= 0);\r\n }\r\n\r\n public override void Good()\r\n {\r\n Good1();\r\n }\r\n#endif // OMITGOOD\r\n\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-835 (Infinite Loop). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-835\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-835\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE835_Infinite_Loop/CWE835_Infinite_Loop__do_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7c9c497d549c277e0e1dd04408dd5f2199fad5d7893f6aec0bf614cbbbb1646c\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-835\", \"target_weakness\": \"Infinite Loop\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-89-8331f8aaf6ab", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE89_SQL_Injection__Web_Connect_tcp_CommandText_01.cs\r\nLabel Definition File: CWE89_SQL_Injection__Web.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 89 SQL Injection\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks: CommandText\r\n* GoodSink: Use prepared statement and concatenate CommandText (properly)\r\n* BadSink : data concatenated into SQL statement used in CommandText, which could result in SQL Injection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.Data.SqlClient;\r\nusing System.Data;\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE89_SQL_Injection\r\n{\r\nclass CWE89_SQL_Injection__Web_Connect_tcp_CommandText_01 : AbstractTestCaseWeb\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n string[] names = data.Split('-');\r\n int successCount = 0;\r\n SqlCommand badSqlCommand = null;\r\n try\r\n {\r\n using (SqlConnection dbConnection = IO.GetDBConnection())\r\n {\r\n badSqlCommand.Connection = dbConnection;\r\n dbConnection.Open();\r\n for (int i = 0; i < names.Length; i++)\r\n {\r\n /* POTENTIAL FLAW: data concatenated into SQL statement used in CommandText, which could result in SQL Injection */\r\n badSqlCommand.CommandText += \"update users set hitcount=hitcount+1 where name='\" + names[i] + \"';\";\r\n }\r\n var affectedRows = badSqlCommand.ExecuteNonQuery();\r\n successCount += affectedRows;\r\n IO.WriteLine(\"Succeeded in \" + successCount + \" out of \" + names.Length + \" queries.\");\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (badSqlCommand != null)\r\n {\r\n badSqlCommand.Dispose();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error disposing SqlCommand\", exceptSql);\r\n }\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good(HttpRequest req, HttpResponse resp)\r\n {\r\n GoodG2B(req, resp);\r\n GoodB2G(req, resp);\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void GoodG2B(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n if (data != null)\r\n {\r\n string[] names = data.Split('-');\r\n int successCount = 0;\r\n SqlCommand badSqlCommand = null;\r\n try\r\n {\r\n using (SqlConnection dbConnection = IO.GetDBConnection())\r\n {\r\n badSqlCommand.Connection = dbConnection;\r\n dbConnection.Open();\r\n for (int i = 0; i < names.Length; i++)\r\n {\r\n /* POTENTIAL FLAW: data concatenated into SQL statement used in CommandText, which could result in SQL Injection */\r\n badSqlCommand.CommandText += \"update users set hitcount=hitcount+1 where name='\" + names[i] + \"';\";\r\n }\r\n var affectedRows = badSqlCommand.ExecuteNonQuery();\r\n successCount += affectedRows;\r\n IO.WriteLine(\"Succeeded in \" + successCount + \" out of \" + names.Length + \" queries.\");\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (badSqlCommand != null)\r\n {\r\n badSqlCommand.Dispose();\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error disposing SqlCommand\", exceptSql);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G(HttpRequest req, HttpResponse resp)\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n if (data != null)\r\n {\r\n string[] names = data.Split('-');\r\n int successCount = 0;\r\n try\r\n {\r\n /* FIX: Use prepared statement and concatenate CommandText (properly) */\r\n using (SqlConnection dbConnection = IO.GetDBConnection())\r\n {\r\n dbConnection.Open();\r\n using (SqlCommand goodSqlCommand = new SqlCommand(null, dbConnection))\r\n {\r\n for (int i = 0; i < names.Length; i++)\r\n {\r\n SqlParameter nameParam = new SqlParameter(\"@name\", SqlDbType.VarChar, 100);\r\n nameParam.Value = names[i];\r\n goodSqlCommand.CommandText += \"update users set hitcount=hitcount+1 where name=@name;\";\r\n }\r\n goodSqlCommand.Prepare();\r\n int affectedRows = goodSqlCommand.ExecuteNonQuery();\r\n successCount += affectedRows;\r\n IO.WriteLine(\"Succeeded in \" + successCount + \" out of \" + names.Length + \" queries.\");\r\n }\r\n }\r\n }\r\n catch (SqlException exceptSql)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, \"Error getting database connection\", exceptSql);\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-89 (SQL Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-89\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodB2G\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-89\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE89_SQL_Injection/s01/CWE89_SQL_Injection__Web_Connect_tcp_CommandText_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8331f8aaf6abf4968eb895b5c6c1eaf105ec33a2330669da09cc9c2baa1c893e\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-89\", \"target_weakness\": \"SQL Injection\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-csharp-cwe-90-03691173455a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE90_LDAP_Injection__Connect_tcp_01.cs\r\nLabel Definition File: CWE90_LDAP_Injection.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 90 LDAP Injection\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: data concatenated into LDAP search, which could result in LDAP Injection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing System.DirectoryServices;\r\n\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE90_LDAP_Injection\r\n{\r\n\r\nclass CWE90_LDAP_Injection__Connect_tcp_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n /* uses badsource and badsink */\r\n public override void Bad()\r\n {\r\n string data;\r\n data = \"\"; /* Initialize data */\r\n /* Read data using an outbound tcp connection */\r\n {\r\n try\r\n {\r\n /* Read data using an outbound tcp connection */\r\n using (TcpClient tcpConn = new TcpClient(\"host.example.org\", 39544))\r\n {\r\n /* read input from socket */\r\n using (StreamReader sr = new StreamReader(tcpConn.GetStream()))\r\n {\r\n /* POTENTIAL FLAW: Read data using an outbound tcp connection */\r\n data = sr.ReadLine();\r\n }\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.Logger.Log(NLog.LogLevel.Warn, exceptIO, \"Error with stream reading\");\r\n }\r\n }\r\n using (DirectoryEntry de = new DirectoryEntry())\r\n {\r\n /* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection */\r\n using (DirectorySearcher search = new DirectorySearcher(de))\r\n {\r\n search.Filter = \"(&(objectClass=user)(employeename=\" + data + \"))\";\r\n search.PropertiesToLoad.Add(\"mail\");\r\n search.PropertiesToLoad.Add(\"telephonenumber\");\r\n SearchResult sresult = search.FindOne();\r\n }\r\n }\r\n }\r\n#endif //omitbad\r\n#if (!OMITGOOD)\r\n public override void Good()\r\n {\r\n GoodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void GoodG2B()\r\n {\r\n string data;\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n using (DirectoryEntry de = new DirectoryEntry())\r\n {\r\n /* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection */\r\n using (DirectorySearcher search = new DirectorySearcher(de))\r\n {\r\n search.Filter = \"(&(objectClass=user)(employeename=\" + data + \"))\";\r\n search.PropertiesToLoad.Add(\"mail\");\r\n search.PropertiesToLoad.Add(\"telephonenumber\");\r\n SearchResult sresult = search.FindOne();\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-90 (LDAP Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-90\"}", "language": "C#", "output": "{\"bad_method_names\": [\"Bad\"], \"good_method_names\": [\"Good\", \"GoodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-90\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2020-08-01-juliet-test-suite-for-csharp-v1-3.zip\", \"source_file\": \"src/testcases/CWE90_LDAP_Injection/CWE90_LDAP_Injection__Connect_tcp_01.cs\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"03691173455a6166ad6cbc687641356fb013c6a9fcbe38e5ce0b981885b5caf5\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-90\", \"target_weakness\": \"LDAP Injection\"}", "source": "Juliet C# 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-113-f57e8191d24d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE113_HTTP_Response_Splitting__Environment_addCookieServlet_01.java\r\nLabel Definition File: CWE113_HTTP_Response_Splitting.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 113 HTTP Response Splitting\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* Sinks: addCookieServlet\r\n* GoodSink: URLEncode input\r\n* BadSink : querystring to addCookie()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE113_HTTP_Response_Splitting.s01;\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.net.URLEncoder;\r\n\r\npublic class CWE113_HTTP_Response_Splitting__Environment_addCookieServlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n if (data != null)\r\n {\r\n Cookie cookieSink = new Cookie(\"lang\", data);\r\n /* POTENTIAL FLAW: Input not verified before inclusion in the cookie */\r\n response.addCookie(cookieSink);\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n goodB2G(request, response);\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n if (data != null)\r\n {\r\n Cookie cookieSink = new Cookie(\"lang\", data);\r\n /* POTENTIAL FLAW: Input not verified before inclusion in the cookie */\r\n response.addCookie(cookieSink);\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n if (data != null)\r\n {\r\n Cookie cookieSink = new Cookie(\"lang\", URLEncoder.encode(data, \"UTF-8\"));\r\n /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */\r\n response.addCookie(cookieSink);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-113 (HTTP Response Splitting). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-113\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-113\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE113_HTTP_Response_Splitting/s01/CWE113_HTTP_Response_Splitting__Environment_addCookieServlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f57e8191d24d1c03eddffc88272821e93adeb952e2d15753d91707ab65d561cb\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-113\", \"target_weakness\": \"HTTP Response Splitting\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-114-ddcb22043a73", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE114_Process_Control__basic_01.java\r\nLabel Definition File: CWE114_Process_Control__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 114 Process Control\r\n* Sinks:\r\n* GoodSink: use System.load() to load a library\r\n* BadSink : use System.loadLibrary() to load a library\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE114_Process_Control;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE114_Process_Control__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n String libraryName = \"test.dll\";\r\n\r\n /* FLAW: Attempt to load a library with System.loadLibrary() without\r\n * the full path to the library. */\r\n System.loadLibrary(libraryName);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n String root;\r\n String libraryName = \"test.dll\";\r\n\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\libs\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/libs/\";\r\n }\r\n\r\n /* FIX: Use System.load() which allows you to specify a full path to the library */\r\n System.load(root + libraryName);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-114 (Process Control). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-114\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-114\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE114_Process_Control/CWE114_Process_Control__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ddcb22043a738131b144e6d30c8d2e5b0f7ef6337c8697dd16ff0692fdd6a08a\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-114\", \"target_weakness\": \"Process Control\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-129-74cd75dd3e56", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE129_Improper_Validation_of_Array_Index__Environment_array_read_check_max_01.java\r\nLabel Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 129 Improper Validation of Array Index\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: array_read_check_max\r\n* GoodSink: Read from array after verifying index is at least 0 and less than array.length\r\n* BadSink : Read from array after verifying that data less than array.length (but not verifying that data is at least 0)\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE129_Improper_Validation_of_Array_Index.s01;\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE129_Improper_Validation_of_Array_Index__Environment_array_read_check_max_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n int data;\r\n\r\n data = Integer.MIN_VALUE; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = Integer.parseInt(stringNumber.trim());\r\n }\r\n catch(NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int array[] = { 0, 1, 2, 3, 4 };\r\n\r\n /* POTENTIAL FLAW: Verify that data < array.length, but don't verify that data > 0, so may be attempting to read out of the array bounds */\r\n if (data < array.length)\r\n {\r\n IO.writeLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"Array index out of bounds\");\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n int data;\r\n\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int array[] = { 0, 1, 2, 3, 4 };\r\n\r\n /* POTENTIAL FLAW: Verify that data < array.length, but don't verify that data > 0, so may be attempting to read out of the array bounds */\r\n if (data < array.length)\r\n {\r\n IO.writeLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"Array index out of bounds\");\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n int data;\r\n\r\n data = Integer.MIN_VALUE; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = Integer.parseInt(stringNumber.trim());\r\n }\r\n catch(NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */\r\n int array[] = { 0, 1, 2, 3, 4 };\r\n\r\n /* FIX: Fully verify data before reading from array at location data */\r\n if (data >= 0 && data < array.length)\r\n {\r\n IO.writeLine(array[data]);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"Array index out of bounds\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-129 (Improper Validation of Array Index). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-129\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-129\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE129_Improper_Validation_of_Array_Index/s01/CWE129_Improper_Validation_of_Array_Index__Environment_array_read_check_max_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"74cd75dd3e56300ece705c863dda23b5d565a6227193eb00e626b6090ba17d35\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-129\", \"target_weakness\": \"Improper Validation of Array Index\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-15-0aa3bed1319a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE15_External_Control_of_System_or_Configuration_Setting__Environment_01.java\r\nLabel Definition File: CWE15_External_Control_of_System_or_Configuration_Setting.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 15 External Control of System or Configuration Setting\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* BadSink: Set the catalog name with the value of data\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE15_External_Control_of_System_or_Configuration_Setting;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.sql.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE15_External_Control_of_System_or_Configuration_Setting__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n Connection dbConnection = null;\r\n\r\n try\r\n {\r\n dbConnection = IO.getDBConnection();\r\n\r\n /* POTENTIAL FLAW: Set the catalog name with the value of data\r\n * allowing a nonexistent catalog name or unauthorized access to a portion of the DB */\r\n dbConnection.setCatalog(data);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n Connection dbConnection = null;\r\n\r\n try\r\n {\r\n dbConnection = IO.getDBConnection();\r\n\r\n /* POTENTIAL FLAW: Set the catalog name with the value of data\r\n * allowing a nonexistent catalog name or unauthorized access to a portion of the DB */\r\n dbConnection.setCatalog(data);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-15 (External Control of System or Configuration Setting). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-15\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-15\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE15_External_Control_of_System_or_Configuration_Setting/CWE15_External_Control_of_System_or_Configuration_Setting__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0aa3bed1319a589c48f347c7f58ff31963298ffd0e25b6eb7e29c84c53ca6f7e\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-15\", \"target_weakness\": \"External Control of System or Configuration Setting\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-190-429011f5ce5c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE190_Integer_Overflow__byte_console_readLine_add_01.java\r\nLabel Definition File: CWE190_Integer_Overflow.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 190 Integer Overflow\r\n* BadSource: console_readLine Read data from the console using readLine\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: add\r\n* GoodSink: Ensure there will not be an overflow before adding 1 to data\r\n* BadSink : Add 1 to data, which can cause an overflow\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE190_Integer_Overflow.s01;\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE190_Integer_Overflow__byte_console_readLine_add_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* init data */\r\n data = -1;\r\n\r\n /* POTENTIAL FLAW: Read data from console with readLine*/\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n String stringNumber = readerBuffered.readLine();\r\n if (stringNumber != null)\r\n {\r\n data = Byte.parseByte(stringNumber.trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n /* POTENTIAL FLAW: if data == Byte.MAX_VALUE, this will overflow */\r\n byte result = (byte)(data + 1);\r\n\r\n IO.writeLine(\"result: \" + result);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n\r\n /* POTENTIAL FLAW: if data == Byte.MAX_VALUE, this will overflow */\r\n byte result = (byte)(data + 1);\r\n\r\n IO.writeLine(\"result: \" + result);\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* init data */\r\n data = -1;\r\n\r\n /* POTENTIAL FLAW: Read data from console with readLine*/\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n String stringNumber = readerBuffered.readLine();\r\n if (stringNumber != null)\r\n {\r\n data = Byte.parseByte(stringNumber.trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n /* FIX: Add a check to prevent an overflow from occurring */\r\n if (data < Byte.MAX_VALUE)\r\n {\r\n byte result = (byte)(data + 1);\r\n IO.writeLine(\"result: \" + result);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"data value is too large to perform addition.\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-190 (Integer Overflow). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-190\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-190\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE190_Integer_Overflow/s01/CWE190_Integer_Overflow__byte_console_readLine_add_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"429011f5ce5cba12b443a560522284a28f1c0d705503ad566bf2c09940027f04\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-190\", \"target_weakness\": \"Integer Overflow\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-191-b4f0beeb2b6f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE191_Integer_Underflow__byte_console_readLine_multiply_01.java\r\nLabel Definition File: CWE191_Integer_Underflow.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 191 Integer Underflow\r\n* BadSource: console_readLine Read data from the console using readLine\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: multiply\r\n* GoodSink: Ensure there will not be an underflow before multiplying data by 2\r\n* BadSink : If data is negative, multiply by 2, which can cause an underflow\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE191_Integer_Underflow.s01;\r\nimport testcasesupport.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE191_Integer_Underflow__byte_console_readLine_multiply_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* init data */\r\n data = -1;\r\n\r\n /* POTENTIAL FLAW: Read data from console with readLine*/\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n String stringNumber = readerBuffered.readLine();\r\n if (stringNumber != null)\r\n {\r\n data = Byte.parseByte(stringNumber.trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* POTENTIAL FLAW: if (data * 2) < Byte.MIN_VALUE, this will underflow */\r\n byte result = (byte)(data * 2);\r\n IO.writeLine(\"result: \" + result);\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* POTENTIAL FLAW: if (data * 2) < Byte.MIN_VALUE, this will underflow */\r\n byte result = (byte)(data * 2);\r\n IO.writeLine(\"result: \" + result);\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n byte data;\r\n\r\n /* init data */\r\n data = -1;\r\n\r\n /* POTENTIAL FLAW: Read data from console with readLine*/\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n String stringNumber = readerBuffered.readLine();\r\n if (stringNumber != null)\r\n {\r\n data = Byte.parseByte(stringNumber.trim());\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with number parsing\", exceptNumberFormat);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if(data < 0) /* ensure we won't have an overflow */\r\n {\r\n /* FIX: Add a check to prevent an underflow from occurring */\r\n if (data > (Byte.MIN_VALUE/2))\r\n {\r\n byte result = (byte)(data * 2);\r\n IO.writeLine(\"result: \" + result);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"data value is too small to perform multiplication.\");\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-191 (Integer Underflow). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-191\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-191\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__byte_console_readLine_multiply_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"b4f0beeb2b6f572fbc072bc840b546c1626897daa2007f724631e2890169ff33\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-191\", \"target_weakness\": \"Integer Underflow\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-197-04b214c7ba69", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE197_Numeric_Truncation_Error__int_Environment_to_byte_01.java\r\nLabel Definition File: CWE197_Numeric_Truncation_Error__int.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 197 Numeric Truncation Error\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* BadSink: to_byte Convert data to a byte\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE197_Numeric_Truncation_Error.s01;\r\nimport testcasesupport.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE197_Numeric_Truncation_Error__int_Environment_to_byte_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n int data;\r\n\r\n data = Integer.MIN_VALUE; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = Integer.parseInt(stringNumber.trim());\r\n }\r\n catch(NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n {\r\n /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */\r\n IO.writeLine((byte)data);\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n int data;\r\n\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n\r\n {\r\n /* POTENTIAL FLAW: Convert data to a byte, possibly causing a truncation error */\r\n IO.writeLine((byte)data);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-197 (Numeric Truncation Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-197\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-197\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE197_Numeric_Truncation_Error/s01/CWE197_Numeric_Truncation_Error__int_Environment_to_byte_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"04b214c7ba69f282e9ea93ed62dd45338904ab472e83231c579007ad38caad55\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-197\", \"target_weakness\": \"Numeric Truncation Error\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-209-ce190327e232", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE209_Information_Leak_Error__printStackTrace_01.java\r\nLabel Definition File: CWE209_Information_Leak_Error.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 209 Information exposure through error message\r\n* Sinks: printStackTrace\r\n* GoodSink: Print generic error message to console\r\n* BadSink : Print stack trace to console\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE209_Information_Leak_Error;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE209_Information_Leak_Error__printStackTrace_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n throw new UnsupportedOperationException();\r\n }\r\n catch (UnsupportedOperationException exceptUnsupportedOperation)\r\n {\r\n exceptUnsupportedOperation.printStackTrace(); /* FLAW: Print stack trace to console on error */\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n throw new UnsupportedOperationException();\r\n }\r\n catch (UnsupportedOperationException exceptUnsupportedOperation)\r\n {\r\n IO.writeLine(\"There was an unsupported operation error\"); /* FIX: print a generic message */\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-209 (Information Leak Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-209\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-209\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE209_Information_Leak_Error/CWE209_Information_Leak_Error__printStackTrace_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"ce190327e2326e5d89b50840dd4233f97d6dcd9a3134e03ac32808c325997fb1\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-209\", \"target_weakness\": \"Information Leak Error\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-226-9f0e86c3cc00", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01.java\r\nLabel Definition File: CWE226_Sensitive_Information_Uncleared_Before_Release__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 226 Sensitive Information Uncleared Before Release\r\n* Sinks:\r\n* GoodSink: Sensitive info (password) is stored in a mutable object, but is zeroized after use\r\n* BadSink : Sensitive info (password) is stored in a mutable object and is uncleared\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE226_Sensitive_Information_Uncleared_Before_Release;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.IOException;\r\n\r\nimport java.sql.SQLException;\r\nimport java.sql.Connection;\r\nimport java.sql.DriverManager;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n InputStreamReader readerInputStream = null;\r\n BufferedReader readerBuffered = null;\r\n StringBuffer password = new StringBuffer();\r\n Connection dBConnection = null;\r\n\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n password.append(readerBuffered.readLine());\r\n\r\n dBConnection = DriverManager.getConnection(\"192.168.105.23\", \"sa\", password.toString());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n /* FLAW: the password is stored in a mutable object (StringBuffer) and it is not cleared */\r\n\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n InputStreamReader readerInputStream = null;\r\n BufferedReader readerBuffered = null;\r\n StringBuffer password = new StringBuffer();\r\n Connection dBConnection = null;\r\n\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n password.append(readerBuffered.readLine());\r\n\r\n dBConnection = DriverManager.getConnection(\"192.168.105.23\", \"sa\", password.toString());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n /* FIX: Zeroize the password */\r\n password.delete(0, password.length());\r\n\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-226 (Sensitive Information Uncleared Before Release). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-226\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-226\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE226_Sensitive_Information_Uncleared_Before_Release/CWE226_Sensitive_Information_Uncleared_Before_Release__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9f0e86c3cc00c73250f3a477d9028357ab2c13d3eff84c8ceb0461dc8ed3db21\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-226\", \"target_weakness\": \"Sensitive Information Uncleared Before Release\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-23-c1e620cf61de", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE23_Relative_Path_Traversal__Environment_01.java\r\nLabel Definition File: CWE23_Relative_Path_Traversal.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 23 Relative Path Traversal\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* BadSink: readFile no validation\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE23_Relative_Path_Traversal;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.*;\r\nimport javax.servlet.http.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE23_Relative_Path_Traversal__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n String root;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\uploads\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/uploads/\";\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: no validation of concatenated value */\r\n File file = new File(root + data);\r\n FileInputStream streamFileInputSink = null;\r\n InputStreamReader readerInputStreamSink = null;\r\n BufferedReader readerBufferdSink = null;\r\n if (file.exists() && file.isFile())\r\n {\r\n try\r\n {\r\n streamFileInputSink = new FileInputStream(file);\r\n readerInputStreamSink = new InputStreamReader(streamFileInputSink, \"UTF-8\");\r\n readerBufferdSink = new BufferedReader(readerInputStreamSink);\r\n IO.writeLine(readerBufferdSink.readLine());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBufferdSink != null)\r\n {\r\n readerBufferdSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStreamSink != null)\r\n {\r\n readerInputStreamSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInputSink != null)\r\n {\r\n streamFileInputSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n String root;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n root = \"C:\\\\uploads\\\\\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n root = \"/home/user/uploads/\";\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: no validation of concatenated value */\r\n File file = new File(root + data);\r\n FileInputStream streamFileInputSink = null;\r\n InputStreamReader readerInputStreamSink = null;\r\n BufferedReader readerBufferdSink = null;\r\n if (file.exists() && file.isFile())\r\n {\r\n try\r\n {\r\n streamFileInputSink = new FileInputStream(file);\r\n readerInputStreamSink = new InputStreamReader(streamFileInputSink, \"UTF-8\");\r\n readerBufferdSink = new BufferedReader(readerInputStreamSink);\r\n IO.writeLine(readerBufferdSink.readLine());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBufferdSink != null)\r\n {\r\n readerBufferdSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStreamSink != null)\r\n {\r\n readerInputStreamSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInputSink != null)\r\n {\r\n streamFileInputSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-23 (Relative Path Traversal). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-23\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-23\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE23_Relative_Path_Traversal/CWE23_Relative_Path_Traversal__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"c1e620cf61de32cc5ec97ee765a8fe215fff84d99d9ddd9b315735562bdc12c0\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-23\", \"target_weakness\": \"Relative Path Traversal\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-248-d7c11de6dd42", "input": "/*\r\n * @description Explicitly throw an Error that will not be caught by any code and the JVM will halt. Unfortunately the design of our test cases don't let us throw an Exception (runTest() in AbstractTestCase is not declared as throwing anything and adding a throw cascades to updates to all test case files).\r\n *\r\n * */\r\n\r\npackage testcases.CWE248_Uncaught_Exception;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE248_Uncaught_Exception__Error_01 extends AbstractTestCase \r\n{\r\n public void bad() \r\n {\r\n /* FLAW: Error not caught */\r\n throw new Error(\"Really bad Error\");\r\n }\r\n\r\n private void good1() \r\n {\r\n /* FIX: Error caught */\r\n try\r\n {\r\n throw new Error(\"Really bad Error\");\r\n }\r\n catch(Error error)\r\n {\r\n IO.logger.log(Level.WARNING, \"Caught an Error\", error);\r\n }\r\n }\r\n\r\n public void good() \r\n {\r\n good1();\r\n } \r\n\r\n /* Override runTest for this test case so that it doesn't catch the Error */\r\n public void runTest(String classname) \r\n {\r\n IO.writeLine(\"Starting tests for Class \" + classname);\r\n\r\n good(); \r\n IO.writeLine(\"Completed good() for Class \" + classname);\r\n\r\n bad();\r\n IO.writeLine(\"Completed bad() for Class \" + classname);\r\n } /* runTest */\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested. \r\n\t */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-248 (Uncaught Exception). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-248\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-248\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE248_Uncaught_Exception/CWE248_Uncaught_Exception__Error_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"d7c11de6dd42f1222fd59c0eee84aa0dd05f11a8c86cd8a8dcfe64a0e87128b7\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-248\", \"target_weakness\": \"Uncaught Exception\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-252-002390a7acc6", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE252_Unchecked_Return_Value__FileInputStream_01.java\r\nLabel Definition File: CWE252_Unchecked_Return_Value__FileInputStream.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 252 Unchecked Return Value\r\n* Sinks:\r\n* GoodSink: Check the return value from FileInputStream.read() and handle possible errors\r\n* BadSink : Do not check the return value of FileInputStream.read()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE252_Unchecked_Return_Value;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.io.FileNotFoundException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE252_Unchecked_Return_Value__FileInputStream_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n FileInputStream streamFileInput = null;\r\n\r\n try\r\n {\r\n int bytesToRead = 1024;\r\n byte[] byteArray = new byte[bytesToRead];\r\n\r\n streamFileInput = new FileInputStream(\"c:\\\\file.txt\");\r\n streamFileInput.read(byteArray);\r\n\r\n /* FLAW: Do not check the return value of read() */\r\n\r\n IO.writeLine(new String(byteArray, \"UTF-8\"));\r\n }\r\n catch(FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.logger.log(Level.WARNING, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException reading file\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if(streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n FileInputStream streamFileInput = null;\r\n\r\n try\r\n {\r\n int bytesToRead = 1024;\r\n byte[] byteArray = new byte[bytesToRead];\r\n\r\n streamFileInput = new FileInputStream(\"c:\\\\file.txt\");\r\n\r\n int numberOfBytesRead = streamFileInput.read(byteArray);\r\n\r\n /* FIX: Check the return value of read() and handle possible errors */\r\n if (numberOfBytesRead == -1)\r\n {\r\n IO.writeLine(\"The end of the file has been reached.\");\r\n }\r\n else\r\n {\r\n if (numberOfBytesRead < bytesToRead)\r\n {\r\n IO.writeLine(\"Could not read \" + bytesToRead + \" bytes.\");\r\n }\r\n else\r\n {\r\n IO.writeLine(new String(byteArray, \"UTF-8\"));\r\n }\r\n }\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.logger.log(Level.WARNING, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch(IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException reading file\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if(streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch(IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-252 (Unchecked Return Value). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-252\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-252\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE252_Unchecked_Return_Value/CWE252_Unchecked_Return_Value__FileInputStream_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"002390a7acc61da03feebc815931bedc0e696d16d73b7c177c8cf35c47f463d1\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-252\", \"target_weakness\": \"Unchecked Return Value\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-253-9e7da1f08b73", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01.java\r\nLabel Definition File: CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 253 Incorrect Check of Function Return Value\r\n* Sinks:\r\n* GoodSink: Check the return value from FileInputStream.read() and handle possible errors\r\n* BadSink : Check the return value of FileInputStream.read() for the wrong value\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE253_Incorrect_Check_of_Function_Return_Value;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\nimport java.io.FileNotFoundException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n FileInputStream fis = null;\r\n\r\n try\r\n {\r\n int bytesToRead = 1024;\r\n byte[] byteArray = new byte[bytesToRead];\r\n\r\n fis = new FileInputStream(\"c:\\\\file.txt\");\r\n\r\n /* FLAW: Incorrect check on result of read(). Should check if the return value is -1 or is less than bytesToRead. */\r\n if (fis.read(byteArray) == 0)\r\n {\r\n IO.writeLine(\"Error reading file.\");\r\n }\r\n else\r\n {\r\n IO.writeLine(new String(byteArray, \"UTF-8\"));\r\n }\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.logger.log(Level.WARNING, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException reading file\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (fis != null)\r\n {\r\n fis.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n FileInputStream fis = null;\r\n\r\n try\r\n {\r\n int bytesToRead = 1024;\r\n byte[] byteArray = new byte[bytesToRead];\r\n\r\n fis = new FileInputStream(\"c:\\\\file.txt\");\r\n\r\n int numberOfBytesRead = fis.read(byteArray);\r\n\r\n /* FIX: Check the return value of read() and handle possible errors */\r\n if (numberOfBytesRead == -1)\r\n {\r\n IO.writeLine(\"The end of the file has been reached.\");\r\n }\r\n else\r\n {\r\n if (numberOfBytesRead < bytesToRead)\r\n {\r\n IO.writeLine(\"Could not read \" + bytesToRead + \" bytes.\");\r\n }\r\n else\r\n {\r\n IO.writeLine(new String(byteArray, \"UTF-8\"));\r\n }\r\n }\r\n }\r\n catch (FileNotFoundException exceptFileNotFound)\r\n {\r\n IO.logger.log(Level.WARNING, \"FileNotFoundException opening file\", exceptFileNotFound);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException reading file\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (fis != null)\r\n {\r\n fis.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"IOException closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-253 (Incorrect Check of Function Return Value). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-253\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-253\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE253_Incorrect_Check_of_Function_Return_Value/CWE253_Incorrect_Check_of_Function_Return_Value__FileInputStream_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9e7da1f08b732b10cc3982f530baeecd877273b36365af512023752e3b6b890d\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-253\", \"target_weakness\": \"Incorrect Check of Function Return Value\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-256-211f5c24e6e9", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE256_Plaintext_Storage_of_Password__basic_01.java\r\nLabel Definition File: CWE256_Plaintext_Storage_of_Password__basic.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 256 Plaintext Storage of a Password. Read the password from a Properties file or a regular file. In the good case, read the file from the console.\r\n* BadSource: Read password from a .properties file (from the property named password)\r\n* GoodSource: Read password from a .properties file (from the property named password) and then decrypt it\r\n* Sinks:\r\n* GoodSink: Decrypt password and use decrypted password as password to connect to DB\r\n* BadSink : Use password as password to connect to DB\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE256_Plaintext_Storage_of_Password;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport javax.crypto.Cipher;\r\nimport javax.crypto.spec.SecretKeySpec;\r\n\r\nimport java.util.Properties;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\n\r\nimport java.sql.SQLException;\r\nimport java.sql.Connection;\r\nimport java.sql.DriverManager;\r\n\r\npublic class CWE256_Plaintext_Storage_of_Password__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n String password;\r\n\r\n password = \"\"; /* init password */\r\n\r\n /* retrieve the property */\r\n Properties properties = new Properties();\r\n FileInputStream streamFileInput = null;\r\n try\r\n {\r\n streamFileInput = new FileInputStream(\"../common/config.properties\");\r\n properties.load(streamFileInput);\r\n\r\n password = properties.getProperty(\"password\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n /* POTENTIAL FLAW: The raw password read from the .properties file is passed on (without being decrypted) */\r\n\r\n /* POTENTIAL FLAW: Use password as a password to connect to a DB (without being decrypted) */\r\n\r\n Connection dBConnection = null;\r\n try\r\n {\r\n dBConnection = DriverManager.getConnection(\"192.168.105.23\", \"sa\", password);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String password;\r\n\r\n password = \"\"; /* init password */\r\n\r\n /* retrieve the property */\r\n Properties properties = new Properties();\r\n\r\n FileInputStream streamFileInput = null;\r\n try\r\n {\r\n streamFileInput = new FileInputStream(\"../common/config.properties\");\r\n properties.load(streamFileInput);\r\n\r\n password = properties.getProperty(\"password\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n /* FIX: password is decrypted before being passed on */\r\n {\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n\r\n /* INCIDENTAL: CWE-321: Use of Hard-coded Cryptographic Key */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(\"ABCDEFGHABCDEFGH\".getBytes(\"UTF-8\"), \"AES\");\r\n aesCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);\r\n\r\n String decryptedPassword = new String(aesCipher.doFinal(password.getBytes(\"UTF-8\")), \"UTF-8\");\r\n password = decryptedPassword;\r\n }\r\n\r\n /* POTENTIAL FLAW: Use password as a password to connect to a DB (without being decrypted) */\r\n\r\n Connection dBConnection = null;\r\n try\r\n {\r\n dBConnection = DriverManager.getConnection(\"192.168.105.23\", \"sa\", password);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n String password;\r\n\r\n password = \"\"; /* init password */\r\n\r\n /* retrieve the property */\r\n Properties properties = new Properties();\r\n FileInputStream streamFileInput = null;\r\n try\r\n {\r\n streamFileInput = new FileInputStream(\"../common/config.properties\");\r\n properties.load(streamFileInput);\r\n\r\n password = properties.getProperty(\"password\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n /* POTENTIAL FLAW: The raw password read from the .properties file is passed on (without being decrypted) */\r\n\r\n /* FIX: password is decrypted before being used as a database password */\r\n {\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n\r\n /* INCIDENTAL: Hardcoded crypto */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(\"ABCDEFGHABCDEFGH\".getBytes(\"UTF-8\"), \"AES\");\r\n aesCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);\r\n\r\n String decryptedPassword = new String(aesCipher.doFinal(password.getBytes(\"UTF-8\")), \"UTF-8\");\r\n password = decryptedPassword;\r\n }\r\n\r\n Connection dBConnection = null;\r\n try\r\n {\r\n dBConnection = DriverManager.getConnection(\"192.168.105.23\", \"sa\", password);\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-256 (Plaintext Storage of Password). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-256\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-256\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE256_Plaintext_Storage_of_Password/CWE256_Plaintext_Storage_of_Password__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"211f5c24e6e96cd57da3390efd3b74274b2b78756de934f1bdd44b2b45ad1087\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-256\", \"target_weakness\": \"Plaintext Storage of Password\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-315-62508efbe899", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE315_Plaintext_Storage_in_Cookie__Servlet_01.java\r\nLabel Definition File: CWE315_Plaintext_Storage_in_Cookie__Servlet.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 315 Storing plaintext data in a cookie\r\n* BadSource: Set data to credentials (without hashing or encryption)\r\n* GoodSource: Set data to a hash of credentials\r\n* Sinks:\r\n* GoodSink: Hash data before storing in cookie\r\n* BadSink : Store data directly in cookie\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE315_Plaintext_Storage_in_Cookie;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.security.MessageDigest;\r\n\r\nimport java.net.PasswordAuthentication;\r\n\r\npublic class CWE315_Plaintext_Storage_in_Cookie__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n PasswordAuthentication credentials = new PasswordAuthentication(\"user\", \"BP@ssw0rd\".toCharArray());\r\n\r\n /* POTENTIAL FLAW: Set data to credentials (without hashing or encryption) */\r\n data = credentials.getUserName() + \":\" + (new String(credentials.getPassword()));\r\n\r\n /* NOTE: potential incidental issues with not setting secure or HttpOnly flag */\r\n\r\n /* POTENTIAL FLAW: Store data directly in cookie */\r\n response.addCookie(new Cookie(\"auth\", data));\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n goodB2G(request, response);\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n PasswordAuthentication credentials = new PasswordAuthentication(\"user\", \"GP@ssw0rd\".toCharArray());\r\n\r\n /* FIX: Set data to a hash of credentials */\r\n {\r\n String salt = \"ThisIsMySalt\";\r\n MessageDigest messageDigest = MessageDigest.getInstance(\"SHA-512\");\r\n messageDigest.reset();\r\n String credentialsToHash = credentials.getUserName() + \":\" + (new String(credentials.getPassword()));\r\n byte[] hashedCredsAsBytes = messageDigest.digest((salt+credentialsToHash).getBytes(\"UTF-8\"));\r\n data = IO.toHex(hashedCredsAsBytes);\r\n }\r\n\r\n /* NOTE: potential incidental issues with not setting secure or HttpOnly flag */\r\n\r\n /* POTENTIAL FLAW: Store data directly in cookie */\r\n response.addCookie(new Cookie(\"auth\", data));\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */\r\n PasswordAuthentication credentials = new PasswordAuthentication(\"user\", \"BP@ssw0rd\".toCharArray());\r\n\r\n /* POTENTIAL FLAW: Set data to credentials (without hashing or encryption) */\r\n data = credentials.getUserName() + \":\" + (new String(credentials.getPassword()));\r\n\r\n /* FIX: Hash data before storing in cookie */\r\n {\r\n String salt = \"ThisIsMySalt\";\r\n MessageDigest messageDigest = MessageDigest.getInstance(\"SHA-512\");\r\n messageDigest.reset();\r\n byte[] hashedCredsAsBytes = messageDigest.digest((salt+data).getBytes(\"UTF-8\"));\r\n data = IO.toHex(hashedCredsAsBytes);\r\n }\r\n\r\n response.addCookie(new Cookie(\"auth\", data));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-315 (Plaintext Storage in Cookie). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-315\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-315\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE315_Plaintext_Storage_in_Cookie/CWE315_Plaintext_Storage_in_Cookie__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"62508efbe8993cf2adc969eb7297cd62c60f68f4d2901b29c7be3a8bf636b08b\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-315\", \"target_weakness\": \"Plaintext Storage in Cookie\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-319-8eeba58a2147", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE319_Cleartext_Tx_Sensitive_Info__URLConnection_driverManager_01.java\r\nLabel Definition File: CWE319_Cleartext_Tx_Sensitive_Info.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 319 Cleartext Transmission of Sensitive Information\r\n* BadSource: URLConnection Read password from a web server with URLConnection\r\n* GoodSource: Set password to a hardcoded value (one that was not sent over the network)\r\n* Sinks: driverManager\r\n* GoodSink: Decrypt the password from the source before using it in database connection\r\n* BadSink : Use password directly from source in database connection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE319_Cleartext_Tx_Sensitive_Info;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.IOException;\r\nimport java.net.URL;\r\nimport java.net.URLConnection;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport java.sql.*;\r\n\r\nimport javax.crypto.Cipher;\r\n\r\nimport javax.crypto.spec.SecretKeySpec;\r\n\r\n\r\npublic class CWE319_Cleartext_Tx_Sensitive_Info__URLConnection_driverManager_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n String password;\r\n\r\n password = \"\"; /* init password */\r\n\r\n /* read input from URLConnection */\r\n {\r\n URLConnection urlConnection = (new URL(\"http://www.example.org/\")).openConnection();\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(urlConnection.getInputStream(), \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* POTENTIAL FLAW: Read password from a web server with URLConnection */\r\n /* This will be reading the first \"line\" of the response body,\r\n * which could be very long if there are no newlines in the HTML */\r\n password = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n Connection connection = null;\r\n PreparedStatement preparedStatement = null;\r\n ResultSet resultSet = null;\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in getConnection() */\r\n connection = DriverManager.getConnection(\"data-url\", \"root\", password);\r\n preparedStatement = connection.prepareStatement(\"select * from test_table\");\r\n resultSet = preparedStatement.executeQuery();\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (resultSet != null)\r\n {\r\n resultSet.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing ResultSet\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (preparedStatement != null)\r\n {\r\n preparedStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (connection != null)\r\n {\r\n connection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String password;\r\n\r\n /* FIX: Use a hardcoded password as the password (it was not sent over the network) */\r\n /* INCIDENTAL FLAW: CWE-259 Hard Coded Password */\r\n password = \"Password1234!\";\r\n\r\n Connection connection = null;\r\n PreparedStatement preparedStatement = null;\r\n ResultSet resultSet = null;\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in getConnection() */\r\n connection = DriverManager.getConnection(\"data-url\", \"root\", password);\r\n preparedStatement = connection.prepareStatement(\"select * from test_table\");\r\n resultSet = preparedStatement.executeQuery();\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (resultSet != null)\r\n {\r\n resultSet.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing ResultSet\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (preparedStatement != null)\r\n {\r\n preparedStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (connection != null)\r\n {\r\n connection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n String password;\r\n\r\n password = \"\"; /* init password */\r\n\r\n /* read input from URLConnection */\r\n {\r\n URLConnection urlConnection = (new URL(\"http://www.example.org/\")).openConnection();\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(urlConnection.getInputStream(), \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* POTENTIAL FLAW: Read password from a web server with URLConnection */\r\n /* This will be reading the first \"line\" of the response body,\r\n * which could be very long if there are no newlines in the HTML */\r\n password = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* clean up stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if (password != null)\r\n {\r\n /* FIX: Decrypt password before using in getConnection() */\r\n {\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n /* INCIDENTAL: CWE-321: Use of Hard-coded Cryptographic Key */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(\"ABCDEFGHABCDEFGH\".getBytes(\"UTF-8\"), \"AES\");\r\n aesCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);\r\n password = new String(aesCipher.doFinal(password.getBytes(\"UTF-8\")), \"UTF-8\");\r\n }\r\n Connection connection = null;\r\n PreparedStatement preparedStatement = null;\r\n ResultSet resultSet = null;\r\n try\r\n {\r\n /* POTENTIAL FLAW: use password directly in getConnection() */\r\n connection = DriverManager.getConnection(\"data-url\", \"root\", password);\r\n preparedStatement = connection.prepareStatement(\"select * from test_table\");\r\n resultSet = preparedStatement.executeQuery();\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (resultSet != null)\r\n {\r\n resultSet.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing ResultSet\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (preparedStatement != null)\r\n {\r\n preparedStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (connection != null)\r\n {\r\n connection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-319 (Cleartext Tx Sensitive Info). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-319\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-319\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE319_Cleartext_Tx_Sensitive_Info/CWE319_Cleartext_Tx_Sensitive_Info__URLConnection_driverManager_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8eeba58a21475bf393e3d02b96b5d7dc1774af7dd55f21dff6ab131f33d936ab\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-319\", \"target_weakness\": \"Cleartext Tx Sensitive Info\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-321-f067d17ecade", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE321_Hard_Coded_Cryptographic_Key__basic_01.java\r\nLabel Definition File: CWE321_Hard_Coded_Cryptographic_Key__basic.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 321 Hard coded crypto key\r\n* BadSource: Set data to a hardcoded value\r\n* GoodSource: Read data from the console using readLine()\r\n* BadSink: Use data as a cryptographic key\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE321_Hard_Coded_Cryptographic_Key;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.InputStreamReader;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport javax.crypto.spec.SecretKeySpec;\r\nimport javax.crypto.Cipher;\r\n\r\npublic class CWE321_Hard_Coded_Cryptographic_Key__basic_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FLAW: Set data to a hardcoded value */\r\n data = \"23 ~j;asn!@#/>as\";\r\n\r\n if (data != null)\r\n {\r\n String stringToEncrypt = \"Super secret Squirrel\";\r\n byte[] byteStringToEncrypt = stringToEncrypt.getBytes(\"UTF-8\");\r\n /* POTENTIAL FLAW: Use data as a cryptographic key */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(data.getBytes(\"UTF-8\"), \"AES\");\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n byte[] byteCipherText = aesCipher.doFinal(byteStringToEncrypt);\r\n IO.writeLine(IO.toHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n data = \"\"; /* Initialize data */\r\n\r\n /* read user input from console with readLine */\r\n try\r\n {\r\n InputStreamReader readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n BufferedReader readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* FIX: Read data from the console using readLine() */\r\n data = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n /* NOTE: Tools may report a flaw here because readerBuffered and readerInputStream are not closed. Unfortunately, closing those will close System.in, which will cause any future attempts to read from the console to fail and throw an exception */\r\n\r\n if (data != null)\r\n {\r\n String stringToEncrypt = \"Super secret Squirrel\";\r\n byte[] byteStringToEncrypt = stringToEncrypt.getBytes(\"UTF-8\");\r\n /* POTENTIAL FLAW: Use data as a cryptographic key */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(data.getBytes(\"UTF-8\"), \"AES\");\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n byte[] byteCipherText = aesCipher.doFinal(byteStringToEncrypt);\r\n IO.writeLine(IO.toHex(byteCipherText)); /* Write encrypted data to console */\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-321 (Hard Coded Cryptographic Key). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-321\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-321\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE321_Hard_Coded_Cryptographic_Key/CWE321_Hard_Coded_Cryptographic_Key__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f067d17ecaded0c201c123b038ff83ca6dc88869a70114928c9fa18b20dce224\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-321\", \"target_weakness\": \"Hard Coded Cryptographic Key\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-325-4278b2879c59", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE325_Missing_Required_Cryptographic_Step__KeyGenerator_init_01.java\r\nLabel Definition File: CWE325_Missing_Required_Cryptographic_Step.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 325 Missing Required Cryptographic Step\r\n* Sinks: KeyGenerator_init\r\n* GoodSink: Include call to KeyGenerator.init()\r\n* BadSink : Missing call to KeyGenerator.init()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE325_Missing_Required_Cryptographic_Step;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.crypto.Cipher;\r\nimport javax.crypto.KeyGenerator;\r\nimport javax.crypto.SecretKey;\r\nimport javax.crypto.spec.SecretKeySpec;\r\n\r\npublic class CWE325_Missing_Required_Cryptographic_Step__KeyGenerator_init_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n final String CIPHER_INPUT = \"ABCDEFG123456\";\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"AES\");\r\n\r\n /* FLAW: Skip initialization of KeyGenerator (like 'keyGenerator.init(128);')\r\n * According to the KeyGenerator JavaDoc: \"In case the client does not explicitly\r\n * initialize the KeyGenerator (via a call to an init method), each provider must\r\n * supply (and document) a default initialization.\" This means that the cryptographic\r\n * provider will decide what length the key will be (128, 192, or 256 bits for AES)\r\n * which may cause a smaller key than desired to be used and may cause interoperability\r\n * issues when different providers are used.\r\n */\r\n\r\n SecretKey secretKey = keyGenerator.generateKey();\r\n byte[] byteKey = secretKey.getEncoded();\r\n\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, \"AES\");\r\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n\r\n byte[] encrypted = aesCipher.doFinal(CIPHER_INPUT.getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(encrypted));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n final String CIPHER_INPUT = \"ABCDEFG123456\";\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"AES\");\r\n\r\n /* FIX: Perform initialization of KeyGenerator */\r\n keyGenerator.init(256);\r\n\r\n SecretKey secretKey = keyGenerator.generateKey();\r\n byte[] byteKey = secretKey.getEncoded();\r\n\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, \"AES\");\r\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n\r\n byte[] encrypted = aesCipher.doFinal(CIPHER_INPUT.getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(encrypted));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-325 (Missing Required Cryptographic Step). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-325\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-325\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE325_Missing_Required_Cryptographic_Step/CWE325_Missing_Required_Cryptographic_Step__KeyGenerator_init_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4278b2879c59cd5fa56a116754b59d3f1ce28387a42eddfd9de0df16e1312993\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-325\", \"target_weakness\": \"Missing Required Cryptographic Step\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-327-bc558ae00f1a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE327_Use_Broken_Crypto__3DES_01.java\r\nLabel Definition File: CWE327_Use_Broken_Crypto.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 327 Use of Broken or Risky Cryptographic Algorithm\r\n* Sinks: 3DES\r\n* GoodSink: use AES\r\n* BadSink : use 3DES\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE327_Use_Broken_Crypto;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.crypto.Cipher;\r\nimport javax.crypto.KeyGenerator;\r\nimport javax.crypto.SecretKey;\r\nimport javax.crypto.spec.SecretKeySpec;\r\n\r\npublic class CWE327_Use_Broken_Crypto__3DES_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n final String CIPHER_INPUT = \"ABCDEFG123456\";\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"DESede\");\r\n\r\n /* Perform initialization of KeyGenerator */\r\n keyGenerator.init(112);\r\n\r\n SecretKey secretKey = keyGenerator.generateKey();\r\n byte[] byteKey = secretKey.getEncoded();\r\n\r\n /* FLAW: Use a weak crypto algorithm, 3DES */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, \"DESede\");\r\n\r\n Cipher tripleDesCipher = Cipher.getInstance(\"DESede\");\r\n tripleDesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n\r\n byte[] encrypted = tripleDesCipher.doFinal(CIPHER_INPUT.getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(encrypted));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n final String CIPHER_INPUT = \"ABCDEFG123456\";\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"AES\");\r\n\r\n /* Perform initialization of KeyGenerator */\r\n keyGenerator.init(128);\r\n\r\n SecretKey secretKey = keyGenerator.generateKey();\r\n byte[] byteKey = secretKey.getEncoded();\r\n\r\n /* FIX: Use a stronger crypto algorithm, AES */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, \"AES\");\r\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n aesCipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);\r\n\r\n byte[] encrypted = aesCipher.doFinal(CIPHER_INPUT.getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(encrypted));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-327 (Use Broken Crypto). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-327\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-327\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE327_Use_Broken_Crypto/CWE327_Use_Broken_Crypto__3DES_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"bc558ae00f1a6597a62dd581b49f5782b2c3da58a411032e0ae37a9785612cdc\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-327\", \"target_weakness\": \"Use Broken Crypto\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-328-0d4f0822188c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE328_Reversible_One_Way_Hash__MD2_01.java\r\nLabel Definition File: CWE328_Reversible_One_Way_Hash.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 328 Reversible One Way Hash\r\n* Sinks: MD2\r\n* GoodSink: SHA512\r\n* BadSink : MD2\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE328_Reversible_One_Way_Hash;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.MessageDigest;\r\n\r\npublic class CWE328_Reversible_One_Way_Hash__MD2_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n String input = \"Test Input\";\r\n\r\n /* FLAW: Insecure cryptographic hashing algorithm (MD2) */\r\n MessageDigest messageDigest = MessageDigest.getInstance(\"MD2\");\r\n byte[] hashValue = messageDigest.digest(input.getBytes(\"UTF-8\")); /* INCIDENTAL FLAW: Hard-coded input to hash algorithm */\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n String input = \"Test Input\";\r\n\r\n /* FIX: Secure cryptographic hashing algorithm (SHA-512) */\r\n MessageDigest messageDigest = MessageDigest.getInstance(\"SHA-512\");\r\n byte[] hashValue = messageDigest.digest(input.getBytes(\"UTF-8\")); /* INCIDENTAL FLAW: Hard-coded input to hash algorithm */\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-328 (Reversible One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-328\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-328\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE328_Reversible_One_Way_Hash/CWE328_Reversible_One_Way_Hash__MD2_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0d4f0822188cfbd1cf0789f0ef7bfceb546c14f9caad1a7457de5dede5b4b030\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-328\", \"target_weakness\": \"Reversible One Way Hash\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-329-7118f461d93f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01.java\r\nLabel Definition File: CWE329_Not_Using_Random_IV_with_CBC_Mode__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 329 Not using random IV with CBC Mode\r\n* Sinks:\r\n* GoodSink: use random iv\r\n* BadSink : use hardcoded iv\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE329_Not_Using_Random_IV_with_CBC_Mode;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\nimport java.io.*;\r\nimport javax.crypto.Cipher;\r\nimport javax.crypto.KeyGenerator;\r\nimport javax.crypto.SecretKey;\r\nimport javax.crypto.spec.IvParameterSpec;\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n byte[] text = \"asdf\".getBytes(\"UTF-8\");\r\n byte[] initializationVector =\r\n {\r\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r\n 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r\n };\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"AES\");\r\n keyGenerator.init(128);\r\n SecretKey key = keyGenerator.generateKey();\r\n\r\n /* FLAW: hardcoded initialization vector used */\r\n Cipher cipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\r\n IvParameterSpec ivParameterSpec = new IvParameterSpec(initializationVector);\r\n\r\n cipher.init(Cipher.ENCRYPT_MODE, key, ivParameterSpec);\r\n\r\n IO.writeLine(IO.toHex(cipher.doFinal(text)));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n byte[] text = \"asdf\".getBytes(\"UTF-8\");\r\n\r\n KeyGenerator keyGenerator = KeyGenerator.getInstance(\"AES\");\r\n keyGenerator.init(128);\r\n SecretKey key = keyGenerator.generateKey();\r\n\r\n Cipher cipher = Cipher.getInstance(\"AES/CBC/PKCS5Padding\");\r\n\r\n int blockSize = cipher.getBlockSize();\r\n byte[] initializationVector = new byte[blockSize];\r\n SecureRandom secureRandom = new SecureRandom();\r\n secureRandom.nextBytes(initializationVector);\r\n\r\n /* FIX: using cryptographically secure pseudo-random number as initialization vector */\r\n IvParameterSpec ivParameterSpec = new IvParameterSpec(initializationVector);\r\n\r\n cipher.init(Cipher.ENCRYPT_MODE, key, ivParameterSpec);\r\n\r\n IO.writeLine(IO.toHex(cipher.doFinal(text)));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-329 (Not Using Random IV with CBC Mode). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-329\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-329\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE329_Not_Using_Random_IV_with_CBC_Mode/CWE329_Not_Using_Random_IV_with_CBC_Mode__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7118f461d93f5b95501998024349e1cfc63894a406c6147bc8a7d6cf9ffe54f7\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-329\", \"target_weakness\": \"Not Using Random IV with CBC Mode\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-336-30e55d47c03e", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE336_Same_Seed_in_PRNG__basic_01.java\r\nLabel Definition File: CWE336_Same_Seed_in_PRNG__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 336 Same Seed in PRNG\r\n* Sinks:\r\n* GoodSink: no explicit seed specified\r\n* BadSink : hardcoded seed\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE336_Same_Seed_in_PRNG;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE336_Same_Seed_in_PRNG__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n final byte[] SEED = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05};\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n /* FLAW: using the same seed can make the PRNG sequence predictable if the seed is known */\r\n secureRandom.setSeed(SEED);\r\n\r\n IO.writeLine(\"\" + secureRandom.nextInt()); /* run this several times and notice that the bad values are always the same */\r\n IO.writeLine(\"\" + secureRandom.nextInt());\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n /* FIX: no explicit seed specified; produces far less predictable PRNG sequence */\r\n\r\n IO.writeLine(\"\" + secureRandom.nextInt());\r\n IO.writeLine(\"\" + secureRandom.nextInt());\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-336 (Same Seed in PRNG). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-336\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-336\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE336_Same_Seed_in_PRNG/CWE336_Same_Seed_in_PRNG__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"30e55d47c03e98fe201e6f5ca733754813750433a20f94e0575439e010e6356c\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-336\", \"target_weakness\": \"Same Seed in PRNG\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-338-4c84d78cdc3f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE338_Weak_PRNG__math_01.java\r\nLabel Definition File: CWE338_Weak_PRNG.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 338 Use of Cryptographically Weak PRNG\r\n* Sinks: math\r\n* GoodSink: stronger PRNG\r\n* BadSink : weak PRNG\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE338_Weak_PRNG;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE338_Weak_PRNG__math_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n /* FLAW: Math.random() is a known weak PRNG */\r\n IO.writeLine(\"\" + Math.random());\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n /* FIX: java.security.SecureRandom is considered to be a strong PRNG */\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n IO.writeLine(\"\" + secureRandom.nextDouble());\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-338 (Weak PRNG). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-338\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-338\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE338_Weak_PRNG/CWE338_Weak_PRNG__math_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4c84d78cdc3ff4abdf5624fee1e3907adf35c21455b045d7c749361e8e9714b3\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-338\", \"target_weakness\": \"Weak PRNG\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-36-4f94f92b762d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE36_Absolute_Path_Traversal__Environment_01.java\r\nLabel Definition File: CWE36_Absolute_Path_Traversal.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 36 Absolute Path Traversal\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* BadSink: readFile read line from file from disk\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE36_Absolute_Path_Traversal;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.*;\r\nimport javax.servlet.http.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE36_Absolute_Path_Traversal__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n /* POTENTIAL FLAW: unvalidated or sandboxed value */\r\n if (data != null)\r\n {\r\n File file = new File(data);\r\n FileInputStream streamFileInputSink = null;\r\n InputStreamReader readerInputStreamSink = null;\r\n BufferedReader readerBufferdSink = null;\r\n if (file.exists() && file.isFile())\r\n {\r\n try\r\n {\r\n streamFileInputSink = new FileInputStream(file);\r\n readerInputStreamSink = new InputStreamReader(streamFileInputSink, \"UTF-8\");\r\n readerBufferdSink = new BufferedReader(readerInputStreamSink);\r\n IO.writeLine(readerBufferdSink.readLine());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBufferdSink != null)\r\n {\r\n readerBufferdSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStreamSink != null)\r\n {\r\n readerInputStreamSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInputSink != null)\r\n {\r\n streamFileInputSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n /* POTENTIAL FLAW: unvalidated or sandboxed value */\r\n if (data != null)\r\n {\r\n File file = new File(data);\r\n FileInputStream streamFileInputSink = null;\r\n InputStreamReader readerInputStreamSink = null;\r\n BufferedReader readerBufferdSink = null;\r\n if (file.exists() && file.isFile())\r\n {\r\n try\r\n {\r\n streamFileInputSink = new FileInputStream(file);\r\n readerInputStreamSink = new InputStreamReader(streamFileInputSink, \"UTF-8\");\r\n readerBufferdSink = new BufferedReader(readerInputStreamSink);\r\n IO.writeLine(readerBufferdSink.readLine());\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBufferdSink != null)\r\n {\r\n readerBufferdSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStreamSink != null)\r\n {\r\n readerInputStreamSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInputSink != null)\r\n {\r\n streamFileInputSink.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-36 (Absolute Path Traversal). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-36\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-36\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE36_Absolute_Path_Traversal/CWE36_Absolute_Path_Traversal__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4f94f92b762d2e9f1ec99f5c6c9211d244fb2b56f555ac73110ccdd11461028f\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-36\", \"target_weakness\": \"Absolute Path Traversal\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-369-85eccd0689fb", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE369_Divide_by_Zero__float_Environment_divide_01.java\r\nLabel Definition File: CWE369_Divide_by_Zero__float.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 369 Divide by zero\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero number (two)\r\n* Sinks: divide\r\n* GoodSink: Check for zero before dividing\r\n* BadSink : Dividing by a value that may be zero\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE369_Divide_by_Zero.s01;\r\nimport testcasesupport.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE369_Divide_by_Zero__float_Environment_divide_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n float data;\r\n\r\n data = -1.0f; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null)\r\n {\r\n try\r\n {\r\n data = Float.parseFloat(stringNumber.trim());\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n /* POTENTIAL FLAW: Possibly divide by zero */\r\n int result = (int)(100.0 / data);\r\n IO.writeLine(result);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n float data;\r\n\r\n /* FIX: Use a hardcoded number that won't a divide by zero */\r\n data = 2.0f;\r\n\r\n /* POTENTIAL FLAW: Possibly divide by zero */\r\n int result = (int)(100.0 / data);\r\n IO.writeLine(result);\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n float data;\r\n\r\n data = -1.0f; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null)\r\n {\r\n try\r\n {\r\n data = Float.parseFloat(stringNumber.trim());\r\n }\r\n catch (NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n /* FIX: Check for value of or near zero before dividing */\r\n if (Math.abs(data) > 0.000001)\r\n {\r\n int result = (int)(100.0 / data);\r\n IO.writeLine(result);\r\n }\r\n else\r\n {\r\n IO.writeLine(\"This would result in a divide by zero\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-369 (Divide by Zero). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-369\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-369\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE369_Divide_by_Zero/s01/CWE369_Divide_by_Zero__float_Environment_divide_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"85eccd0689fb79120532cedeeda4fea939015d6ddb473dea8a781e54bd6894f7\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-369\", \"target_weakness\": \"Divide by Zero\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-379-8cc8f762f039", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01.java\r\nLabel Definition File: CWE379_Temporary_File_Creation_in_Insecure_Dir__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 379 File Creation in Insecure Directory\r\n* Sinks:\r\n* GoodSink: Restrict permissions on directory\r\n* BadSink : Permissions never set on directory\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE379_Temporary_File_Creation_in_Insecure_Dir;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.FileOutputStream;\r\nimport java.io.OutputStreamWriter;\r\nimport java.io.BufferedWriter;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n FileOutputStream streamFileOutput = null;\r\n OutputStreamWriter writerOutputStream = null;\r\n BufferedWriter writerBuffered = null;\r\n File tempFile = null;\r\n\r\n String directoryName;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n directoryName = \"C:\\\\testcases\\\\insecureDir\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n directoryName = \"/home/user/testcases/insecureDir/\";\r\n }\r\n\r\n try\r\n {\r\n File newDirectory = new File(directoryName);\r\n\r\n /* FLAW: Permissions never set on directory */\r\n\r\n boolean isSuccessful = newDirectory.mkdir();\r\n if (isSuccessful)\r\n {\r\n IO.writeLine(\"Directory created\");\r\n tempFile = File.createTempFile(\"temp\", \"1234\", newDirectory);\r\n /* Set file as writable by owner, readable by owner, not executable (if file system supports it) */\r\n if (!tempFile.setWritable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Writable permissions\");\r\n }\r\n if (!tempFile.setReadable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Readable permissions\");\r\n }\r\n if (!tempFile.setExecutable(false))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Executable permissions\");\r\n }\r\n /* Write something to the file */\r\n streamFileOutput = new FileOutputStream(tempFile);\r\n writerOutputStream = new OutputStreamWriter(streamFileOutput, \"UTF-8\");\r\n writerBuffered = new BufferedWriter(writerOutputStream);\r\n writerBuffered.write(42);\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error writing to temporary file\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Delete the temporary file */\r\n if (tempFile.exists())\r\n {\r\n tempFile.delete();\r\n }\r\n\r\n try\r\n {\r\n if (writerBuffered != null)\r\n {\r\n writerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedWriter\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (writerOutputStream != null)\r\n {\r\n writerOutputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing OutputStreamWriter\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileOutput != null)\r\n {\r\n streamFileOutput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileOutputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n FileOutputStream streamFileOutput = null;\r\n OutputStreamWriter writerOutputStream = null;\r\n BufferedWriter writerBuffered = null;\r\n File tempFile = null;\r\n\r\n String directoryName;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n directoryName = \".\\\\src\\\\testcases\\\\CWE379_File_Creation_in_Insecure_Dir\\\\secureDir\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n directoryName = \"/home/user/testcases/CWE379_File_Creation_in_Insecure_Dir/secureDir/\";\r\n }\r\n\r\n try\r\n {\r\n File newDirectory = new File(directoryName);\r\n\r\n /* FIX: Set newDirectory as writable by owner, readable by owner, not executable (if file system supports it) */\r\n if (!newDirectory.setWritable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Writable permissions\");\r\n }\r\n if (!newDirectory.setReadable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Readable permissions\");\r\n }\r\n if (!newDirectory.setExecutable(false))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Executable permissions\");\r\n }\r\n\r\n boolean isSuccessful = newDirectory.mkdir();\r\n if (isSuccessful)\r\n {\r\n IO.writeLine(\"Directory created\");\r\n tempFile = File.createTempFile(\"temp\", \"1234\", newDirectory);\r\n /* Set file as writable by owner, readable by owner, not executable (if file system supports it) */\r\n if (!tempFile.setWritable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Writable permissions\");\r\n }\r\n if (!tempFile.setReadable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Readable permissions\");\r\n }\r\n if (!tempFile.setExecutable(false))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Executable permissions\");\r\n }\r\n /* Write something to the file */\r\n streamFileOutput = new FileOutputStream(tempFile);\r\n writerOutputStream = new OutputStreamWriter(streamFileOutput, \"UTF-8\");\r\n writerBuffered = new BufferedWriter(writerOutputStream);\r\n writerBuffered.write(42);\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error writing to temporary file\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Delete the temporary file */\r\n if (tempFile.exists())\r\n {\r\n tempFile.delete();\r\n }\r\n\r\n try\r\n {\r\n if (writerBuffered != null)\r\n {\r\n writerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedWriter\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (writerOutputStream != null)\r\n {\r\n writerOutputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing OutputStreamWriter\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileOutput != null)\r\n {\r\n streamFileOutput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileOutputStream\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-379 (Temporary File Creation in Insecure Dir). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-379\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-379\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE379_Temporary_File_Creation_in_Insecure_Dir/CWE379_Temporary_File_Creation_in_Insecure_Dir__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8cc8f762f0391749047e2abc1bb63be0c2c4d7116d53dedca9f7d6ffbc062099\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-379\", \"target_weakness\": \"Temporary File Creation in Insecure Dir\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-382-a042688da4c4", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE382_Use_of_System_Exit__Servlet_Runtime_01.java\r\nLabel Definition File: CWE382_Use_of_System_Exit__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 382 Use of System.exit()\r\n* Sinks: Runtime\r\n* GoodSink: notify user, do not use Runtime.getRuntime.exit\r\n* BadSink : calling Runtime.getRuntime.exit, breaching best practices\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE382_Use_of_System_Exit;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE382_Use_of_System_Exit__Servlet_Runtime_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FLAW: use of Runtime.getRuntime.exit */\r\n Runtime.getRuntime().exit(1);\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FIX: fail safe */\r\n response.getWriter().write(\"You cannot shut down this application, only the admin can\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-382 (Use of System Exit). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-382\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-382\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE382_Use_of_System_Exit/CWE382_Use_of_System_Exit__Servlet_Runtime_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a042688da4c49eb9f38e06d61d875e67934d58c486595ae5dab4b2b8031a6259\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-382\", \"target_weakness\": \"Use of System Exit\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-390-63da2c1ae24d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE390_Error_Without_Action__mkdirs_01.java\r\nLabel Definition File: CWE390_Error_Without_Action.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 390 Detection of Error Condition Without Action\r\n* Sinks: mkdirs\r\n* GoodSink: Throw Exception if newDirectory cannot be created\r\n* BadSink : Do nothing if newDirectory cannot be created\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE390_Error_Without_Action;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.File;\r\n\r\npublic class CWE390_Error_Without_Action__mkdirs_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n File newDirectory = null;\r\n\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n newDirectory = new File(\"C:\\\\lvl_1\\\\lvl_2\\\\lvl_3\\\\\");\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n newDirectory = new File(\"/home/user/lvl_1/lvl_2/lvl_3/\");\r\n }\r\n\r\n if (!newDirectory.mkdirs())\r\n {\r\n /* FLAW: do nothing if newDirectory cannot be created */\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n File newDirectory = null;\r\n\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n newDirectory = new File(\"C:\\\\lvl_1\\\\lvl_2\\\\lvl_3\\\\\");\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n newDirectory = new File(\"/home/user/lvl_1/lvl_2/lvl_3/\");\r\n }\r\n\r\n if (!newDirectory.mkdirs())\r\n {\r\n /* FIX: report the mkdirs failure and throw a new Exception */\r\n IO.writeLine(\"The directories could not be created\");\r\n StringBuilder errorString = new StringBuilder();\r\n errorString.append(\"The directories (\");\r\n errorString.append(newDirectory.getAbsolutePath());\r\n errorString.append(\") could not be created: \");\r\n throw new Exception(errorString.toString());\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-390 (Error Without Action). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-390\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-390\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE390_Error_Without_Action/CWE390_Error_Without_Action__mkdirs_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"63da2c1ae24ddca1185e00eb5b0542a8f5f3849987702ced04a81261da7dc0fe\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-390\", \"target_weakness\": \"Error Without Action\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-395-4bd1eaf8ca33", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE395_Catch_NullPointerException__basic_01.java\r\nLabel Definition File: CWE395_Catch_NullPointerException__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 395 Use of NullPointerException Catch to Detect NULL Pointer Dereference\r\n* Sinks:\r\n* GoodSink: Check for null before taking action\r\n* BadSink : Catch NullPointerException to detect null\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE395_Catch_NullPointerException;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE395_Catch_NullPointerException__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n String systemProperty = System.getProperty(\"CWE395\");\r\n\r\n try\r\n {\r\n /* INCIDENTAL: Possible Null Pointer Dereference (CWE476 / CWE690) */\r\n if(systemProperty.equals(\"CWE395\"))\r\n {\r\n IO.writeLine(\"systemProperty is CWE395\");\r\n }\r\n }\r\n catch (NullPointerException exceptNullPointer) /* FLAW: Use of catch block to detect null dereferences */\r\n {\r\n IO.writeLine(\"systemProperty is null\");\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n String systemProperty = System.getProperty(\"CWE395\");\r\n\r\n if (systemProperty != null) /* FIX: Check for null before calling equals() */\r\n {\r\n if (systemProperty.equals(\"CWE395\"))\r\n {\r\n IO.writeLine(\"systemProperty is CWE395\");\r\n }\r\n }\r\n else\r\n {\r\n IO.writeLine(\"systemProperty is null\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-395 (Catch NullPointerException). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-395\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-395\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE395_Catch_NullPointerException/CWE395_Catch_NullPointerException__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4bd1eaf8ca330de9ebedf2c664d370ae84ace74d41d7ad2d6614fc9c51f97951\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-395\", \"target_weakness\": \"Catch NullPointerException\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-396-2b84b66fdf79", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE396_Catch_Generic_Exception__Exception_01.java\r\nLabel Definition File: CWE396_Catch_Generic_Exception.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 396 An overly broad catch statement may cause errors in program execution if unexpected exceptions are thrown\r\n* Sinks: Exception\r\n* GoodSink: Catch specific exception type (NumberFormatException)\r\n* BadSink : Catch Exception, which is overly generic\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE396_Catch_Generic_Exception;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE396_Catch_Generic_Exception__Exception_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n Integer.parseInt(\"Test\"); /* Will throw NumberFormatException */\r\n }\r\n catch (Exception exception) /* FLAW: Catch Exception, which is overly generic */\r\n {\r\n IO.writeLine(\"Caught Exception\");\r\n throw exception; /* Rethrow */\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n Integer.parseInt(\"Test\"); /* Will throw NumberFormatException */\r\n }\r\n catch (NumberFormatException exceptNumberFormat) /* FIX: Catch NumberFormatException */\r\n {\r\n IO.writeLine(\"Caught Exception\");\r\n throw exceptNumberFormat; /* Rethrow */\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-396 (Catch Generic Exception). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-396\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-396\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE396_Catch_Generic_Exception/CWE396_Catch_Generic_Exception__Exception_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2b84b66fdf793435bffc9c3082bc10eb6f64f6fa15640eabbfffa63d91cc6458\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-396\", \"target_weakness\": \"Catch Generic Exception\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-397-7b3dc98d2e4a", "input": "/*\r\n * @description Declare that the function throws \"Exception\" rather than a specific exception. In this test case, we don't necessarily throw an exception to differentiate it from other test cases.\r\n *\r\n * */\r\n\r\npackage testcases.CWE397_Throw_Generic;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\nimport java.io.FileNotFoundException;\r\nimport java.io.IOException;\r\nimport java.io.FileInputStream;\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE397_Throw_Generic__declare_Exception_01 extends AbstractTestCase \r\n{\r\n public void bad() throws Exception /* FLAW: Method is declared as throwing Exception, which is very generic */ \r\n {\r\n FileInputStream streamFileInput = new FileInputStream(\"filename.txt\"); /* May throw a FileNotFoundException */\r\n IO.writeLine(\"File 'filename.txt' exists\");\r\n \r\n try \r\n {\r\n streamFileInput.close();\r\n } \r\n catch (IOException exceptIO) \r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n private void good1() throws FileNotFoundException /* FIX: Declare that method throws a specific exception */\r\n {\r\n FileInputStream streamFileInput = new FileInputStream(\"filename.txt\"); /* May throw a FileNotFoundException */\r\n IO.writeLine(\"File 'filename.txt' exists\");\r\n \r\n try \r\n {\r\n streamFileInput.close();\r\n } \r\n catch (IOException exceptIO) \r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n\r\n public void good() throws FileNotFoundException\r\n {\r\n good1();\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested. \r\n\t */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-397 (Throw Generic). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-397\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-397\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE397_Throw_Generic/CWE397_Throw_Generic__declare_Exception_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7b3dc98d2e4a444177c42488891d60c7871c446094d9b4603bea7aecc8fe88b3\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-397\", \"target_weakness\": \"Throw Generic\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-398-1a564e2c697a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE398_Poor_Code_Quality__empty_block_01.java\r\nLabel Definition File: CWE398_Poor_Code_Quality.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 398 Indicator of Poor Code Quality\r\n* Sinks: empty_block\r\n* GoodSink: Include some code inside a block\r\n* BadSink : An empty code block has no effect\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE398_Poor_Code_Quality;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE398_Poor_Code_Quality__empty_block_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n /* FLAW: The empty block on the next line has no effect */\r\n {\r\n\r\n }\r\n\r\n IO.writeLine(\"Hello from bad()\");\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n /* FIX: Include some code inside the block */\r\n {\r\n String sentence = \"Inside the block\"; /* Define a variable to justify having a block for scoping */\r\n IO.writeLine(sentence);\r\n }\r\n\r\n IO.writeLine(\"Hello from good()\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-398 (Poor Code Quality). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-398\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-398\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE398_Poor_Code_Quality/CWE398_Poor_Code_Quality__empty_block_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1a564e2c697a3aac27bb9304b52e502f2ff74a3a1d1b674c09ac4369702e1ba7\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-398\", \"target_weakness\": \"Poor Code Quality\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-404-0f66d987eb87", "input": "/*\r\n * @description Improper Resource Shutdown. Performs some, but not all, necessary resource cleanup (FileReader is not closed properly).\r\n * \r\n * */\r\n\r\npackage testcases.CWE404_Improper_Resource_Shutdown;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.File;\r\nimport java.io.FileReader;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\n\r\npublic class CWE404_Improper_Resource_Shutdown__FileReader_01 extends AbstractTestCase \r\n{ \r\n public void bad() \r\n {\r\n BufferedReader readerBuffered = null;\r\n FileReader readerFile = null;\r\n \r\n try\r\n {\r\n File file = new File(\"C:\\\\file.txt\");\r\n readerFile = new FileReader(file);\r\n readerBuffered = new BufferedReader(readerFile);\r\n String readString = readerBuffered.readLine();\r\n \r\n IO.writeLine(readString);\r\n\r\n /* FLAW: Attempts to close the streams should be in a finally block. */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n \r\n try \r\n {\r\n if (readerFile != null)\r\n {\r\n readerFile.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileReader\", exceptIO);\r\n } \r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n }\r\n \r\n private void good1() \r\n { \r\n BufferedReader readerBuffered = null;\r\n FileReader readerFile = null;\r\n \r\n try\r\n {\r\n File file = new File(\"c:\\\\file.txt\");\r\n readerFile = new FileReader(file);\r\n readerBuffered = new BufferedReader(readerFile);\r\n String readString = readerBuffered.readLine();\r\n \r\n IO.writeLine(readString);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n /* FIX: Streams closed appropriately */\r\n finally\r\n {\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n \r\n try \r\n {\r\n if (readerFile != null) \r\n {\r\n readerFile.close();\r\n }\r\n }\r\n catch (IOException exceptIO) \r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileReader\", exceptIO);\r\n }\r\n }\r\n }\r\n \r\n public void good() \r\n {\r\n good1();\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on \r\n * its own for testing or for building a binary to use in testing binary \r\n * analysis tools. It is not used when compiling all the testcases as one \r\n * application, which is how source code analysis tools are tested. \r\n\t */ \r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException \r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-404 (Improper Resource Shutdown). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-404\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-404\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE404_Improper_Resource_Shutdown/CWE404_Improper_Resource_Shutdown__FileReader_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0f66d987eb8767da5e2b1ab855ad442f8f4d0439ff7dbc9c8ec50c6e92d02add\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-404\", \"target_weakness\": \"Improper Resource Shutdown\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-459-5a4887ccafa4", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE459_Incomplete_Cleanup__Servlet_temp_file_01.java\r\nLabel Definition File: CWE459_Incomplete_Cleanup.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 459 Incomplete Cleanup\r\n* Sinks: Servlet_temp_file\r\n* GoodSink: Delete the temporary file manually\r\n* BadSink : Use .deleteOnExit() to delete the temp file, potentially leaving the file in existence for a long time\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE459_Incomplete_Cleanup;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE459_Incomplete_Cleanup__Servlet_temp_file_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n File tempFile = null;\r\n\r\n try\r\n {\r\n tempFile = File.createTempFile(\"temp\", \"1234\");\r\n\r\n /* FLAW: Delete the temp file by using .deleteOnExit(). Using this method to delete\r\n * the file for a Servlet can keep the file in existence for a long time as it will not\r\n * be deleted until the JVM is shut down. */\r\n tempFile.deleteOnExit();\r\n\r\n /* Set the permissions to avoid insecure temporary file incidentals */\r\n if (!tempFile.setWritable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Writable permissions\");\r\n }\r\n if (!tempFile.setReadable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Readable permissions\");\r\n }\r\n if (!tempFile.setExecutable(false))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Executable permissions\");\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not create temporary file\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n File tempFile = null;\r\n\r\n try\r\n {\r\n tempFile = File.createTempFile(\"temp\", \"1234\");\r\n\r\n /* Set the permissions to avoid insecure temporary file incidentals */\r\n if (!tempFile.setWritable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Writable permissions\");\r\n }\r\n if (!tempFile.setReadable(true, true))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Readable permissions\");\r\n }\r\n if (!tempFile.setExecutable(false))\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not set Executable permissions\");\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not create temporary file\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* FIX: Delete the temporary file manually */\r\n if (tempFile.exists())\r\n {\r\n tempFile.delete();\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-459 (Incomplete Cleanup). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-459\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-459\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE459_Incomplete_Cleanup/CWE459_Incomplete_Cleanup__Servlet_temp_file_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5a4887ccafa4de96e07edab7c2ef5cedf686d73e6b5d15a6b5bc3e4102e57f20\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-459\", \"target_weakness\": \"Incomplete Cleanup\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-470-1d8dd723a67a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE470_Unsafe_Reflection__Environment_01.java\r\nLabel Definition File: CWE470_Unsafe_Reflection.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: Set data to a hardcoded class name\r\n* BadSink: Instantiate class named in data\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE470_Unsafe_Reflection;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE470_Unsafe_Reflection__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */\r\n Class> tempClass = Class.forName(data);\r\n Object tempClassObject = tempClass.newInstance();\r\n\r\n IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded class name */\r\n data = \"Testing.test\";\r\n\r\n /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */\r\n Class> tempClass = Class.forName(data);\r\n Object tempClassObject = tempClass.newInstance();\r\n\r\n IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-470 (Unsafe Reflection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-470\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-470\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE470_Unsafe_Reflection/CWE470_Unsafe_Reflection__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1d8dd723a67aaac219c8b6e5e034956832a45d88db6ed81a6052c5c3ef90869a\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-470\", \"target_weakness\": \"Unsafe Reflection\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-476-2fec1fda7a39", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE476_NULL_Pointer_Dereference__Integer_01.java\r\nLabel Definition File: CWE476_NULL_Pointer_Dereference.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 476 Null Pointer Dereference\r\n* BadSource: Set data to null\r\n* GoodSource: Set data to a non-null value\r\n* Sinks:\r\n* GoodSink: add check to prevent possibility of null dereference\r\n* BadSink : possibility of null dereference\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE476_NULL_Pointer_Dereference;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE476_NULL_Pointer_Dereference__Integer_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n Integer data;\r\n\r\n /* POTENTIAL FLAW: data is null */\r\n data = null;\r\n\r\n /* POTENTIAL FLAW: null dereference will occur if data is null */\r\n IO.writeLine(\"\" + data.toString());\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n Integer data;\r\n\r\n /* FIX: hardcode data to non-null */\r\n data = Integer.valueOf(5);\r\n\r\n /* POTENTIAL FLAW: null dereference will occur if data is null */\r\n IO.writeLine(\"\" + data.toString());\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n Integer data;\r\n\r\n /* POTENTIAL FLAW: data is null */\r\n data = null;\r\n\r\n /* FIX: validate that data is non-null */\r\n if (data != null)\r\n {\r\n IO.writeLine(\"\" + data.toString());\r\n }\r\n else\r\n {\r\n IO.writeLine(\"data is null\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-476 (NULL Pointer Dereference). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-476\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-476\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE476_NULL_Pointer_Dereference/CWE476_NULL_Pointer_Dereference__Integer_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2fec1fda7a3975a0045856ba8f5e986d7ce97aeed682304502de4438cdc0d1ce\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-476\", \"target_weakness\": \"NULL Pointer Dereference\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-478-9821c8c44a6f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE478_Missing_Default_Case_in_Switch__basic_01.java\r\nLabel Definition File: CWE478_Missing_Default_Case_in_Switch__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 478 Missing Default Case in Switch\r\n* Sinks:\r\n* GoodSink: Use default case in switch statement\r\n* BadSink : No default case in a switch statement\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE478_Missing_Default_Case_in_Switch;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE478_Missing_Default_Case_in_Switch__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n String stringIntValue = \"\";\r\n int x = (new SecureRandom()).nextInt(3);\r\n\r\n switch (x)\r\n {\r\n case 0:\r\n stringIntValue = \"0\";\r\n break;\r\n case 1:\r\n stringIntValue = \"1\";\r\n break;\r\n /* FLAW: x could be 2, and there is no 'default' case for that */\r\n }\r\n\r\n IO.writeLine(stringIntValue);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n String stringIntValue = \"\";\r\n int x = (new SecureRandom()).nextInt(3);\r\n\r\n switch (x)\r\n {\r\n case 0:\r\n stringIntValue = \"0\";\r\n break;\r\n case 1:\r\n stringIntValue = \"1\";\r\n break;\r\n /* FIX: Add a default case */\r\n default:\r\n stringIntValue = \"2\";\r\n }\r\n\r\n IO.writeLine(stringIntValue);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-478 (Missing Default Case in Switch). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-478\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-478\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE478_Missing_Default_Case_in_Switch/CWE478_Missing_Default_Case_in_Switch__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9821c8c44a6f98d0f4fab21712ccc32a0861b09ee5989d6051e897d46d487449\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-478\", \"target_weakness\": \"Missing Default Case in Switch\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-481-b271fe75e86f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE481_Assigning_Instead_of_Comparing__basic_01.java\r\nLabel Definition File: CWE481_Assigning_Instead_of_Comparing__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 481 Assigning Instead of Comparing\r\n* Sinks:\r\n* GoodSink: Comparing\r\n* BadSink : Assigning instead of comparing\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE481_Assigning_Instead_of_Comparing;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE481_Assigning_Instead_of_Comparing__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n int zeroOrOne = (new SecureRandom()).nextInt(2);\r\n\r\n boolean isZero = (zeroOrOne == 0);\r\n\r\n if(isZero = true) /* FLAW: should be == and INCIDENTIAL CWE 571 Expression Is Always True */\r\n {\r\n IO.writeLine(\"zeroOrOne is 0\");\r\n }\r\n\r\n IO.writeLine(\"isZero is: \" + isZero);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n int zeroOrOne = (new SecureRandom()).nextInt(2); /* i will be 0 or 1 */\r\n\r\n boolean isZero = (zeroOrOne == 0);\r\n\r\n if(isZero == true) /* FIX: using == instead of = */\r\n {\r\n IO.writeLine(\"zeroOrOne is 0\");\r\n }\r\n\r\n IO.writeLine(\"isZero is: \" + isZero);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-481 (Assigning Instead of Comparing). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-481\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-481\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE481_Assigning_Instead_of_Comparing/CWE481_Assigning_Instead_of_Comparing__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"b271fe75e86f105693ea7797f687d6871bce622cecf6e2ec85ccbe25712b0c79\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-481\", \"target_weakness\": \"Assigning Instead of Comparing\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-482-99e452dc1400", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE482_Comparing_Instead_of_Assigning__basic_01.java\r\nLabel Definition File: CWE482_Comparing_Instead_of_Assigning__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 482 Comparing Instead of Assigning\r\n* Sinks:\r\n* GoodSink: Assigning\r\n* BadSink : Comparing instead of assigning\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE482_Comparing_Instead_of_Assigning;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE482_Comparing_Instead_of_Assigning__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n int zeroOrOne = (new SecureRandom()).nextInt(2);\r\n\r\n boolean isZero = false;\r\n\r\n if((isZero == (zeroOrOne == 0)) == true) /* FLAW: should be (isZero = (zeroOrOne == 0)) */\r\n {\r\n IO.writeLine(\"zeroOrOne is 0\");\r\n }\r\n\r\n IO.writeLine(\"isZero is: \" + isZero);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n int zeroOrOne = (new SecureRandom()).nextInt(2);\r\n\r\n boolean isZero = false;\r\n\r\n if((isZero = (zeroOrOne == 0)) == true) /* FIX: correct assignment */\r\n {\r\n IO.writeLine(\"zeroOrOne is 0\");\r\n }\r\n\r\n IO.writeLine(\"isZero is: \" + isZero);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-482 (Comparing Instead of Assigning). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-482\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-482\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE482_Comparing_Instead_of_Assigning/CWE482_Comparing_Instead_of_Assigning__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"99e452dc1400d09e1266f26c0836f472cafca0e50c296dd180a7f9bd23071cfd\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-482\", \"target_weakness\": \"Comparing Instead of Assigning\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-483-fc323e450494", "input": "/*\r\n * @description Incorrect Block Delimitation\r\n *\r\n * */\r\n\r\npackage testcases.CWE483_Incorrect_Block_Delimitation;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE483_Incorrect_Block_Delimitation__if_without_braces_multiline_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n int x, y;\r\n\r\n x = (new SecureRandom()).nextInt(3);\r\n y = 0;\r\n\r\n /* FLAW: forgot to put these two statements within braces\r\n * (separate lines, but indentation hints at programmer's intent) */\r\n if (x == 0)\r\n IO.writeLine(\"x == 0\");\r\n y = 1; \r\n\r\n if (y == 1) \r\n {\r\n IO.writeLine(\"x was 0\");\r\n }\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n int x, y;\r\n\r\n x = (new SecureRandom()).nextInt(3);\r\n y = 0;\r\n\r\n /* FIX: put the related statements within braces */\r\n if (x == 0)\r\n {\r\n IO.writeLine(\"x == 0\");\r\n y = 1;\r\n }\r\n\r\n if (y == 1) \r\n {\r\n IO.writeLine(\"x was 0\");\r\n }\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested. \r\n\t */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-483 (Incorrect Block Delimitation). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-483\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-483\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE483_Incorrect_Block_Delimitation/CWE483_Incorrect_Block_Delimitation__if_without_braces_multiline_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"fc323e450494888d7418a5eb04a66caa2cce349c0fc081ce3a30870657bb02fd\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-483\", \"target_weakness\": \"Incorrect Block Delimitation\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-484-11b5228e5238", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE484_Omitted_Break_Statement_in_Switch__basic_01.java\r\nLabel Definition File: CWE484_Omitted_Break_Statement_in_Switch__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 484 Omitted Break Statement in Switch\r\n* Sinks:\r\n* GoodSink: Each case in switch has a break statement\r\n* BadSink : Missing break statement in one case of switch\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE484_Omitted_Break_Statement_in_Switch;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE484_Omitted_Break_Statement_in_Switch__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n int intRandom = (new SecureRandom()).nextInt(3);\r\n String stringValue;\r\n\r\n switch (intRandom)\r\n {\r\n case 1:\r\n stringValue = \"one\";\r\n break;\r\n case 2:\r\n stringValue = \"two\"; /* INCIDENTAL: CWE563 Unused Variable (actually unused value) since s gets overwritten in the default case */\r\n /* FLAW: Case 2 is missing a break statement */\r\n default:\r\n stringValue = \"Default\";\r\n break;\r\n }\r\n\r\n IO.writeLine(stringValue);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n int intRandom = (new SecureRandom()).nextInt(3);\r\n String stringValue;\r\n\r\n switch (intRandom)\r\n {\r\n case 1:\r\n stringValue = \"one\";\r\n break;\r\n case 2:\r\n stringValue = \"two\";\r\n break; /* FIX: Case 2 has a break statement */\r\n default:\r\n stringValue = \"Default\";\r\n break;\r\n }\r\n\r\n IO.writeLine(stringValue);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-484 (Omitted Break Statement in Switch). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-484\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-484\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE484_Omitted_Break_Statement_in_Switch/CWE484_Omitted_Break_Statement_in_Switch__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"11b5228e52388676ea06fd47764759fb26d4616715c1c78fc4ea8795d93f1e9f\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-484\", \"target_weakness\": \"Omitted Break Statement in Switch\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-486-dc8723915aa3", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE486_Compare_Classes_by_Name__basic_01.java\r\nLabel Definition File: CWE486_Compare_Classes_by_Name__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 486 Compare Classes by Name\r\n* Sinks:\r\n* GoodSink: properly compare class\r\n* BadSink : Compare class names\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE486_Compare_Classes_by_Name;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE486_Compare_Classes_by_Name__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n /* FLAW: Differentiating by name is not enough, since different classes in different packages may use the same name */\r\n\r\n testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper helperClass = new testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper();\r\n\r\n testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper helperClassRoot = new testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper();\r\n\r\n if (helperClassRoot.getClass().getSimpleName().equals(helperClass.getClass().getSimpleName()))\r\n {\r\n IO.writeLine(\"Classes are the same\");\r\n }\r\n else\r\n {\r\n /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */\r\n IO.writeLine(\"Classes are different\");\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper helperClass = new testcases.CWE486_Compare_Classes_by_Name.HelperClass.CWE486_Compare_Classes_by_Name__Helper();\r\n\r\n testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper helperClassRoot = new testcases.CWE486_Compare_Classes_by_Name.CWE486_Compare_Classes_by_Name__Helper();\r\n\r\n /* FIX: Compare the class types and not the names */\r\n if (helperClassRoot.getClass().equals(helperClass.getClass()))\r\n {\r\n /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */\r\n IO.writeLine(\"Classes are the same\");\r\n }\r\n else\r\n {\r\n IO.writeLine(\"Classes are different\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-486 (Compare Classes by Name). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-486\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-486\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE486_Compare_Classes_by_Name/CWE486_Compare_Classes_by_Name__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"dc8723915aa36b864bdc287d0cef8efa7f6edc624a786c6081dcd47f6e051461\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-486\", \"target_weakness\": \"Compare Classes by Name\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-506-5043e5f7714a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE506_Embedded_Malicious_Code__aes_encrypted_payload_01.java\r\nLabel Definition File: CWE506_Embedded_Malicious_Code.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 506 Embedded Malicious Code\r\n* Sinks: aes_encrypted_payload\r\n* GoodSink: Use a plaintext command\r\n* BadSink : Use an AES encrypted payload in an attempt to hide the command\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE506_Embedded_Malicious_Code;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport javax.crypto.Cipher;\r\nimport javax.crypto.spec.SecretKeySpec;\r\n\r\npublic class CWE506_Embedded_Malicious_Code__aes_encrypted_payload_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n /* FLAW: encrytped \"calc.exe\" */\r\n String payload = \"0297b5eb43e3b81f9c737b353c3ade45\";\r\n\r\n Cipher aesCipher = Cipher.getInstance(\"AES\");\r\n /* INCIDENTAL: Hardcoded crypto */\r\n SecretKeySpec secretKeySpec = new SecretKeySpec(\"ABCDEFGHABCDEFGH\".getBytes(\"UTF-8\"), \"AES\");\r\n aesCipher.init(Cipher.DECRYPT_MODE, secretKeySpec);\r\n\r\n /* Convert hex string to byte array without the use of a library\r\n * adopted from: http://stackoverflow.com/questions/140131/convert-a-string-representation-of-a-hex-dump-to-a-byte-array-using-java */\r\n int payloadLength = payload.length();\r\n byte[] data = new byte[payloadLength/2];\r\n\r\n for (int i = 0; i < payloadLength; i+=2)\r\n {\r\n data[i/2] = (byte)((Character.digit(payload.charAt(i), 16) << 4) + Character.digit(payload.charAt(i+1), 16));\r\n }\r\n\r\n String decryptedPayload = new String(aesCipher.doFinal(data), \"UTF-8\");\r\n\r\n try\r\n {\r\n Runtime.getRuntime().exec(decryptedPayload);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error executing command\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n /* FIX: plaintext command */\r\n String decodedPayload = \"calc.exe\";\r\n try\r\n {\r\n Runtime.getRuntime().exec(decodedPayload);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error executing command\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-506 (Embedded Malicious Code). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-506\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-506\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE506_Embedded_Malicious_Code/CWE506_Embedded_Malicious_Code__aes_encrypted_payload_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5043e5f7714a7453102486eb44ed4fb82eda09ac18d0312472f9805a1dc1df80\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-506\", \"target_weakness\": \"Embedded Malicious Code\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-510-76648f80fd3f", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE510_Trapdoor__hostname_based_logic_01.java\r\nLabel Definition File: CWE510_Trapdoor.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 510 Trapdoor\r\n* Sinks: hostname_based_logic\r\n* GoodSink: No special code for a specific hostname\r\n* BadSink : Special code is executed upon connection of a specific hostname\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE510_Trapdoor;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.io.OutputStream;\r\nimport java.io.IOException;\r\n\r\nimport java.net.Socket;\r\nimport java.net.ServerSocket;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE510_Trapdoor__hostname_based_logic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n ServerSocket listener = null;\r\n Socket socket = null;\r\n OutputStream streamOutput = null;\r\n\r\n int port = 20000;\r\n\r\n try\r\n {\r\n listener = new ServerSocket(port);\r\n socket = listener.accept(); /* INCIDENTAL: Use of Socket */\r\n /* FLAW: hostname-based logic */\r\n if (socket.getInetAddress().getHostName().equals(\"admin.google.com\"))\r\n {\r\n streamOutput = socket.getOutputStream();\r\n streamOutput.write(\"Welcome, admin!\".getBytes(\"UTF-8\"));\r\n }\r\n else\r\n {\r\n streamOutput = socket.getOutputStream();\r\n streamOutput.write(\"Welcome, user.\".getBytes(\"UTF-8\"));\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not connect to port \" + Integer.toString(port), exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (streamOutput != null)\r\n {\r\n streamOutput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (socket != null)\r\n {\r\n socket.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (listener != null)\r\n {\r\n listener.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n ServerSocket listener = null;\r\n Socket socket = null;\r\n OutputStream streamOutput = null;\r\n\r\n int port = 20000;\r\n\r\n try\r\n {\r\n listener = new ServerSocket(port);\r\n socket = listener.accept();\r\n streamOutput = socket.getOutputStream();\r\n /* FIX: No host-based logic */\r\n streamOutput.write((\"Welcome, \" + socket.getInetAddress().getHostName()).getBytes(\"UTF-8\"));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not connect to port \" + Integer.toString(port), exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (streamOutput != null)\r\n {\r\n streamOutput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (socket != null)\r\n {\r\n socket.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (listener != null)\r\n {\r\n listener.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing objects\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-510 (Trapdoor). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-510\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-510\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE510_Trapdoor/CWE510_Trapdoor__hostname_based_logic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"76648f80fd3f5204b7253880374c28cc60990472b1f7eb8acffe8f151cd73f2c\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-510\", \"target_weakness\": \"Trapdoor\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-523-3c4b01d8b162", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE523_Unprotected_Cred_Transport__Servlet_01.java\r\nLabel Definition File: CWE523_Unprotected_Cred_Transport__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 523 Unprotected Transport of Credentials\r\n* Sinks: non_ssl\r\n* GoodSink: Send across SSL connection\r\n* BadSink : Send across non-SSL connection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE523_Unprotected_Cred_Transport;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.PrintWriter;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE523_Unprotected_Cred_Transport__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n PrintWriter writer = null;\r\n try\r\n {\r\n writer = response.getWriter();\r\n\r\n /* FLAW: transmitting login credentials across a non-SSL connection */\r\n writer.println(\"\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"There was a problem writing\", exceptIO);\r\n }\r\n finally\r\n {\r\n if (writer != null)\r\n {\r\n writer.close();\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n PrintWriter writer = null;\r\n try\r\n {\r\n writer = response.getWriter();\r\n\r\n /* FIX: ensure the connection is secure (https) */\r\n writer.println(\"\");\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"There was a problem writing\", exceptIO);\r\n }\r\n finally\r\n {\r\n if (writer != null)\r\n {\r\n writer.close();\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-523 (Unprotected Cred Transport). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-523\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-523\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE523_Unprotected_Cred_Transport/CWE523_Unprotected_Cred_Transport__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"3c4b01d8b1628de15ad4830165f2be6cf8155e55deb833c1b9faa66e5d3815cc\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-523\", \"target_weakness\": \"Unprotected Cred Transport\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-526-0ab51d144b9c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE526_Info_Exposure_Environment_Variables__Servlet_01.java\r\nLabel Definition File: CWE526_Info_Exposure_Environment_Variables.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 526 Information Exposure Through Environment Variables\r\n* Sinks: Servlet\r\n* GoodSink: no exposing\r\n* BadSink : expose the path variable to the user\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE526_Info_Exposure_Environment_Variables;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE526_Info_Exposure_Environment_Variables__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FLAW: environment variable exposed */\r\n response.getWriter().println(\"Not in path: \" + System.getenv(\"PATH\"));\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FIX: error message is general */\r\n response.getWriter().println(\"Not in path\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-526 (Info Exposure Environment Variables). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-526\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-526\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE526_Info_Exposure_Environment_Variables/CWE526_Info_Exposure_Environment_Variables__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"0ab51d144b9c56c8a5592e32d61f5630ca3c4ff313e3e0752d16c6d65c072fff\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-526\", \"target_weakness\": \"Info Exposure Environment Variables\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-534-1217f4d02296", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE534_Info_Exposure_Debug_Log__Servlet_01.java\r\nLabel Definition File: CWE534_Info_Exposure_Debug_Log__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 534 Information Exposure through Debug Log Files\r\n* Sinks:\r\n* GoodSink: log non-sensitive information to the debug log\r\n* BadSink : Expose the session ID to the debug log\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE534_Info_Exposure_Debug_Log;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\nimport java.util.logging.*;\r\n\r\npublic class CWE534_Info_Exposure_Debug_Log__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n Logger logger = Logger.getLogger(\"cwe_testcases_logger\");\r\n if (request.getParameter(\"username\") == null)\r\n {\r\n return;\r\n }\r\n\r\n String username = request.getParameter(\"username\");\r\n\r\n if (username.matches(\"[a-zA-Z0-9]*\"))\r\n {\r\n HttpSession session = request.getSession(true);\r\n /* FLAW: Expose the session ID to debug log */\r\n logger.log(Level.FINEST, \"Username: \" + username + \" Session ID:\" + session.getId());\r\n }\r\n else\r\n {\r\n response.getWriter().println(\"Invalid characters\");\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n Logger logger = Logger.getLogger(\"cwe_testcases_logger\");\r\n if (request.getParameter(\"username\") == null)\r\n {\r\n return;\r\n }\r\n\r\n String username = request.getParameter(\"username\");\r\n\r\n if (username.matches(\"[a-zA-Z0-9]*\"))\r\n {\r\n /* FIX: logged message does not contain session id */\r\n logger.log(Level.FINEST, \"Username: \" + username);\r\n }\r\n else\r\n {\r\n response.getWriter().println(\"Invalid characters\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-534 (Info Exposure Debug Log). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-534\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-534\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE534_Info_Exposure_Debug_Log/CWE534_Info_Exposure_Debug_Log__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1217f4d02296f032d5f89a9a1513cb17e00302ce1e1527e3dd8a457f9c45b11f\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-534\", \"target_weakness\": \"Info Exposure Debug Log\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-535-19ea9bd70bbf", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE535_Info_Exposure_Shell_Error__Servlet_01.java\r\nLabel Definition File: CWE535_Info_Exposure_Shell_Error__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 535 Information Exposure through Shell Error\r\n* Sinks:\r\n* GoodSink: write non-sensitive information to System.err\r\n* BadSink : Expose the session ID to System.err\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE535_Info_Exposure_Shell_Error;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.IOException;\r\nimport java.io.OutputStreamWriter;\r\nimport java.io.PrintWriter;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE535_Info_Exposure_Shell_Error__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n if (request.getParameter(\"username\") == null)\r\n {\r\n return;\r\n }\r\n\r\n String username = request.getParameter(\"username\");\r\n OutputStreamWriter writerOutputStream = null;\r\n PrintWriter writerPrint = null;\r\n\r\n if (username.matches(\"[a-zA-Z0-9]*\"))\r\n {\r\n HttpSession session = request.getSession(true);\r\n writerOutputStream = new OutputStreamWriter(System.err, \"UTF-8\");\r\n writerPrint = new PrintWriter(writerOutputStream);\r\n /* FLAW: Expose the session ID to stderr */\r\n writerPrint.println(\"Username: \" + username + \" Session ID:\" + session.getId());\r\n }\r\n else\r\n {\r\n response.getWriter().println(\"Invalid characters\");\r\n }\r\n\r\n try\r\n {\r\n if (writerOutputStream != null)\r\n {\r\n writerOutputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing OutputStreamWriter\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n if (request.getParameter(\"username\") == null)\r\n {\r\n return;\r\n }\r\n\r\n String username = request.getParameter(\"username\");\r\n OutputStreamWriter writerOutputStream = null;\r\n PrintWriter writerPrint = null;\r\n\r\n if (username.matches(\"[a-zA-Z0-9]*\"))\r\n {\r\n writerOutputStream = new OutputStreamWriter(System.err, \"UTF-8\");\r\n writerPrint = new PrintWriter(writerOutputStream);\r\n /* FIX: message to stderr does not contain session id */\r\n writerPrint.println(\"Username: \" + username + \" logged in\");\r\n }\r\n else\r\n {\r\n response.getWriter().println(\"Invalid characters\");\r\n }\r\n\r\n try\r\n {\r\n if (writerOutputStream != null)\r\n {\r\n writerOutputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing OutputStreamWriter\", exceptIO);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-535 (Info Exposure Shell Error). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-535\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-535\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE535_Info_Exposure_Shell_Error/CWE535_Info_Exposure_Shell_Error__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"19ea9bd70bbfc0e57a136b8ce114b7a2213934dd616ed91f768507d588138458\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-535\", \"target_weakness\": \"Info Exposure Shell Error\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-546-a770f0066fea", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE546_Suspicious_Comment__BUG_01.java\r\nLabel Definition File: CWE546_Suspicious_Comment.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 546 Suspicious Comment\r\n* Sinks: BUG\r\n* GoodSink: does not contain suspicious comment\r\n* BadSink : contains suspicious comment\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE546_Suspicious_Comment;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE546_Suspicious_Comment__BUG_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n /* FLAW: This is the suspicious comment */\r\n /* BUG: There is a bug at this location...I'm not sure why! */\r\n IO.writeLine(\"This a test of the emergency broadcast system\");\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n /* FIX: don't have those types of comments :) */\r\n IO.writeLine(\"This a test of the emergency broadcast system\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-546 (Suspicious Comment). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-546\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-546\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE546_Suspicious_Comment/CWE546_Suspicious_Comment__BUG_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a770f0066feabaebebbd557081643a053fe1d2615dedd4fd3612dbec1e98b256\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-546\", \"target_weakness\": \"Suspicious Comment\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-549-790ff060e147", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE549_Missing_Password_Masking__Servlet_01.java\r\nLabel Definition File: CWE549_Missing_Password_Masking__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 549 Passwords should be masked during entry to prevent others from stealing them\r\n* Sinks:\r\n* GoodSink: password field masked\r\n* BadSink : password field unmasked\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE549_Missing_Password_Masking;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE549_Missing_Password_Masking__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.getWriter().println(\"\");\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.getWriter().println(\"\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-549 (Missing Password Masking). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-549\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-549\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE549_Missing_Password_Masking/CWE549_Missing_Password_Masking__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"790ff060e14721746dbbbf2ecd6cd9d9c0fbbb34107dc623ee6ddc558a2fafcf\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-549\", \"target_weakness\": \"Missing Password Masking\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-563-2484318beb75", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE563_Unused_Variable__unused_init_variable_StringBuilder_01.java\r\nLabel Definition File: CWE563_Unused_Variable__unused_init_variable.label.xml\r\nTemplate File: source-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 563 Unused Variable\r\n* BadSource: Initialize data\r\n* Sinks:\r\n* GoodSink: Use data\r\n* BadSink : do nothing\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE563_Unused_Variable;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE563_Unused_Variable__unused_init_variable_StringBuilder_01 extends AbstractTestCase\r\n{\r\n /* use badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n StringBuilder data;\r\n\r\n /* POTENTIAL FLAW: Initialize, but do not use data */\r\n\r\n data = new StringBuilder(\"Good\");\r\n\r\n /* FLAW: Do not use the variable */\r\n /* do nothing */\r\n ; /* empty statement needed for some flow variants */\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodB2G();\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n StringBuilder data;\r\n\r\n /* POTENTIAL FLAW: Initialize, but do not use data */\r\n\r\n data = new StringBuilder(\"Good\");\r\n\r\n /* FIX: Use data */\r\n\r\n IO.writeLine(data.toString());\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-563 (Unused Variable). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-563\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-563\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE563_Unused_Variable/CWE563_Unused_Variable__unused_init_variable_StringBuilder_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2484318beb750d525f7eea9136ccf215317ec66f6ef83bbeeb21705c64b352f9\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-563\", \"target_weakness\": \"Unused Variable\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-566-fabf678f7e80", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE566_Authorization_Bypass_Through_SQL_Primary__Servlet_01.java\r\nLabel Definition File: CWE566_Authorization_Bypass_Through_SQL_Primary__Servlet.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 566 Authorization Bypass through SQL primary\r\n* BadSource: user id taken from url parameter\r\n* GoodSource: hardcoded user id\r\n* BadSink: writeConsole user authorization not checked\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE566_Authorization_Bypass_Through_SQL_Primary;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.sql.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE566_Authorization_Bypass_Through_SQL_Primary__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n /* uses badsource and badsink */\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FLAW: Get the user ID from a URL parameter */\r\n data = request.getParameter(\"id\");\r\n\r\n Connection dBConnection = IO.getDBConnection();\r\n PreparedStatement preparedStatement = null;\r\n ResultSet resultSet = null;\r\n int id = 0;\r\n try\r\n {\r\n id = Integer.parseInt(data);\r\n }\r\n catch ( NumberFormatException nfx )\r\n {\r\n id = -1; /* Assuming this id does not exist */\r\n }\r\n\r\n try\r\n {\r\n preparedStatement = dBConnection.prepareStatement(\"select * from invoices where uid=?\");\r\n preparedStatement.setInt(1, id);\r\n\r\n resultSet = preparedStatement.executeQuery();\r\n\r\n /* POTENTIAL FLAW: no check to see whether the user has privileges to view the data */\r\n IO.writeString(\"bad() - result requested: \" + data +\"\\n\");\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error executing query\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (resultSet != null)\r\n {\r\n resultSet.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close ResultSet\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (preparedStatement != null)\r\n {\r\n preparedStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded user ID */\r\n data = \"10\";\r\n\r\n Connection dBConnection = IO.getDBConnection();\r\n PreparedStatement preparedStatement = null;\r\n ResultSet resultSet = null;\r\n int id = 0;\r\n try\r\n {\r\n id = Integer.parseInt(data);\r\n }\r\n catch ( NumberFormatException nfx )\r\n {\r\n id = -1; /* Assuming this id does not exist */\r\n }\r\n\r\n try\r\n {\r\n preparedStatement = dBConnection.prepareStatement(\"select * from invoices where uid=?\");\r\n preparedStatement.setInt(1, id);\r\n\r\n resultSet = preparedStatement.executeQuery();\r\n\r\n /* POTENTIAL FLAW: no check to see whether the user has privileges to view the data */\r\n IO.writeString(\"bad() - result requested: \" + data +\"\\n\");\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error executing query\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (resultSet != null)\r\n {\r\n resultSet.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close ResultSet\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (preparedStatement != null)\r\n {\r\n preparedStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (dBConnection != null)\r\n {\r\n dBConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Could not close Connection\", exceptSql);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-566 (Authorization Bypass Through SQL Primary). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-566\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-566\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE566_Authorization_Bypass_Through_SQL_Primary/CWE566_Authorization_Bypass_Through_SQL_Primary__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"fabf678f7e8099b69c5f06a5034fcbca4e842bc8e5b81e9cc932964df25258fe\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-566\", \"target_weakness\": \"Authorization Bypass Through SQL Primary\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-570-697b57082bc5", "input": "/*\r\n * @description statement always evaluates to false\r\n * \r\n * */\r\npackage testcases.CWE570_Expression_Always_False;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\nimport java.security.SecureRandom;\r\nimport java.util.Random;\r\n\r\npublic class CWE570_Expression_Always_False__class_getClass_equal_01 extends AbstractTestCase\r\n{ \r\n public void bad()\r\n {\r\n /* FLAW: always evaluates to false */\r\n Random random = new Random();\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n if (random.getClass().equals(secureRandom.getClass()))\r\n {\r\n IO.writeLine(\"never prints\");\r\n }\r\n }\r\n \r\n public void good()\r\n {\r\n good1();\r\n }\r\n \r\n private void good1()\r\n {\r\n Object objectArray[] = new Object [] {new Random(), new SecureRandom(), new SecureRandom()};\r\n \r\n int intSecureRandom = (new SecureRandom()).nextInt(3);\r\n \r\n /* FIX: may evaluate to true or false */\r\n if (objectArray[1].getClass().equals(objectArray[intSecureRandom].getClass()))\r\n {\r\n IO.writeLine(\"sometimes prints\");\r\n }\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on \r\n * its own for testing or for building a binary to use in testing binary \r\n * analysis tools. It is not used when compiling all the testcases as one \r\n * application, which is how source code analysis tools are tested. \r\n\t */ \r\n public static void main(String[] args) \r\n throws ClassNotFoundException, InstantiationException, IllegalAccessException \r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-570 (Expression Always False). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-570\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-570\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE570_Expression_Always_False/CWE570_Expression_Always_False__class_getClass_equal_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"697b57082bc520e1b1e601297c556b366207479c74f04cdbdaeabaa7ea5afd70\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-570\", \"target_weakness\": \"Expression Always False\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-571-f24ebc8ce069", "input": "/*\r\n * @description statement always evaluates to true\r\n * \r\n * */\r\npackage testcases.CWE571_Expression_Always_True;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\nimport java.security.SecureRandom;\r\nimport java.util.Random;\r\n\r\npublic class CWE571_Expression_Always_True__class_getClass_not_equal_01 extends AbstractTestCase\r\n{ \r\n public void bad()\r\n {\r\n /* FLAW: always evaluates to true */\r\n Random random = new Random();\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n if (!random.getClass().equals(secureRandom.getClass()))\r\n {\r\n IO.writeLine(\"always prints\");\r\n }\r\n }\r\n \r\n public void good()\r\n {\r\n good1();\r\n }\r\n \r\n private void good1()\r\n {\r\n Object objectArray[] = new Object [] {new Random(), new SecureRandom(), new SecureRandom()};\r\n \r\n int intSecureRandom = (new SecureRandom()).nextInt(3);\r\n \r\n /* FIX: may evaluate to true or false */\r\n if (objectArray[1].getClass().equals(objectArray[intSecureRandom].getClass()))\r\n {\r\n IO.writeLine(\"sometimes prints\");\r\n }\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on \r\n * its own for testing or for building a binary to use in testing binary \r\n * analysis tools. It is not used when compiling all the testcases as one \r\n * application, which is how source code analysis tools are tested. \r\n\t */ \r\n public static void main(String[] args) \r\n throws ClassNotFoundException, InstantiationException, IllegalAccessException \r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-571 (Expression Always True). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-571\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-571\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE571_Expression_Always_True/CWE571_Expression_Always_True__class_getClass_not_equal_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f24ebc8ce0698667f9cbf3e86f13529e5a3b27ddf1bd0f3a8d25042863881f4c\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-571\", \"target_weakness\": \"Expression Always True\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-572-7b2547b34f51", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE572_Call_to_Thread_run_Instead_of_start__basic_01.java\r\nLabel Definition File: CWE572_Call_to_Thread_run_Instead_of_start__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 572 Call to Thread run instead of Thread start\r\n* Sinks:\r\n* GoodSink: calls thread start\r\n* BadSink : calls thread run\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE572_Call_to_Thread_run_Instead_of_start;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE572_Call_to_Thread_run_Instead_of_start__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n IO.writeLine(\"bad() Main thread name is: \" + Thread.currentThread().getName());\r\n Thread threadOne = new Thread()\r\n {\r\n public void run()\r\n {\r\n IO.writeLine(\"bad() In thread: \" + Thread.currentThread().getName());\r\n }\r\n };\r\n\r\n threadOne.run(); /* FLAW: Called Thread.run() instead of Thread.start() */\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n IO.writeLine(\"good() Main thread name is: \" + Thread.currentThread().getName());\r\n Thread threadTwo = new Thread()\r\n {\r\n public void run()\r\n {\r\n IO.writeLine(\"good() In thread: \" + Thread.currentThread().getName());\r\n }\r\n };\r\n\r\n threadTwo.start(); /* FIX: Correctly called Thread.start() */\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-572 (Call to Thread run Instead of start). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-572\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-572\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE572_Call_to_Thread_run_Instead_of_start/CWE572_Call_to_Thread_run_Instead_of_start__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"7b2547b34f51ac6b323ae06741984d317c28274a5c8215fda805fc9e30ad37ff\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-572\", \"target_weakness\": \"Call to Thread run Instead of start\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-584-4cf87b79183d", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE584_Return_in_Finally_Block__basic_01.java\r\nLabel Definition File: CWE584_Return_in_Finally_Block__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 584 Return in Finally Block\r\n* Sinks:\r\n* GoodSink: no return in finally block\r\n* BadSink : return in finally\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE584_Return_in_Finally_Block;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE584_Return_in_Finally_Block__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n throw new IllegalArgumentException();\r\n }\r\n catch(IllegalArgumentException exceptIllegalArgument)\r\n {\r\n IO.writeLine(\"preventing incidental issues\");\r\n }\r\n finally\r\n {\r\n if(true)\r\n {\r\n return; /* FLAW: will always return and prevent finally from completing normally */\r\n }\r\n /* INCIDENTAL: 571 Always returns true */\r\n /* We need the \"if(true)\" above because the Java Language Spec requires that unreachable code generate a compiler error */\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n try\r\n {\r\n throw new IllegalArgumentException();\r\n }\r\n catch(IllegalArgumentException exceptIllegalArgument)\r\n {\r\n IO.writeLine(\"preventing incidental issues\");\r\n }\r\n finally\r\n {\r\n /* FIX: cleanup code here and continue */\r\n IO.writeLine(\"In finally block, cleaning up\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-584 (Return in Finally Block). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-584\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-584\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE584_Return_in_Finally_Block/CWE584_Return_in_Finally_Block__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4cf87b79183de2008a5743394e8fc7eb815034430f764d231eb6612e27b79dab\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-584\", \"target_weakness\": \"Return in Finally Block\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-585-989209980173", "input": "/*\r\n * @description Demonstrates a synchronized block that is empty (and therefore allowing unsynchronized updates to a shared variable). Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\n\r\npackage testcases.CWE585_Empty_Sync_Block;\r\n\r\nimport java.io.IOException;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE585_Empty_Sync_Block__Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* bad(): Empty synchronized block */\r\n static private int intBad = 1;\r\n\r\n static public void helperBad()\r\n {\r\n synchronized(CWE585_Empty_Sync_Block__Servlet_01.class) \r\n {\r\n /* FLAW: empty synchronized block - should cover whole method */\r\n }\r\n \r\n intBad = intBad * 2;\r\n }\r\n\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws InterruptedException, IOException \r\n {\r\n helperBad();\r\n response.getWriter().write(intBad);\r\n }\r\n\r\n /* good1(): Use synchronized block to cover whole method */\r\n static private int intGood1 = 1;\r\n\r\n static public void helperGood1() \r\n {\r\n synchronized(CWE585_Empty_Sync_Block__Servlet_01.class) \r\n { /* FIX: synchronized block covers whole method */\r\n intGood1 = intGood1 * 2;\r\n }\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws InterruptedException, IOException\r\n { \r\n helperGood1();\r\n response.getWriter().write(intGood1);\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws InterruptedException, IOException \r\n {\r\n good1(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-585 (Empty Sync Block). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-585\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-585\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE585_Empty_Sync_Block/CWE585_Empty_Sync_Block__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9892099801739bde969312408540c15cbcf14bbf005b0129b42362a0a7d0caa4\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-585\", \"target_weakness\": \"Empty Sync Block\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-586-40dc95b0b397", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE586_Explicit_Call_to_Finalize__basic_01.java\r\nLabel Definition File: CWE586_Explicit_Call_to_Finalize__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 586 Explicit call to finalize()\r\n* Sinks:\r\n* GoodSink: let garbage collection invoke finalize\r\n* BadSink : explictly calling finalize()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE586_Explicit_Call_to_Finalize;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE586_Explicit_Call_to_Finalize__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n CWE586_Explicit_Call_to_Finalize__basic_Helper badObj = new CWE586_Explicit_Call_to_Finalize__basic_Helper();\r\n\r\n try\r\n {\r\n badObj.sayHello();\r\n }\r\n catch (Exception exception)\r\n {\r\n IO.writeLine(\"An error occurred.\");\r\n }\r\n finally\r\n {\r\n /* cleanup */\r\n /* FLAW: avoid explicitly invoking the finalize method on an object */\r\n badObj.finalize();\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n CWE586_Explicit_Call_to_Finalize__basic_Helper goodObj = new CWE586_Explicit_Call_to_Finalize__basic_Helper();\r\n\r\n try\r\n {\r\n goodObj.sayHello();\r\n }\r\n catch (Exception exception)\r\n {\r\n IO.writeLine(\"An error occurred.\");\r\n }\r\n finally\r\n {\r\n /* cleanup */\r\n /* FIX: set reference to null and garbage collector will eventually finalize the object */\r\n goodObj = null;\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-586 (Explicit Call to Finalize). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-586\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-586\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE586_Explicit_Call_to_Finalize/CWE586_Explicit_Call_to_Finalize__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"40dc95b0b397d4bd3aa3363bf04c3851e2915f2e6cb0b7ad368bb13f9c4dec0c\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-586\", \"target_weakness\": \"Explicit Call to Finalize\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-598-da0991391641", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE598_Information_Exposure_QueryString__Servlet_01.java\r\nLabel Definition File: CWE598_Information_Exposure_QueryString__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 598 Information Exposure Through Query Strings in GET Request\r\n* Sinks:\r\n* GoodSink: post password field\r\n* BadSink : get password field\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE598_Information_Exposure_QueryString;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE598_Information_Exposure_QueryString__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.getWriter().println(\"\");\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.getWriter().println(\"\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-598 (Information Exposure QueryString). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-598\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-598\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE598_Information_Exposure_QueryString/CWE598_Information_Exposure_QueryString__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"da0991391641ea6ea526b9902194c35b70ee43c70ae8caa7455141e1d5bed708\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-598\", \"target_weakness\": \"Information Exposure QueryString\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-600-e248cae028a5", "input": "/*\r\n* @description A Servlet fails to catch all exceptions, \r\n* which may reveal sensitive debugging information.\r\n*\r\n* */\r\n\r\n/* note on servlets - when a new Servlet is created, it must be listed in the web.xml\r\n* file in order to run. The easy way to do this is in Eclipse:\r\n* - right click on testcases in package explorer\r\n* - select New->Servlet\r\n* - Check the box that says use an existing Servlet class or JSP\r\n* - Click browse and select the new Servlet class you have created\r\n* - Click OK, Next, then Finish \r\n* - You should now be able to test the servlet by clicking Run in eclipse \r\n*/\r\n\r\npackage testcases.CWE600_Uncaught_Exception_in_Servlet;\r\n\r\nimport java.util.logging.Level;\r\nimport java.io.IOException;\r\nimport java.net.InetAddress;\r\nimport javax.servlet.http.*;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE600_Uncaught_Exception_in_Servlet__getParameter_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L; /* needed since Servlets are serializable */\r\n\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws IOException \r\n { \r\n String ipAddress = request.getRemoteAddr();\r\n InetAddress inetAddress = InetAddress.getByName(ipAddress);\r\n \r\n if (inetAddress == null)\r\n {\r\n IO.logger.log(Level.WARNING, \"Problem getting IP address\");\r\n }\r\n else\r\n {\r\n IO.writeLine(\"IP= \" + inetAddress.getAddress().toString());\r\n }\r\n /* FLAW: The exception is being thrown instead of caught. The stackTrace could \r\n * include information useful to an attacker\r\n * Note: Uncaught exceptions will propagate to the application server.\r\n */\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) \r\n {\r\n try \r\n {\r\n String ipAddress = request.getRemoteAddr();\r\n InetAddress inetAddress = InetAddress.getByName(ipAddress);\r\n \r\n if (inetAddress == null)\r\n {\r\n IO.logger.log(Level.WARNING, \"Problem getting IP address\");\r\n }\r\n else\r\n {\r\n IO.writeLine(\"IP= \" + inetAddress.getAddress().toString());\r\n }\r\n }\r\n /* FIX: IOException is caught */ \r\n catch (IOException exceptIO) \r\n {\r\n IO.logger.log(Level.WARNING, \"Problem getting IP address\");\r\n }\r\n }\r\n \r\n public void good(HttpServletRequest request, HttpServletResponse response) \r\n {\r\n good1(request, response);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-600 (Uncaught Exception in Servlet). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-600\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-600\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE600_Uncaught_Exception_in_Servlet/CWE600_Uncaught_Exception_in_Servlet__getParameter_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e248cae028a53d162de5b3ec0d2e7d663e0c2b59e7e2c5b87665aa1e9bfc5b18\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-600\", \"target_weakness\": \"Uncaught Exception in Servlet\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-601-5849175f4029", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE601_Open_Redirect__Servlet_File_01.java\r\nLabel Definition File: CWE601_Open_Redirect__Servlet.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 601 Open Redirect\r\n* BadSource: File Read data from file (named c:\\data.txt)\r\n* GoodSource: A hardcoded string\r\n* BadSink: place redirect string directly into redirect api call\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE601_Open_Redirect;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.FileInputStream;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport java.net.URI;\r\nimport java.net.URISyntaxException;\r\n\r\npublic class CWE601_Open_Redirect__Servlet_File_01 extends AbstractTestCaseServlet\r\n{\r\n /* uses badsource and badsink */\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n data = \"\"; /* Initialize data */\r\n {\r\n File file = new File(\"C:\\\\data.txt\");\r\n FileInputStream streamFileInput = null;\r\n InputStreamReader readerInputStream = null;\r\n BufferedReader readerBuffered = null;\r\n\r\n try\r\n {\r\n /* read string from file into data */\r\n streamFileInput = new FileInputStream(file);\r\n readerInputStream = new InputStreamReader(streamFileInput, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* POTENTIAL FLAW: Read data from a file */\r\n /* This will be reading the first \"line\" of the file, which\r\n * could be very long if there are little or no newlines in the file */\r\n data = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* This prevents \\r\\n (and other chars) and should prevent incidentals such\r\n * as HTTP Response Splitting and HTTP Header Injection.\r\n */\r\n URI uri;\r\n try\r\n {\r\n uri = new URI(data);\r\n }\r\n catch (URISyntaxException exceptURISyntax)\r\n {\r\n response.getWriter().write(\"Invalid redirect URL\");\r\n return;\r\n }\r\n /* POTENTIAL FLAW: redirect is sent verbatim; escape the string to prevent ancillary issues like XSS, Response splitting etc */\r\n response.sendRedirect(data);\r\n return;\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n if (data != null)\r\n {\r\n /* This prevents \\r\\n (and other chars) and should prevent incidentals such\r\n * as HTTP Response Splitting and HTTP Header Injection.\r\n */\r\n URI uri;\r\n try\r\n {\r\n uri = new URI(data);\r\n }\r\n catch (URISyntaxException exceptURISyntax)\r\n {\r\n response.getWriter().write(\"Invalid redirect URL\");\r\n return;\r\n }\r\n /* POTENTIAL FLAW: redirect is sent verbatim; escape the string to prevent ancillary issues like XSS, Response splitting etc */\r\n response.sendRedirect(data);\r\n return;\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-601 (Open Redirect). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-601\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-601\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE601_Open_Redirect/CWE601_Open_Redirect__Servlet_File_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5849175f40295b393b21dc5b12bfc5223eceb833ce0736ebf627528299f97397\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-601\", \"target_weakness\": \"Open Redirect\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-605-1cf2c31e8258", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE605_Multiple_Binds_Same_Port__basic_01.java\r\nLabel Definition File: CWE605_Multiple_Binds_Same_Port__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 605 Multiple binds to the same port\r\n* Sinks:\r\n* GoodSink: two binds on different ports\r\n* BadSink : two binds on one port\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE605_Multiple_Binds_Same_Port;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.net.ServerSocket;\r\nimport java.net.InetSocketAddress;\r\n\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE605_Multiple_Binds_Same_Port__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n ServerSocket socket1 = null;\r\n ServerSocket socket2 = null;\r\n\r\n try\r\n {\r\n socket1 = new ServerSocket();\r\n socket1.bind(new InetSocketAddress(15000));\r\n\r\n socket2 = new ServerSocket();\r\n /* FLAW: This will bind a second Socket to port 15000, but only for connections from localhost */\r\n socket2.bind(new InetSocketAddress(\"localhost\", 15000));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Unable to bind a socket\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (socket2 != null)\r\n {\r\n socket2.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Socket\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (socket1 != null)\r\n {\r\n socket1.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Socket\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n ServerSocket socket1 = null;\r\n ServerSocket socket2 = null;\r\n\r\n try\r\n {\r\n socket1 = new ServerSocket();\r\n socket1.bind(new InetSocketAddress(15000));\r\n\r\n socket2 = new ServerSocket();\r\n /* FIX: This will bind the second Socket to a different port */\r\n socket2.bind(new InetSocketAddress(\"localhost\", 15001));\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Unable to bind a socket\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (socket2 != null)\r\n {\r\n socket2.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Socket\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (socket1 != null)\r\n {\r\n socket1.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Socket\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-605 (Multiple Binds Same Port). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-605\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-605\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE605_Multiple_Binds_Same_Port/CWE605_Multiple_Binds_Same_Port__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"1cf2c31e8258ea43baabdb912bc5b3352808b6189c5b963d4b76276144d0143e\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-605\", \"target_weakness\": \"Multiple Binds Same Port\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-609-4b79eed81ae2", "input": "/*\r\n * @description Demonstrates lack of any synchronization or locks in a Servlet that updates a shared variable. Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\n\r\npackage testcases.CWE609_Double_Checked_Locking;\r\n\r\nimport java.util.concurrent.locks.ReentrantLock;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE609_Double_Checked_Locking__Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* Bad() - Use of Double Checked Locking */\r\n private static String stringBad = null;\r\n \r\n /* FLAW: Insufficient \"Double-Checked Locking\" in this method - in certain circumstances, this can lead to stringBad being initialized twice.\r\n\t * See http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html for details. */\r\n public static String helperBad() \r\n { \r\n if (stringBad == null)\r\n {\r\n synchronized(CWE609_Double_Checked_Locking__Servlet_01.class)\r\n {\r\n if (stringBad == null)\r\n {\r\n stringBad = \"stringBad\";\r\n }\r\n }\r\n }\r\n return stringBad;\r\n }\r\n \r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperBad());\r\n }\r\n \r\n \r\n /* Good1() - Add volatile keyword for Double Checked Locking \r\n * volatile valid fix for Java 5 and later */\r\n private volatile static String stringGood1 = null; /* FIX: Added \"volatile\" here */\r\n \r\n public static String helperGood1() \r\n { \r\n if (stringGood1 == null)\r\n {\r\n synchronized(CWE609_Double_Checked_Locking__Servlet_01.class)\r\n {\r\n if (stringGood1 == null)\r\n {\r\n stringGood1 = \"stringGood1\";\r\n }\r\n }\r\n }\r\n return stringGood1;\r\n }\r\n \r\n public void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperGood1());\r\n }\r\n \r\n /* Good2() - Use method level synchronization instead of Double Checked Locking */\r\n private static String stringGood2 = null; \r\n \r\n public synchronized static String helperGood2() /* FIX: method is synchronized */\r\n { \r\n if (stringGood2 == null)\r\n {\r\n stringGood2 = \"stringGood2\";\r\n }\r\n return stringGood2;\r\n }\r\n \r\n public void good2(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperGood2());\r\n }\r\n \r\n /* Good3() - Use block synchronization on class instead of Double Checked Locking */\r\n private static String stringGood3 = null; \r\n\r\n public static String helperGood3() \r\n { \r\n /* FIX: Entire block is synchronized on class (not \"double checked\") */\r\n synchronized(CWE609_Double_Checked_Locking__Thread_01.class) \r\n { \r\n if (stringGood3 == null)\r\n {\r\n stringGood3 = \"stringGood3\";\r\n }\r\n return stringGood3;\r\n }\r\n }\r\n \r\n public void good3(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperGood3());\r\n }\r\n \r\n /* Good4() - Use lock object instead of Double Checked Locking */\r\n private static String stringGood4 = null; \r\n static private final Object stringGood4Lock = new Object();\r\n\r\n public static String helperGood4() \r\n { \r\n /* FIX: block is synchronized on stringGood4Lock */\r\n synchronized(stringGood4Lock) \r\n { \r\n if (stringGood4 == null)\r\n {\r\n stringGood4 = \"stringGood4\";\r\n }\r\n return stringGood4;\r\n }\r\n }\r\n \r\n public void good4(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperGood4());\r\n }\r\n \r\n /* good5() - Use ReentrantLock instead of Double Checked Locking */\r\n private static String stringGood5 = null; \r\n static private final ReentrantLock good5ReentrantLock = new ReentrantLock();\r\n\r\n public static String helperGood5() \r\n { \r\n good5ReentrantLock.lock(); /* FIX: Block is \"protected\" with a ReentrantLock */\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try \r\n { \r\n if (stringGood5 == null)\r\n {\r\n stringGood5 = \"stringGood5\";\r\n }\r\n return stringGood5;\r\n } \r\n finally \r\n {\r\n good5ReentrantLock.unlock();\r\n }\r\n }\r\n \r\n public void good5(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n response.getWriter().write(helperGood5());\r\n }\r\n \r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n good1(request, response);\r\n good2(request, response);\r\n good3(request, response);\r\n good4(request, response);\r\n good5(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-609 (Double Checked Locking). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-609\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-609\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE609_Double_Checked_Locking/CWE609_Double_Checked_Locking__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4b79eed81ae21d803781e8e963ed8c5ac0bebc0f109425470bd52cd7fc90b320\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-609\", \"target_weakness\": \"Double Checked Locking\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-613-4192226c421a", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE613_Insufficient_Session_Expiration__Servlet_01.java\r\nLabel Definition File: CWE613_Insufficient_Session_Expiration__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 613 Insufficient Session Expiration\r\n* Sinks:\r\n* GoodSink: force session to expire\r\n* BadSink : set session to never expire\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE613_Insufficient_Session_Expiration;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE613_Insufficient_Session_Expiration__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n HttpSession sesssion = request.getSession(true);\r\n\r\n /* FLAW: A negative time indicates the session should never expire */\r\n sesssion.setMaxInactiveInterval(-1);\r\n\r\n response.getWriter().write(\"bad(): Session still valid\");\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n HttpSession sesssion = request.getSession(true);\r\n\r\n /* FIX: enforce an absolute session timeout of 30 seconds */\r\n if (sesssion.getCreationTime() + 30000 > System.currentTimeMillis())\r\n {\r\n response.getWriter().write(\"good(): Invalidating session per absolute timeout enforcement\");\r\n sesssion.invalidate();\r\n return;\r\n }\r\n else\r\n {\r\n response.getWriter().write(\"good(): Session still valid\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-613 (Insufficient Session Expiration). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-613\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-613\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE613_Insufficient_Session_Expiration/CWE613_Insufficient_Session_Expiration__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4192226c421a7133058e3755b28c003eaf73e7fca469724abc3752f7f6b2830f\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-613\", \"target_weakness\": \"Insufficient Session Expiration\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-614-5e87927c9c88", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE614_Sensitive_Cookie_Without_Secure__Servlet_01.java\r\nLabel Definition File: CWE614_Sensitive_Cookie_Without_Secure__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 614 Sensitive Cookie Without Secure\r\n* Sinks:\r\n* GoodSink: secure flag set\r\n* BadSink : secure flag not set\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE614_Sensitive_Cookie_Without_Secure;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\nimport java.io.*;\r\n\r\npublic class CWE614_Sensitive_Cookie_Without_Secure__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n Cookie cookie = new Cookie(\"SecretMessage\", \"test\");\r\n if (request.isSecure())\r\n {\r\n /* FLAW: secure flag not set */\r\n response.addCookie(cookie);\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n Cookie cookie = new Cookie(\"SecretMessage\", \"Drink your Ovaltine\");\r\n if (request.isSecure())\r\n {\r\n /* FIX: adds \"secure\" flag/attribute to cookie */\r\n cookie.setSecure(true);\r\n response.addCookie(cookie);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-614 (Sensitive Cookie Without Secure). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-614\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-614\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE614_Sensitive_Cookie_Without_Secure/CWE614_Sensitive_Cookie_Without_Secure__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5e87927c9c880fbc7c27fbbe697442f3a2e7a80a31656f9cfa7e412c5ffc3225\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-614\", \"target_weakness\": \"Sensitive Cookie Without Secure\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-615-956953c353c0", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE615_Info_Exposure_by_Comment__Servlet_01.java\r\nLabel Definition File: CWE615_Info_Exposure_by_Comment__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 615 Information Exposure by Comment\r\n* Sinks:\r\n* GoodSink: no disclosure of username and password\r\n* BadSink : disclose username and password\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE615_Info_Exposure_by_Comment;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE615_Info_Exposure_by_Comment__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FLAW: sensitive information exposed in client-side code comments */\r\n response.getWriter().println(\"\" +\r\n \"\");\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n /* FIX: no info exposure in client-side code comments */\r\n response.getWriter().println(\"\");\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-615 (Info Exposure by Comment). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-615\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-615\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE615_Info_Exposure_by_Comment/CWE615_Info_Exposure_by_Comment__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"956953c353c0c48cae772741ce62bfede60759a12e2dfc9bafa89782739f4963\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-615\", \"target_weakness\": \"Info Exposure by Comment\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-643-291280e09f29", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE643_Xpath_Injection__Environment_01.java\r\nLabel Definition File: CWE643_Xpath_Injection.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 643 Xpath Injection\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* Sinks:\r\n* GoodSink: validate input through StringEscapeUtils\r\n* BadSink : user input is used without validate\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE643_Xpath_Injection;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport javax.xml.xpath.*;\r\n\r\nimport org.xml.sax.InputSource;\r\n\r\nimport org.apache.commons.lang.StringEscapeUtils;\r\n\r\npublic class CWE643_Xpath_Injection__Environment_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n String xmlFile = null;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n xmlFile = \"\\\\src\\\\testcases\\\\CWE643_Xpath Injection\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n String [] tokens = data.split(\"||\");\r\n if (tokens.length < 2)\r\n {\r\n return;\r\n }\r\n String username = tokens[0];\r\n String password = tokens[1];\r\n /* build xpath */\r\n XPath xPath = XPathFactory.newInstance().newXPath();\r\n InputSource inputXml = new InputSource(xmlFile);\r\n /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize\r\n * The user input should be canonicalized before validation. */\r\n /* POTENTIAL FLAW: user input is used without validate */\r\n String query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING);\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n String xmlFile = null;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n xmlFile = \"\\\\src\\\\testcases\\\\CWE643_Xpath Injection\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n String [] tokens = data.split(\"||\");\r\n if (tokens.length < 2)\r\n {\r\n return;\r\n }\r\n String username = tokens[0];\r\n String password = tokens[1];\r\n /* build xpath */\r\n XPath xPath = XPathFactory.newInstance().newXPath();\r\n InputSource inputXml = new InputSource(xmlFile);\r\n /* INCIDENTAL: CWE180 Incorrect Behavior Order: Validate Before Canonicalize\r\n * The user input should be canonicalized before validation. */\r\n /* POTENTIAL FLAW: user input is used without validate */\r\n String query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING);\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n String xmlFile = null;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n xmlFile = \"\\\\src\\\\testcases\\\\CWE643_Xpath Injection\\\\CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n xmlFile = \"./src/testcases/CWE643_Xpath Injection/CWE643_Xpath_Injection__Helper.xml\";\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* assume username||password as source */\r\n String [] tokens = data.split(\"||\");\r\n if( tokens.length < 2 )\r\n {\r\n return;\r\n }\r\n /* FIX: validate input using StringEscapeUtils */\r\n String username = StringEscapeUtils.escapeXml(tokens[0]);\r\n String password = StringEscapeUtils.escapeXml(tokens[1]);\r\n /* build xpath */\r\n XPath xPath = XPathFactory.newInstance().newXPath();\r\n InputSource inputXml = new InputSource(xmlFile);\r\n String query = \"//users/user[name/text()='\" + username +\r\n \"' and pass/text()='\" + password + \"']\" +\r\n \"/secret/text()\";\r\n String secret = (String)xPath.evaluate(query, inputXml, XPathConstants.STRING);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-643 (Xpath Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-643\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-643\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE643_Xpath_Injection/CWE643_Xpath_Injection__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"291280e09f2983d350bbec3236bb096e8596f4181e87a77021cfefa55cf952b4\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-643\", \"target_weakness\": \"Xpath Injection\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-674-2a7abdcc5765", "input": "/*\r\n * @description Recursion not limited to a managed level\r\n *\r\n * */\r\n\r\npackage testcases.CWE674_Uncontrolled_Recursion;\r\n\r\nimport testcasesupport.AbstractTestCase;\r\nimport testcasesupport.IO;\r\n\r\npublic class CWE674_Uncontrolled_Recursion__long_01 extends AbstractTestCase \r\n{\r\n private static final long RECURSION_LONG_MAX = 10;\r\n\r\n private static void helperBad(long level)\r\n {\r\n /* FLAW: Although this cannot cause \"infinite\" recursion, it is essentially limited to Long.MAX_VALUE\r\n * which is rather large */\r\n if (level == 0) \r\n {\r\n return;\r\n }\r\n\r\n helperBad(level - 1);\r\n }\r\n \r\n public void bad()\r\n {\r\n long longMax = Long.MAX_VALUE;\r\n \r\n helperBad(longMax);\r\n }\r\n \r\n private static void helperGood1(long level)\r\n {\r\n /* FIX: limit recursion to a sane level */\r\n if (level > RECURSION_LONG_MAX) \r\n {\r\n IO.writeLine(\"ERROR IN RECURSION\");\r\n return;\r\n }\r\n\r\n if (level == 0) \r\n {\r\n return;\r\n }\r\n\r\n helperGood1(level - 1);\r\n }\r\n \r\n private void good1()\r\n {\r\n long longMax = Long.MAX_VALUE;\r\n \r\n helperGood1(longMax);\r\n }\r\n \r\n public void good() \r\n {\r\n good1();\r\n } \r\n \r\n /* Below is the main(). It is only used when building this testcase on \r\n * its own for testing or for building a binary to use in testing binary \r\n * analysis tools. It is not used when compiling all the testcases as one \r\n * application, which is how source code analysis tools are tested. \r\n\t */ \r\n public static void main(String[] args) \r\n throws ClassNotFoundException, InstantiationException, IllegalAccessException \r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-674 (Uncontrolled Recursion). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-674\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-674\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE674_Uncontrolled_Recursion/CWE674_Uncontrolled_Recursion__long_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"2a7abdcc5765e81ce660363d0cc0344d686189970eb24007864ec7199ccf5a2a\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-674\", \"target_weakness\": \"Uncontrolled Recursion\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-681-60a7790acafb", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01.java\r\nLabel Definition File: CWE681_Incorrect_Conversion_Between_Numeric_Types.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 681 Incorrect Conversion Between Numeric Types\r\n* Sinks: double2float\r\n* GoodSink: check for conversion error\r\n* BadSink : explicit cast\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE681_Incorrect_Conversion_Between_Numeric_Types;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\nimport java.io.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n /* Enter: 1e-50, result should be 0.0 (for bad case)\r\n *\r\n * Note: alternate input\r\n * 999999999999999999999999999999999999999999999999999999999999999\r\n */\r\n\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n double doubleNumber = 0;\r\n\r\n IO.writeString(\"Enter double number (1e-50): \");\r\n\r\n try\r\n {\r\n doubleNumber = Double.parseDouble(readerBuffered.readLine());\r\n }\r\n catch (NumberFormatException exceptionNumberFormat)\r\n {\r\n IO.writeLine(\"Error parsing number\");\r\n }\r\n\r\n /* FLAW: should not cast without checking if conversion is safe */\r\n IO.writeLine(\"\" + (float)doubleNumber);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n BufferedReader readerBuffered = null;\r\n InputStreamReader readerInputStream = null;\r\n\r\n try\r\n {\r\n readerInputStream = new InputStreamReader(System.in, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n double num = 0;\r\n\r\n IO.writeString(\"Enter double number (1e-50): \");\r\n\r\n try\r\n {\r\n num = Double.parseDouble(readerBuffered.readLine());\r\n }\r\n catch (NumberFormatException exceptionNumberFormat)\r\n {\r\n IO.writeLine(\"Error parsing number\");\r\n }\r\n\r\n /* FIX: check for conversion error */\r\n if (num > Float.MAX_VALUE || num < Float.MIN_VALUE)\r\n {\r\n IO.writeLine(\"Error, cannot safely cast this number to a float!\");\r\n return;\r\n }\r\n\r\n IO.writeLine(\"\" + (float)num);\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-681 (Incorrect Conversion Between Numeric Types). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-681\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-681\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE681_Incorrect_Conversion_Between_Numeric_Types/CWE681_Incorrect_Conversion_Between_Numeric_Types__double2float_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"60a7790acafbd93ea8d755eb9f63d791f3e091c7e50fefc37273f0fa3c19ce4d\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-681\", \"target_weakness\": \"Incorrect Conversion Between Numeric Types\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-690-f9b1a2ea966c", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE690_NULL_Deref_From_Return__Class_StringBuilder_01.java\r\nLabel Definition File: CWE690_NULL_Deref_From_Return__Class.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 690 Unchecked return value is null, leading to a null pointer dereference.\r\n* BadSource: Use a custom method which may return null\r\n* GoodSource: Use a custom method that never returns null\r\n* Sinks: trim\r\n* GoodSink: Check data for null before calling trim()\r\n* BadSink : Call trim() on possibly null object\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE690_NULL_Deref_From_Return;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE690_NULL_Deref_From_Return__Class_StringBuilder_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n StringBuilder data;\r\n\r\n /* POTENTIAL FLAW: Call getStringBuilderBad(), which may return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderBad();\r\n\r\n /* POTENTIAL FLAW: data could be null */\r\n String stringTrimmed = data.toString().trim();\r\n\r\n IO.writeLine(stringTrimmed);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n StringBuilder data;\r\n\r\n /* FIX: call getStringBuilderGood(), which will never return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderGood();\r\n\r\n /* POTENTIAL FLAW: data could be null */\r\n String stringTrimmed = data.toString().trim();\r\n\r\n IO.writeLine(stringTrimmed);\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n StringBuilder data;\r\n\r\n /* POTENTIAL FLAW: Call getStringBuilderBad(), which may return null */\r\n data = CWE690_NULL_Deref_From_Return__Class_Helper.getStringBuilderBad();\r\n\r\n /* FIX: explicit check for null */\r\n if (data != null)\r\n {\r\n String stringTrimmed = data.toString().trim();\r\n IO.writeLine(stringTrimmed);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-690 (NULL Deref From Return). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-690\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-690\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE690_NULL_Deref_From_Return/CWE690_NULL_Deref_From_Return__Class_StringBuilder_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"f9b1a2ea966ce5a4cbf7fab1902c3973365d500b68fd5350a3e063be961d99d7\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-690\", \"target_weakness\": \"NULL Deref From Return\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-698-a772698018b9", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE698_Redirect_Without_Exit__Servlet_01.java\r\nLabel Definition File: CWE698_Redirect_Without_Exit__Servlet.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 698 Redirect Without Exit\r\n* Sinks:\r\n* GoodSink: return after redirect\r\n* BadSink : perform actions after redirect\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE698_Redirect_Without_Exit;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE698_Redirect_Without_Exit__Servlet_01 extends AbstractTestCaseServlet\r\n{\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.sendRedirect(\"/test\");\r\n\r\n /* FLAW: code after the redirect is undefined */\r\n IO.writeLine(\"doing some more things here after the redirect\");\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n good1(request, response);\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n\r\n response.sendRedirect(\"/test\");\r\n /* FIX: no code after the redirect */\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-698 (Redirect Without Exit). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-698\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-698\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE698_Redirect_Without_Exit/CWE698_Redirect_Without_Exit__Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a772698018b96cc385752705b1bc5dce1d31e659b7366c8f6361ac720ef345f3\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-698\", \"target_weakness\": \"Redirect Without Exit\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-759-8e021225e790", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE759_Unsalted_One_Way_Hash__basic_01.java\r\nLabel Definition File: CWE759_Unsalted_One_Way_Hash__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 759 Use of one-way hash with no salt\r\n* Sinks:\r\n* GoodSink: use a sufficiently random salt\r\n* BadSink : SHA512 with no salt\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE759_Unsalted_One_Way_Hash;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.MessageDigest;\r\nimport java.security.SecureRandom;\r\n\r\npublic class CWE759_Unsalted_One_Way_Hash__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n MessageDigest hash = MessageDigest.getInstance(\"SHA-512\");\r\n\r\n /* FLAW: SHA512 with no salt */\r\n byte[] hashValue = hash.digest(\"hash me\".getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n MessageDigest hash = MessageDigest.getInstance(\"SHA-512\");\r\n\r\n /* FIX: Use a sufficiently random salt */\r\n SecureRandom prng = SecureRandom.getInstance(\"SHA1PRNG\");\r\n hash.update(prng.generateSeed(32));\r\n byte[] hashValue = hash.digest(\"hash me\".getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-759 (Unsalted One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-759\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-759\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE759_Unsalted_One_Way_Hash/CWE759_Unsalted_One_Way_Hash__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"8e021225e7900f0b9e8225326a93133cea05694689b7eeb6b19a4fb67dcbf005\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-759\", \"target_weakness\": \"Unsalted One Way Hash\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-760-d8b499ad87d8", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE760_Predictable_Salt_One_Way_Hash__basic_01.java\r\nLabel Definition File: CWE760_Predictable_Salt_One_Way_Hash__basic.label.xml\r\nTemplate File: point-flaw-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 760 Use of one-way hash with a predictable salt\r\n* Sinks:\r\n* GoodSink: SHA512 with a sufficiently random salt\r\n* BadSink : SHA512 with a predictable salt\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE760_Predictable_Salt_One_Way_Hash;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport java.security.MessageDigest;\r\nimport java.security.SecureRandom;\r\nimport java.util.Random;\r\n\r\npublic class CWE760_Predictable_Salt_One_Way_Hash__basic_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n\r\n Random random = new Random();\r\n\r\n MessageDigest hash = MessageDigest.getInstance(\"SHA-512\");\r\n /* FLAW: SHA512 with a predictable salt */\r\n hash.update((Integer.toString(random.nextInt())).getBytes(\"UTF-8\"));\r\n byte[] hashValue = hash.digest(\"hash me\".getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n good1();\r\n }\r\n\r\n private void good1() throws Throwable\r\n {\r\n\r\n SecureRandom secureRandom = new SecureRandom();\r\n\r\n MessageDigest hash = MessageDigest.getInstance(\"SHA-512\");\r\n /* FIX: Use a sufficiently random salt */\r\n SecureRandom prng = SecureRandom.getInstance(\"SHA1PRNG\");\r\n hash.update(prng.generateSeed(32));\r\n byte[] hashValue = hash.digest(\"hash me\".getBytes(\"UTF-8\"));\r\n\r\n IO.writeLine(IO.toHex(hashValue));\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-760 (Predictable Salt One Way Hash). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-760\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-760\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE760_Predictable_Salt_One_Way_Hash/CWE760_Predictable_Salt_One_Way_Hash__basic_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"d8b499ad87d85b72edc4f59bef00babb2b4c443001eacab26c1ddb1278937b78\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-760\", \"target_weakness\": \"Predictable Salt One Way Hash\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-764-49c3e864a053", "input": "/*\r\n * @description Demonstrates use of lock() more times than unlock() in a Servlet that updates a shared variable. Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\npackage testcases.CWE764_Multiple_Locks;\r\n\r\nimport java.util.concurrent.locks.ReentrantLock;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE764_Multiple_Locks__ReentrantLock_Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* bad(): Use lock() twice and unlock() once */\r\n static private int intBad = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_BAD = new ReentrantLock();\r\n\r\n static public void helperBad() \r\n {\r\n REENTRANT_LOCK_BAD.lock(); \r\n REENTRANT_LOCK_BAD.lock(); /* FLAW: Code uses lock() twice (and unlock() once), so no other threads will ever be able to get lock */\r\n\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intBad = intBad * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_BAD.unlock(); /* Only one unlock(), so the lock will still be held when the thread ends, meaning no other threads can get the lock */\r\n }\r\n }\r\n\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n helperBad();\r\n response.getWriter().write(intBad);\r\n }\r\n\r\n /* good1(): Use a ReentrantLock properly (use lock() once and unlock() once) */\r\n static private int intGood1 = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_GOOD1 = new ReentrantLock();\r\n\r\n static public void helperGood1() \r\n {\r\n REENTRANT_LOCK_GOOD1.lock(); /* FIX: Only use lock() once */\r\n\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intGood1 = intGood1 * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_GOOD1.unlock();\r\n }\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n { \r\n helperGood1();\r\n response.getWriter().write(intGood1);\r\n } \r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n good1(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-764 (Multiple Locks). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-764\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-764\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE764_Multiple_Locks/CWE764_Multiple_Locks__ReentrantLock_Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"49c3e864a0535eb90eae45e27f015efe399812547c91ca2ba70da4464229c333\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-764\", \"target_weakness\": \"Multiple Locks\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-765-d68dcbaf521b", "input": "/*\r\n * @description Demonstrates use of unlock() more times than lock() in a Servlet that updates a shared variable. Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\npackage testcases.CWE765_Multiple_Unlocks;\r\n\r\nimport java.util.concurrent.locks.ReentrantLock;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE765_Multiple_Unlocks__ReentrantLock_Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* bad(): Use lock() twice and unlock() once */\r\n static private int intBad = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_BAD = new ReentrantLock();\r\n\r\n static public void helperBad() \r\n {\r\n REENTRANT_LOCK_BAD.lock(); \r\n\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intBad = intBad * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_BAD.unlock(); \r\n REENTRANT_LOCK_BAD.unlock(); /* FLAW: Code uses unlock() twice (and lock() once), which will throw an IllegalMonitorStateException */\r\n }\r\n }\r\n\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n helperBad();\r\n response.getWriter().write(intBad);\r\n }\r\n\r\n /* good1(): Use a ReentrantLock properly (use lock() once and unlock() once) */\r\n static private int intGood1 = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_GOOD1 = new ReentrantLock();\r\n\r\n static public void helperGood1() \r\n {\r\n REENTRANT_LOCK_GOOD1.lock(); \r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intGood1 = intGood1 * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_GOOD1.unlock(); /* FIX: Only use unlock() once */\r\n }\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n { \r\n helperGood1();\r\n response.getWriter().write(intGood1);\r\n } \r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n good1(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-765 (Multiple Unlocks). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-765\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-765\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE765_Multiple_Unlocks/CWE765_Multiple_Unlocks__ReentrantLock_Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"d68dcbaf521bc4d4c36ec3839d923459b0259f9defa0362aa874c615b5d9f82a\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-765\", \"target_weakness\": \"Multiple Unlocks\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-78-4e7c2a2b7d5b", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE78_OS_Command_Injection__Environment_01.java\r\nLabel Definition File: CWE78_OS_Command_Injection.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 78 OS Command Injection\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* BadSink: exec dynamic command execution with Runtime.getRuntime().exec()\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE78_OS_Command_Injection;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\npublic class CWE78_OS_Command_Injection__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n String osCommand;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n osCommand = \"c:\\\\WINDOWS\\\\SYSTEM32\\\\cmd.exe /c dir \";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n osCommand = \"/bin/ls \";\r\n }\r\n\r\n /* POTENTIAL FLAW: command injection */\r\n Process process = Runtime.getRuntime().exec(osCommand + data);\r\n process.waitFor();\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n String osCommand;\r\n if(System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0)\r\n {\r\n /* running on Windows */\r\n osCommand = \"c:\\\\WINDOWS\\\\SYSTEM32\\\\cmd.exe /c dir \";\r\n }\r\n else\r\n {\r\n /* running on non-Windows */\r\n osCommand = \"/bin/ls \";\r\n }\r\n\r\n /* POTENTIAL FLAW: command injection */\r\n Process process = Runtime.getRuntime().exec(osCommand + data);\r\n process.waitFor();\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-78 (OS Command Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-78\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-78\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE78_OS_Command_Injection/CWE78_OS_Command_Injection__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"4e7c2a2b7d5b613f10c7517ac9f1a3198cd32f2ce4ef3c81be0f4bca3645ddf6\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-78\", \"target_weakness\": \"OS Command Injection\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-789-5f5321f63bcf", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE789_Uncontrolled_Mem_Alloc__Environment_ArrayList_01.java\r\nLabel Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 789 Uncontrolled Memory Allocation\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* BadSink: ArrayList Create an ArrayList using data as the initial size\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE789_Uncontrolled_Mem_Alloc.s01;\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\nimport java.util.ArrayList;\r\n\r\npublic class CWE789_Uncontrolled_Mem_Alloc__Environment_ArrayList_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n int data;\r\n\r\n data = Integer.MIN_VALUE; /* Initialize data */\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n {\r\n String stringNumber = System.getenv(\"ADD\");\r\n if (stringNumber != null) // avoid NPD incidental warnings\r\n {\r\n try\r\n {\r\n data = Integer.parseInt(stringNumber.trim());\r\n }\r\n catch(NumberFormatException exceptNumberFormat)\r\n {\r\n IO.logger.log(Level.WARNING, \"Number format exception parsing data from string\", exceptNumberFormat);\r\n }\r\n }\r\n }\r\n\r\n /* POTENTIAL FLAW: Create an ArrayList using data as the initial size. data may be very large, creating memory issues */\r\n ArrayList intArrayList = new ArrayList(data);\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n int data;\r\n\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n data = 2;\r\n\r\n /* POTENTIAL FLAW: Create an ArrayList using data as the initial size. data may be very large, creating memory issues */\r\n ArrayList intArrayList = new ArrayList(data);\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-789 (Uncontrolled Mem Alloc). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-789\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-789\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE789_Uncontrolled_Mem_Alloc/s01/CWE789_Uncontrolled_Mem_Alloc__Environment_ArrayList_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5f5321f63bcfb02edf559ac852d61cfcf146bf74bcdc152bfb32e1f1dc541bae\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-789\", \"target_weakness\": \"Uncontrolled Mem Alloc\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-81-e78b3f154c62", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE81_XSS_Error_Message__Servlet_File_01.java\r\nLabel Definition File: CWE81_XSS_Error_Message__Servlet.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 81 Cross Site Scripting (XSS) in Error Message\r\n* BadSource: File Read data from file (named c:\\data.txt)\r\n* GoodSource: A hardcoded string\r\n* BadSink: sendErrorServlet XSS in sendError\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE81_XSS_Error_Message;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.FileInputStream;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE81_XSS_Error_Message__Servlet_File_01 extends AbstractTestCaseServlet\r\n{\r\n /* uses badsource and badsink */\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n data = \"\"; /* Initialize data */\r\n {\r\n File file = new File(\"C:\\\\data.txt\");\r\n FileInputStream streamFileInput = null;\r\n InputStreamReader readerInputStream = null;\r\n BufferedReader readerBuffered = null;\r\n\r\n try\r\n {\r\n /* read string from file into data */\r\n streamFileInput = new FileInputStream(file);\r\n readerInputStream = new InputStreamReader(streamFileInput, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* POTENTIAL FLAW: Read data from a file */\r\n /* This will be reading the first \"line\" of the file, which\r\n * could be very long if there are little or no newlines in the file */\r\n data = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: script code (e.g. id=) is sent to the client;\r\n * The built-in J2EE server automatically does some HTML entity encoding.\r\n * Therefore, to test this, change response.sendError to response.getWriter().println and remove the 404,\r\n */\r\n response.sendError(404, \"
bad() - Parameter name has value \" + data);\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: script code (e.g. id=) is sent to the client;\r\n * The built-in J2EE server automatically does some HTML entity encoding.\r\n * Therefore, to test this, change response.sendError to response.getWriter().println and remove the 404,\r\n */\r\n response.sendError(404, \"
bad() - Parameter name has value \" + data);\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-81 (XSS Error Message). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-81\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-81\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE81_XSS_Error_Message/CWE81_XSS_Error_Message__Servlet_File_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"e78b3f154c62204f7016b0ec428fab6d4b7f9a6a9da2738093cf1f4cd26712b5\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-81\", \"target_weakness\": \"XSS Error Message\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-83-49f87ebcd8b7", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE83_XSS_Attribute__Servlet_File_01.java\r\nLabel Definition File: CWE83_XSS_Attribute__Servlet.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 83 Cross Site Scripting (XSS) in attributes; Examples(replace QUOTE with an actual double quote): ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEalert(1) and ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEjavascript:alert(1)\r\n* BadSource: File Read data from file (named c:\\data.txt)\r\n* GoodSource: A hardcoded string\r\n* BadSink: printlnServlet XSS in img src attribute\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE83_XSS_Attribute;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.io.BufferedReader;\r\nimport java.io.InputStreamReader;\r\nimport java.io.FileInputStream;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE83_XSS_Attribute__Servlet_File_01 extends AbstractTestCaseServlet\r\n{\r\n /* uses badsource and badsink */\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n data = \"\"; /* Initialize data */\r\n {\r\n File file = new File(\"C:\\\\data.txt\");\r\n FileInputStream streamFileInput = null;\r\n InputStreamReader readerInputStream = null;\r\n BufferedReader readerBuffered = null;\r\n\r\n try\r\n {\r\n /* read string from file into data */\r\n streamFileInput = new FileInputStream(file);\r\n readerInputStream = new InputStreamReader(streamFileInput, \"UTF-8\");\r\n readerBuffered = new BufferedReader(readerInputStream);\r\n\r\n /* POTENTIAL FLAW: Read data from a file */\r\n /* This will be reading the first \"line\" of the file, which\r\n * could be very long if there are little or no newlines in the file */\r\n data = readerBuffered.readLine();\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error with stream reading\", exceptIO);\r\n }\r\n finally\r\n {\r\n /* Close stream reading objects */\r\n try\r\n {\r\n if (readerBuffered != null)\r\n {\r\n readerBuffered.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing BufferedReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (readerInputStream != null)\r\n {\r\n readerInputStream.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing InputStreamReader\", exceptIO);\r\n }\r\n\r\n try\r\n {\r\n if (streamFileInput != null)\r\n {\r\n streamFileInput.close();\r\n }\r\n }\r\n catch (IOException exceptIO)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing FileInputStream\", exceptIO);\r\n }\r\n }\r\n }\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */\r\n response.getWriter().println(\"
bad() -
\");\r\n }\r\n\r\n }\r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n goodG2B(request, response);\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n if (data != null)\r\n {\r\n /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */\r\n response.getWriter().println(\"
bad() -
\");\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-83 (XSS Attribute). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-83\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-83\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE83_XSS_Attribute/CWE83_XSS_Attribute__Servlet_File_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"49f87ebcd8b71082cd3a8b45878ddf4f12047b21e592f8c9f24ab0c7cdfb4ba0\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-83\", \"target_weakness\": \"XSS Attribute\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-832-a0b4333b0060", "input": "/*\r\n * @description Demonstrates use of unlock() more times than lock() in a Servlet that updates a shared variable. Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\npackage testcases.CWE832_Unlock_Not_Locked;\r\n\r\nimport java.util.concurrent.locks.ReentrantLock;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE832_Unlock_Not_Locked__ReentrantLock_Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* bad(): Use unlock() on resource that is not locked */\r\n static private int intBad = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_BAD = new ReentrantLock();\r\n\r\n static public void helperBad() /* FLAW: No synchronization or locks in this function */\r\n {\r\n /* Missing lock here */\r\n\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intBad = intBad * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_BAD.unlock(); /* FLAW: Calls unlock() on a lock which is not locked, which will throw an IllegalMonitorStateException */\r\n }\r\n }\r\n \r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n helperBad();\r\n response.getWriter().write(intBad);\r\n }\r\n \r\n /* good1(): Use a ReentrantLock properly (use lock() once and unlock() once) */\r\n static private int intGood1 = 1;\r\n static private final ReentrantLock REENTRANT_LOCK_GOOD1 = new ReentrantLock();\r\n\r\n static public void helperGood1() \r\n {\r\n REENTRANT_LOCK_GOOD1.lock(); /* Inserted lock here that was missing in bad() */\r\n /* good practice is to unlock() in a finally block, see\r\n\t\t * http://download.oracle.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html */\r\n try\r\n { \r\n intGood1 = intGood1 * 2;\r\n } \r\n finally \r\n {\r\n REENTRANT_LOCK_GOOD1.unlock(); /* FIX: Only unlock() a lock that has been locked. */\r\n }\r\n }\r\n\r\n private void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable\r\n { \r\n helperGood1();\r\n response.getWriter().write(intGood1);\r\n } \r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n good1(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-832 (Unlock Not Locked). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-832\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-832\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE832_Unlock_Not_Locked/CWE832_Unlock_Not_Locked__ReentrantLock_Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a0b4333b006044c7d4d46afcfb3c7147619cda915f3667ebf118b3cb527f8554\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-832\", \"target_weakness\": \"Unlock Not Locked\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-833-9f5f7f24ee92", "input": "/*\r\n * @description Demonstrates a deadlock caused by obtaining locks in a different order in different functions in a Servlet that accesses shared variables. Servlets are inherently multithreaded, so we don't need to actually start threads in the bad() and goodX() functions.\r\n * \r\n * */\r\npackage testcases.CWE833_Deadlock;\r\n\r\nimport java.util.concurrent.locks.ReentrantLock;\r\n\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\nimport testcasesupport.AbstractTestCaseServlet;\r\n\r\npublic class CWE833_Deadlock__ReentrantLock_Servlet_01 extends AbstractTestCaseServlet \r\n{\r\n private static final long serialVersionUID = 1L;\r\n\r\n /* bad(): Obtain locks in different order in helperAddBad and helperMultiplyBad, causing a deadlock */\r\n static private int intBadNumber1 = 3;\r\n static private final ReentrantLock BAD_NUMBER1_REENTRANTLOCK = new ReentrantLock();\r\n\r\n static private int intBadNumber2 = 5;\r\n static private final ReentrantLock BAD_NUMBER2_REENTRANTLOCK = new ReentrantLock();\r\n\r\n static public void helperAddBad()\r\n {\r\n BAD_NUMBER1_REENTRANTLOCK.lock();\r\n\r\n /* Would like to wait a bit here to allow for a context switch or for another thread to \"catch up\", but we can't call Thread.sleep() since\r\n\t\t * that is not allowed in a Servlet (CWE-383: J2EE Bad Practices: Direct Use of Threads) */ \r\n\r\n BAD_NUMBER2_REENTRANTLOCK.lock();\r\n \r\n try \r\n {\r\n intBadNumber1 = intBadNumber1 + intBadNumber2;\r\n } \r\n finally \r\n {\r\n BAD_NUMBER2_REENTRANTLOCK.unlock();\r\n BAD_NUMBER1_REENTRANTLOCK.unlock();\r\n }\r\n }\r\n\r\n static public void helperMultiplyBad()\r\n {\r\n /* FLAW: obtain locks in the opposite order as in helperAddBad() */\r\n BAD_NUMBER2_REENTRANTLOCK.lock(); \r\n\r\n /* Would like to wait a bit here to allow for a context switch or for another thread to \"catch up\", but we can't call Thread.sleep() since\r\n\t\t * that is not allowed in a Servlet (CWE-383: J2EE Bad Practices: Direct Use of Threads) */ \r\n\r\n BAD_NUMBER1_REENTRANTLOCK.lock();\r\n try \r\n {\r\n intBadNumber1 = intBadNumber1 * intBadNumber2;\r\n } \r\n finally \r\n {\r\n BAD_NUMBER1_REENTRANTLOCK.unlock();\r\n BAD_NUMBER2_REENTRANTLOCK.unlock();\r\n }\r\n } \r\n\r\n public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n /* Branch so that not all requests call the same method. If a valid request and an invalid\r\n * one come in at the same time, a deadlock will result */\r\n if(request.isRequestedSessionIdValid()) \r\n {\r\n helperAddBad();\r\n } \r\n else \r\n {\r\n helperMultiplyBad();\r\n }\r\n\r\n /* write output */\r\n response.getWriter().write(intBadNumber1);\r\n }\r\n\r\n /* good1() - obtain locks in same order in helperAddGood1() and helperMultiplyGood1() */\r\n static private int intGood1Number1 = 3;\r\n static private final ReentrantLock GOOD1_NUMBER1_REENTRANTLOCK = new ReentrantLock();\r\n\r\n static private int intGood1Number2 = 5;\r\n static private final ReentrantLock GOOD1_NUMBER2_REENTRANTLOCK = new ReentrantLock();\r\n\r\n static public void helperAddGood1()\r\n {\r\n GOOD1_NUMBER1_REENTRANTLOCK.lock();\r\n\r\n /* Would like to wait a bit here to allow for a context switch or for another thread to \"catch up\", but we can't call Thread.sleep() since\r\n\t\t * that is not allowed in a Servlet (CWE-383: J2EE Bad Practices: Direct Use of Threads) */ \r\n\r\n GOOD1_NUMBER2_REENTRANTLOCK.lock();\r\n try \r\n {\r\n intGood1Number1 = intGood1Number1 + intGood1Number2;\r\n } \r\n finally \r\n {\r\n GOOD1_NUMBER2_REENTRANTLOCK.unlock();\r\n GOOD1_NUMBER1_REENTRANTLOCK.unlock();\r\n }\r\n }\r\n\r\n static public void helperMultiplyGood1()\r\n {\r\n /* FIX: obtain locks in the same order as in helperAddGood1() */\r\n GOOD1_NUMBER1_REENTRANTLOCK.lock(); \r\n\r\n /* Would like to wait a bit here to allow for a context switch or for another thread to \"catch up\", but we can't call Thread.sleep() since\r\n\t\t * that is not allowed in a Servlet (CWE-383: J2EE Bad Practices: Direct Use of Threads) */ \r\n\r\n GOOD1_NUMBER2_REENTRANTLOCK.lock();\r\n try \r\n {\r\n intGood1Number1 = intGood1Number1 * intGood1Number2;\r\n } \r\n finally \r\n {\r\n GOOD1_NUMBER2_REENTRANTLOCK.unlock();\r\n GOOD1_NUMBER1_REENTRANTLOCK.unlock();\r\n }\r\n } \r\n\r\n public void good1(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n /* Branch so that not all requests call the same method. */\r\n if(request.isRequestedSessionIdValid()) \r\n {\r\n helperAddGood1();\r\n }\r\n else \r\n {\r\n helperMultiplyGood1();\r\n }\r\n\r\n /* write output */\r\n response.getWriter().write(intGood1Number1);\r\n } \r\n\r\n public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable \r\n {\r\n good1(request, response);\r\n } \r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-833 (Deadlock). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-833\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-833\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE833_Deadlock/CWE833_Deadlock__ReentrantLock_Servlet_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"9f5f7f24ee92e50e68805367f1ac580f6e03ea930504dbb5ca0ea1705b4ac591\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-833\", \"target_weakness\": \"Deadlock\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-835-5ce8072b142d", "input": "/*\r\n * @description Infinite loop - do{}while()\r\n *\r\n * */\r\n\r\npackage testcases.CWE835_Infinite_Loop;\r\n\r\nimport testcasesupport.*;\r\n\r\npublic class CWE835_Infinite_Loop__do_01 extends AbstractTestCase \r\n{\r\n \r\n public void bad()\r\n {\r\n int i = 0;\r\n \r\n /* FLAW: Infinite Loop - do{} with no break point */\r\n do \r\n {\r\n IO.writeLine(i);\r\n i = (i + 1) % 256;\r\n } while(i >= 0);\r\n }\r\n \r\n private void good1() \r\n {\r\n int i = 0;\r\n\r\n do \r\n {\r\n /* FIX: Add a break point for the loop if i = 10 */\r\n if (i == 10) \r\n { \r\n break; \r\n }\r\n \r\n IO.writeLine(i);\r\n i = (i + 1) % 256;\r\n } while(i >= 0);\r\n }\r\n \r\n public void good() \r\n {\r\n good1();\r\n } \r\n \r\n /* Below is the main(). It is only used when building this testcase on \r\n * its own for testing or for building a binary to use in testing binary \r\n * analysis tools. It is not used when compiling all the testcases as one \r\n * application, which is how source code analysis tools are tested. \r\n\t */ \r\n public static void main(String[] args) \r\n throws ClassNotFoundException, InstantiationException, IllegalAccessException \r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-835 (Infinite Loop). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-835\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-835\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE835_Infinite_Loop/CWE835_Infinite_Loop__do_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"5ce8072b142d694c4029a8c80000b852489b62e490f26affd8301766581e0063\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-835\", \"target_weakness\": \"Infinite Loop\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-89-c3d56fe9bd33", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE89_SQL_Injection__Environment_executeBatch_01.java\r\nLabel Definition File: CWE89_SQL_Injection.label.xml\r\nTemplate File: sources-sinks-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 89 SQL Injection\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* Sinks: executeBatch\r\n* GoodSink: Use prepared statement and executeBatch (properly)\r\n* BadSink : data concatenated into SQL statement used in executeBatch(), which could result in SQL Injection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE89_SQL_Injection.s01;\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport java.sql.*;\r\n\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE89_SQL_Injection__Environment_executeBatch_01 extends AbstractTestCase\r\n{\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n if (data != null)\r\n {\r\n String names[] = data.split(\"-\");\r\n int successCount = 0;\r\n Connection dbConnection = null;\r\n Statement sqlStatement = null;\r\n try\r\n {\r\n dbConnection = IO.getDBConnection();\r\n sqlStatement = dbConnection.createStatement();\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n /* POTENTIAL FLAW: data concatenated into SQL statement used in executeBatch(), which could result in SQL Injection */\r\n sqlStatement.addBatch(\"update users set hitcount=hitcount+1 where name='\" + names[i] + \"'\");\r\n }\r\n int resultsArray[] = sqlStatement.executeBatch();\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n if (resultsArray[i] > 0)\r\n {\r\n successCount++;\r\n }\r\n }\r\n IO.writeLine(\"Succeeded in \" + successCount + \" out of \" + names.length + \" queries.\");\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (sqlStatement != null)\r\n {\r\n sqlStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Statament\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n goodB2G();\r\n }\r\n\r\n /* goodG2B() - use goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n if (data != null)\r\n {\r\n String names[] = data.split(\"-\");\r\n int successCount = 0;\r\n Connection dbConnection = null;\r\n Statement sqlStatement = null;\r\n try\r\n {\r\n dbConnection = IO.getDBConnection();\r\n sqlStatement = dbConnection.createStatement();\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n /* POTENTIAL FLAW: data concatenated into SQL statement used in executeBatch(), which could result in SQL Injection */\r\n sqlStatement.addBatch(\"update users set hitcount=hitcount+1 where name='\" + names[i] + \"'\");\r\n }\r\n int resultsArray[] = sqlStatement.executeBatch();\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n if (resultsArray[i] > 0)\r\n {\r\n successCount++;\r\n }\r\n }\r\n IO.writeLine(\"Succeeded in \" + successCount + \" out of \" + names.length + \" queries.\");\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (sqlStatement != null)\r\n {\r\n sqlStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Statament\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void goodB2G() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n if (data != null)\r\n {\r\n String names[] = data.split(\"-\");\r\n int successCount = 0;\r\n Connection dbConnection = null;\r\n PreparedStatement sqlStatement = null;\r\n try\r\n {\r\n /* FIX: Use prepared statement and executeBatch (properly) */\r\n dbConnection = IO.getDBConnection();\r\n sqlStatement = dbConnection.prepareStatement(\"update users set hitcount=hitcount+1 where name=?\");\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n sqlStatement.setString(1, names[i]);\r\n sqlStatement.addBatch();\r\n }\r\n int resultsArray[] = sqlStatement.executeBatch();\r\n for (int i = 0; i < names.length; i++)\r\n {\r\n if (resultsArray[i] > 0)\r\n {\r\n successCount++;\r\n }\r\n }\r\n IO.writeLine(\"Succeeded in \" + successCount + \" out of \" + names.length + \" queries.\");\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error getting database connection\", exceptSql);\r\n }\r\n finally\r\n {\r\n try\r\n {\r\n if (sqlStatement != null)\r\n {\r\n sqlStatement.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing PreparedStatement\", exceptSql);\r\n }\r\n\r\n try\r\n {\r\n if (dbConnection != null)\r\n {\r\n dbConnection.close();\r\n }\r\n }\r\n catch (SQLException exceptSql)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing Connection\", exceptSql);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-89 (SQL Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-89\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodB2G\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-89\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE89_SQL_Injection/s01/CWE89_SQL_Injection__Environment_executeBatch_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"c3d56fe9bd330c5866eab120619aa606c0c3f2b1b3506995509ac2b8bb3a808a\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-89\", \"target_weakness\": \"SQL Injection\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}
-{"domain": "secure_coding", "id": "juliet-java-cwe-90-a75332d361bb", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE90_LDAP_Injection__Environment_01.java\r\nLabel Definition File: CWE90_LDAP_Injection.label.xml\r\nTemplate File: sources-sink-01.tmpl.java\r\n*/\r\n/*\r\n* @description\r\n* CWE: 90 LDAP Injection\r\n* BadSource: Environment Read data from an environment variable\r\n* GoodSource: A hardcoded string\r\n* BadSink: data concatenated into LDAP search, which could result in LDAP Injection\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\npackage testcases.CWE90_LDAP_Injection;\r\n\r\nimport testcasesupport.*;\r\n\r\nimport javax.servlet.http.*;\r\n\r\nimport javax.naming.*;\r\nimport javax.naming.directory.*;\r\n\r\nimport java.util.Hashtable;\r\nimport java.util.logging.Level;\r\n\r\npublic class CWE90_LDAP_Injection__Environment_01 extends AbstractTestCase\r\n{\r\n /* uses badsource and badsink */\r\n public void bad() throws Throwable\r\n {\r\n String data;\r\n\r\n /* get environment variable ADD */\r\n /* POTENTIAL FLAW: Read data from an environment variable */\r\n data = System.getenv(\"ADD\");\r\n\r\n Hashtable environmentHashTable = new Hashtable();\r\n environmentHashTable.put(Context.INITIAL_CONTEXT_FACTORY,\"com.sun.jndi.ldap.LdapCtxFactory\");\r\n environmentHashTable.put(Context.PROVIDER_URL, \"ldap://localhost:389\");\r\n DirContext directoryContext = null;\r\n\r\n try\r\n {\r\n directoryContext = new InitialDirContext(environmentHashTable);\r\n /* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection */\r\n String search = \"(cn=\" + data + \")\";\r\n\r\n NamingEnumeration answer = directoryContext.search(\"\", search, null);\r\n while (answer.hasMore())\r\n {\r\n SearchResult searchResult = answer.next();\r\n Attributes attributes = searchResult.getAttributes();\r\n NamingEnumeration> allAttributes = attributes.getAll();\r\n while (allAttributes.hasMore())\r\n {\r\n Attribute attribute = (Attribute) allAttributes.next();\r\n NamingEnumeration> allValues = attribute.getAll();\r\n while(allValues.hasMore())\r\n {\r\n IO.writeLine(\" Value: \" + allValues.next().toString());\r\n }\r\n }\r\n }\r\n }\r\n catch (NamingException exceptNaming)\r\n {\r\n IO.logger.log(Level.WARNING, \"The LDAP service was not found or login failed.\", exceptNaming);\r\n }\r\n finally\r\n {\r\n if (directoryContext != null)\r\n {\r\n try\r\n {\r\n directoryContext.close();\r\n }\r\n catch (NamingException exceptNaming)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing DirContext\", exceptNaming);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n public void good() throws Throwable\r\n {\r\n goodG2B();\r\n }\r\n\r\n /* goodG2B() - uses goodsource and badsink */\r\n private void goodG2B() throws Throwable\r\n {\r\n String data;\r\n\r\n /* FIX: Use a hardcoded string */\r\n data = \"foo\";\r\n\r\n Hashtable environmentHashTable = new Hashtable();\r\n environmentHashTable.put(Context.INITIAL_CONTEXT_FACTORY,\"com.sun.jndi.ldap.LdapCtxFactory\");\r\n environmentHashTable.put(Context.PROVIDER_URL, \"ldap://localhost:389\");\r\n DirContext directoryContext = null;\r\n\r\n try\r\n {\r\n directoryContext = new InitialDirContext(environmentHashTable);\r\n /* POTENTIAL FLAW: data concatenated into LDAP search, which could result in LDAP Injection */\r\n String search = \"(cn=\" + data + \")\";\r\n\r\n NamingEnumeration answer = directoryContext.search(\"\", search, null);\r\n while (answer.hasMore())\r\n {\r\n SearchResult searchResult = answer.next();\r\n Attributes attributes = searchResult.getAttributes();\r\n NamingEnumeration> allAttributes = attributes.getAll();\r\n while (allAttributes.hasMore())\r\n {\r\n Attribute attribute = (Attribute) allAttributes.next();\r\n NamingEnumeration> allValues = attribute.getAll();\r\n while(allValues.hasMore())\r\n {\r\n IO.writeLine(\" Value: \" + allValues.next().toString());\r\n }\r\n }\r\n }\r\n }\r\n catch (NamingException exceptNaming)\r\n {\r\n IO.logger.log(Level.WARNING, \"The LDAP service was not found or login failed.\", exceptNaming);\r\n }\r\n finally\r\n {\r\n if (directoryContext != null)\r\n {\r\n try\r\n {\r\n directoryContext.close();\r\n }\r\n catch (NamingException exceptNaming)\r\n {\r\n IO.logger.log(Level.WARNING, \"Error closing DirContext\", exceptNaming);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n /* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n public static void main(String[] args) throws ClassNotFoundException,\r\n InstantiationException, IllegalAccessException\r\n {\r\n mainFromParent(args);\r\n }\r\n}\r\n\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-90 (LDAP Injection). Identifikasi metode berlabel Bad dan Good menurut struktur kasus uji, lalu kembalikan JSON dengan nama metode dan cakupan label. Jangan menyimpulkan bahwa seluruh program aman di produksi hanya dari label Juliet.", "labels_json": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-90\"}", "language": "Java", "output": "{\"bad_method_names\": [\"bad\"], \"good_method_names\": [\"good\", \"goodG2B\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-90\"}", "provenance_json": "{\"ground_truth_basis\": \"Explicit Bad/Good method names in the selected Juliet test-case source file; labels are source-derived, not LLM-generated.\", \"selection_policy\": \"First lexicographic test-case file per language and CWE containing explicit Bad and Good* methods; excludes support libraries, binaries, and files with explicit third-party SPDX/copyright headers.\", \"source_download_url\": \"https://samate.nist.gov/SARD/downloads/test-suites/2017-10-01-juliet-test-suite-for-java-v1-3.zip\", \"source_file\": \"Java/src/testcases/CWE90_LDAP_Injection/CWE90_LDAP_Injection__Environment_01.java\", \"source_license\": \"US public domain; CC0 1.0 to the extent NIST may claim foreign rights, as stated on the official suite page\", \"source_sha256\": \"a75332d361bb59d4f4d470c0b88bfe3b45a0d3e862bdde035e3705d5a391dfca\", \"source_suite\": \"Juliet Java 1.3\", \"source_suite_id\": \"111\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/111\", \"target_cwe\": \"CWE-90\", \"target_weakness\": \"LDAP Injection\"}", "source": "Juliet Java 1.3", "split": "train", "task_type": "paired_security_review"}