A mail or file transfer client is set to send without encryption
What it finds
Mail and file transfers without TLS send the login and the content in clear text, for anyone on the network path to read or change. EnableSsl = false on an SmtpClient or an FtpWebRequest, and SecureSocketOptions.None for a MailKit client, switch the encryption off. SecureSocketOptions.None as one side of a choice, as in useTls ? SecureSocketOptions.StartTls : SecureSocketOptions.None, is left alone, and so are tests, which often talk to a local test server.
From the rule's source, transfer_without_tls.rs.
using System.Net.Mail;using MailKit.Security; class Mailer{ void Send(SmtpClient client, bool tls) { client.EnableSsl = false;tx0 reports: the transfer is set to run without TLS var other = new SmtpClient("mail") { EnableSsl = false };tx0 reports: the transfer is set to run without TLS client.EnableSsl = true; client.EnableSsl = tls; var options = SecureSocketOptions.None;tx0 reports: the mail connection is set to run without TLS var chosen = tls ? SecureSocketOptions.StartTls : SecureSocketOptions.None; }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:transfer-without-tls" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:transfer-without-tls] reason="..."tx0 explain tx0/csharp:transfer-without-tls shows the same in the terminal. Found a false positive? Report it.