public override void Bad() { string data; /* FLAW: Set data to a hardcoded value */ data = "23 ~j;asn!@#/>as"; Container dataContainer = new Container(); dataContainer.containerOne = data; CWE321_Hard_Coded_Cryptographic_Key__basic_67b.BadSink(dataContainer); }
/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { string data; data = ""; /* Initialize data */ /* read user input from console with readLine */ try { /* FIX: Read data from the console using readLine() */ data = Console.ReadLine(); } catch (IOException exceptIO) { IO.Logger.Log(NLog.LogLevel.Warn, "Error with stream reading", exceptIO); } Container dataContainer = new Container(); dataContainer.containerOne = data; CWE321_Hard_Coded_Cryptographic_Key__basic_67b.GoodG2BSink(dataContainer); }