/* goodB2G() - use badsource and goodsink */ private static void GoodB2G() { using (SecureString securePwd = new SecureString()) { for (int i = 0; i < "AP@ssw0rd".Length; i++) { /* INCIDENTAL: CWE-798 Use of Hard-coded Credentials */ securePwd.AppendChar("AP@ssw0rd"[i]); } /* POTENTIAL FLAW: Set data to be a password, which can be transmitted over a non-secure * channel in the sink */ data = securePwd.ToString(); } CWE319_Cleartext_Tx_Sensitive_Info__send_68b.GoodB2GSink(); }
/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { /* FIX: Use a regular string (non-sensitive string) */ data = "Hello World"; CWE319_Cleartext_Tx_Sensitive_Info__send_68b.GoodG2BSink(); }