/* goodG2B() - use goodsource and badsink */ private static void GoodG2B(HttpRequest req, HttpResponse resp) { string data; /* FIX: Set the path as the "system" path */ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { data = "/bin"; } else { data = "%SystemRoot%\\system32"; } Container dataContainer = new Container(); dataContainer.containerOne = data; CWE427_Uncontrolled_Search_Path_Element__Get_Cookies_Web_67b.GoodG2BSink(dataContainer, req, resp); }
public override void Bad(HttpRequest req, HttpResponse resp) { string data; data = ""; /* initialize data in case there are no cookies */ /* Read data from cookies */ { HttpCookieCollection cookieSources = req.Cookies; if (cookieSources != null) { /* POTENTIAL FLAW: Read data from the first cookie value */ data = cookieSources[0].Value; } } Container dataContainer = new Container(); dataContainer.containerOne = data; CWE427_Uncontrolled_Search_Path_Element__Get_Cookies_Web_67b.BadSink(dataContainer, req, resp); }