/* goodG2B() - use goodsource and badsink */ private void GoodG2B() { string data; /* FIX: Use a regular string (non-sensitive string) */ data = "Hello World"; CWE319_Cleartext_Tx_Sensitive_Info__send_54b.GoodG2BSink(data); }
/* goodB2G() - use badsource and goodsink */ private void GoodB2G() { string data; 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_54b.GoodB2GSink(data); }