diff --git "a/data/validation.jsonl" "b/data/validation.jsonl" new file mode 100644--- /dev/null +++ "b/data/validation.jsonl" @@ -0,0 +1,18 @@ +{"domain": "secure_coding", "id": "juliet-csharp-cwe-134-d42e5d07971b", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE134_Externally_Controlled_Format_String__Connect_tcp_Format_01.cs\r\nLabel Definition File: CWE134_Externally_Controlled_Format_String.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 134 Externally Controlled Format String\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* Sinks: Format\r\n* GoodSink: console write formatted using string.Format\r\n* BadSink : console write formatted without 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\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE134_Externally_Controlled_Format_String\r\n{\r\nclass CWE134_Externally_Controlled_Format_String__Connect_tcp_Format_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 if (data != null)\r\n {\r\n /* POTENTIAL FLAW: uncontrolled string formatting */\r\n Console.Write(string.Format(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 if (data != null)\r\n {\r\n /* POTENTIAL FLAW: uncontrolled string formatting */\r\n Console.Write(string.Format(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 if (data != null)\r\n {\r\n /* FIX: explicitly defined string formatting */\r\n Console.Write(string.Format(\"{0}{1}\", data, Environment.NewLine));\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-134 (Externally Controlled Format String). 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-134\"}", "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-134\"}", "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/CWE134_Externally_Controlled_Format_String/CWE134_Externally_Controlled_Format_String__Connect_tcp_Format_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\": \"d42e5d07971b268408cae7687f26e7cb84eb5c84d8c39e1f4923fecfe2856520\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-134\", \"target_weakness\": \"Externally Controlled Format String\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-193-fc0119932973", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE193_Off_by_One_Error__do_01.cs\r\nLabel Definition File: CWE193_Off_by_One_Error.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 193 An array index is 1 off from the max array index\r\n* Sinks: do\r\n* GoodSink: restrict max index value\r\n* BadSink : access array index outside array max\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nnamespace testcases.CWE193_Off_by_One_Error\r\n{\r\nclass CWE193_Off_by_One_Error__do_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int[] intArray = new int[10];\r\n int i = 0;\r\n do\r\n {\r\n IO.WriteLine(\"intArray[\" + i + \"] = \" + (intArray[i] = i));\r\n i++;\r\n }\r\n while (i <= intArray.Length); /* FLAW: Use <= rather than < */\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[] intArray = new int[10];\r\n int i = 0;\r\n do\r\n {\r\n IO.WriteLine(\"intArray[\" + i + \"] = \" + (intArray[i] = i));\r\n i++;\r\n }\r\n while (i < intArray.Length); /* FIX: Use < to ensure no out of bounds access */\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-193 (Off by One 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-193\"}", "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-193\"}", "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/CWE193_Off_by_One_Error/CWE193_Off_by_One_Error__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\": \"fc011993297380973a56407c30d71199fa7784463a1de6e9825814a0fffbdc2c\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-193\", \"target_weakness\": \"Off by One Error\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-314-4515c740534e", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE314_Cleartext_Storage_in_the_Registry__Connect_tcp_01.cs\r\nLabel Definition File: CWE314_Cleartext_Storage_in_the_Registry.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 314 Cleartext storage in the registry\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 registry\r\n* Flow Variant: 01 Baseline\r\n*\r\n* */\r\n\r\nusing TestCaseSupport;\r\nusing System;\r\n\r\nusing Microsoft.Win32;\r\nusing System.Security;\r\nusing System.Security.Cryptography;\r\nusing System.Text;\r\nusing System.Web;\r\n\r\nusing System.IO;\r\nusing System.Net.Sockets;\r\n\r\nnamespace testcases.CWE314_Cleartext_Storage_in_the_Registry\r\n{\r\nclass CWE314_Cleartext_Storage_in_the_Registry__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 registry */\r\n RegistryKey key = Registry.CurrentUser.OpenSubKey(\"Software\", true);\r\n key.CreateSubKey(\"CWEparent\");\r\n key = key.OpenSubKey(\"CWEparent\", true);\r\n key.CreateSubKey(\"TestingCWE\");\r\n key = key.OpenSubKey(\"TestingCWE\", true);\r\n key.SetValue(\"CWE\", secureData);\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 registry */\r\n RegistryKey key = Registry.CurrentUser.OpenSubKey(\"Software\", true);\r\n key.CreateSubKey(\"CWEparent\");\r\n key = key.OpenSubKey(\"CWEparent\", true);\r\n key.CreateSubKey(\"TestingCWE\");\r\n key = key.OpenSubKey(\"TestingCWE\", true);\r\n key.SetValue(\"CWE\", secureData);\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 registry */\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 RegistryKey key = Registry.CurrentUser.OpenSubKey(\"Software\", true);\r\n key.CreateSubKey(\"CWEparent\");\r\n key = key.OpenSubKey(\"CWEparent\", true);\r\n key.CreateSubKey(\"TestingCWE\");\r\n key = key.OpenSubKey(\"TestingCWE\", true);\r\n key.SetValue(\"CWE\", secureData);\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-314 (Cleartext Storage in the Registry). 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-314\"}", "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-314\"}", "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/CWE314_Cleartext_Storage_in_the_Registry/CWE314_Cleartext_Storage_in_the_Registry__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\": \"4515c740534e0ac7a10de5a996ee3247182b68f79d807c524b89c36e5ba43346\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-314\", \"target_weakness\": \"Cleartext Storage in the Registry\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-400-9e25b0411890", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE400_Uncontrolled_Resource_Consumption__Connect_tcp_for_loop_01.cs\r\nLabel Definition File: CWE400_Uncontrolled_Resource_Consumption.label.xml\r\nTemplate File: sources-sinks-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 400 Uncontrolled Resource Consumption\r\n* BadSource: Connect_tcp Read count using an outbound tcp connection\r\n* GoodSource: A hardcoded non-zero, non-min, non-max, even number\r\n* Sinks: for_loop\r\n* GoodSink: Validate count before using it as the loop variant in a for loop\r\n* BadSink : Use count as the loop variant in a for loop\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.CWE400_Uncontrolled_Resource_Consumption\r\n{\r\nclass CWE400_Uncontrolled_Resource_Consumption__Connect_tcp_for_loop_01 : AbstractTestCase\r\n{\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n int count;\r\n count = int.MinValue; /* Initialize count */\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 count 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 count = 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 count 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 int i = 0;\r\n /* POTENTIAL FLAW: For loop using count as the loop variant and no validation */\r\n for (i = 0; i < count; i++)\r\n {\r\n IO.WriteLine(\"Hello\");\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 count;\r\n /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */\r\n count = 2;\r\n int i = 0;\r\n /* POTENTIAL FLAW: For loop using count as the loop variant and no validation */\r\n for (i = 0; i < count; i++)\r\n {\r\n IO.WriteLine(\"Hello\");\r\n }\r\n }\r\n\r\n /* goodB2G() - use badsource and goodsink */\r\n private void GoodB2G()\r\n {\r\n int count;\r\n count = int.MinValue; /* Initialize count */\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 count 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 count = 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 count 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 int i = 0;\r\n /* FIX: Validate count before using it as the for loop variant */\r\n if (count > 0 && count <= 20)\r\n {\r\n for (i = 0; i < count; i++)\r\n {\r\n IO.WriteLine(\"Hello\");\r\n }\r\n }\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-400 (Uncontrolled Resource Consumption). 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-400\"}", "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-400\"}", "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/CWE400_Uncontrolled_Resource_Consumption/s01/CWE400_Uncontrolled_Resource_Consumption__Connect_tcp_for_loop_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\": \"9e25b04118904186368cc2a508c69c07a79181fac6d2f81d4cc9b93bf4f465ef\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-400\", \"target_weakness\": \"Uncontrolled Resource Consumption\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-539-e72838a53483", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE539_Information_Exposure_Through_Persistent_Cookie__Web_01.cs\r\nLabel Definition File: CWE539_Information_Exposure_Through_Persistent_Cookie__Web.label.xml\r\nTemplate File: point-flaw-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 539 Information Exposure Through Persistent Cookie\r\n* Sinks:\r\n* GoodSink: Do not use a persistent cookie\r\n* BadSink : Use a persistent cookie\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.CWE539_Information_Exposure_Through_Persistent_Cookie\r\n{\r\nclass CWE539_Information_Exposure_Through_Persistent_Cookie__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 /* FLAW: Make the cookie persistent, by setting the expiration to 5 years */\r\n cookie.Expires = DateTime.Now.AddDays(1825.00);\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\", \"test\");\r\n /* FIX: Set the expiration date to DateTime.MinValue to make this a session cookie. */\r\n cookie.Expires = DateTime.MinValue;\r\n }\r\n#endif //omitgood\r\n}\r\n}\r\n", "instruction": "Tinjau kasus uji Juliet berikut untuk CWE-539 (Information Exposure Through Persistent 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\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-539\"}", "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-539\"}", "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/CWE539_Information_Exposure_Through_Persistent_Cookie/CWE539_Information_Exposure_Through_Persistent_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\": \"e72838a534839a291403c5155e1176b35fd437a61bcc968af861712c325f1fef\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-539\", \"target_weakness\": \"Information Exposure Through Persistent Cookie\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-772-a85dbf8a6e59", "input": "/*\r\n * @description Missing Release of Resource After Effective Lifetime. Performs some, but not all, necessary resource cleanup (StreamReader is not closed).\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.IO;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE772_Missing_Release_of_Resource\r\n{\r\n class CWE772_Missing_Release_of_Resource__console_StreamReader_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n StreamReader sr = null;\r\n try\r\n {\r\n sr = new StreamReader(Console.OpenStandardInput());\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 /* FLAW: Streams are not closed */\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n StreamReader sr = null;\r\n try\r\n {\r\n sr = new StreamReader(Console.OpenStandardInput());\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 StreamReader\", exceptIO);\r\n }\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-772 (Missing Release of 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\"], \"label_scope\": \"Juliet's intended target-weakness test-case roles; not a claim that the entire program is production-secure or exploitable in every environment\", \"target_cwe\": \"CWE-772\"}", "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-772\"}", "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/CWE772_Missing_Release_of_Resource/CWE772_Missing_Release_of_Resource__console_StreamReader_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\": \"a85dbf8a6e597563f157845164f5106983730cedb5912f55fbcb4bd2f0ba04ef\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-772\", \"target_weakness\": \"Missing Release of Resource\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-775-fa5348fdd7ab", "input": "/*\r\n * @description Missing Release of File Descriptor or Handle After Effective Lifetime. Performs some, but not all, necessary resource cleanup (StreamReader is not closed).\r\n * \r\n * */\r\n\r\nusing System;\r\nusing System.IO;\r\nusing TestCaseSupport;\r\n\r\nnamespace testcases.CWE775_Missing_Release_of_File_Descriptor_or_Handle\r\n{\r\n class CWE775_Missing_Release_of_File_Descriptor_or_Handle__StreamReader_01 : AbstractTestCase\r\n {\r\n#if (!OMITBAD)\r\n public override void Bad()\r\n {\r\n StreamReader sr = null;\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 /* FLAW: file, readerFile, and readerBuffered not closed */\r\n }\r\n#endif // OMITBAD\r\n\r\n#if (!OMITGOOD)\r\n public void Good1()\r\n {\r\n StreamReader sr = null;\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 finally\r\n {\r\n /* FIX: StreamReader closed appropriately */\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 }\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-775 (Missing Release of File Descriptor or Handle). 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-775\"}", "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-775\"}", "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/CWE775_Missing_Release_of_File_Descriptor_or_Handle/CWE775_Missing_Release_of_File_Descriptor_or_Handle__StreamReader_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\": \"fa5348fdd7ab9f34fa566837b99cf5cf296c9c97deda22caf917aadc8b157ba4\", \"source_suite\": \"Juliet C# 1.3\", \"source_suite_id\": \"110\", \"source_url\": \"https://samate.nist.gov/SARD/test-suites/110\", \"target_cwe\": \"CWE-775\", \"target_weakness\": \"Missing Release of File Descriptor or Handle\"}", "source": "Juliet C# 1.3", "split": "validation", "task_type": "paired_security_review"} +{"domain": "secure_coding", "id": "juliet-csharp-cwe-80-f22aa94c1969", "input": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE80_XSS__CWE182_Web_Connect_tcp_01.cs\r\nLabel Definition File: CWE80_XSS__CWE182_Web.label.xml\r\nTemplate File: sources-sink-01.tmpl.cs\r\n*/\r\n/*\r\n* @description\r\n* CWE: 80 Cross Site Scripting (XSS)\r\n* BadSource: Connect_tcp Read data using an outbound tcp connection\r\n* GoodSource: A hardcoded string\r\n* BadSink: Web Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS (CWE 182: Collapse of Data into Unsafe Value)\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.CWE80_XSS\r\n{\r\n\r\nclass CWE80_XSS__CWE182_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: Display of data in web page after using Replace() to remove script tags, which will still allow XSS with strings like ipt> (CWE 182: Collapse of Data into Unsafe Value) */\r\n resp.Write(\"
Bad(): data = \" + data.Replace(\"(