public override void Bad(HttpRequest req, HttpResponse resp) { string data; /* POTENTIAL FLAW: Read data from a querystring using Params.Get */ data = req.Params.Get("name"); Container dataContainer = new Container(); dataContainer.containerOne = data; CWE427_Uncontrolled_Search_Path_Element__Params_Get_Web_67b.BadSink(dataContainer, req, resp); }
/* 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__Params_Get_Web_67b.GoodG2BSink(dataContainer, req, resp); }