A block cipher is used in ECB mode, which shows patterns of the plaintext

tx0/csharp:ecb-modedefaultwarningsecurity/cryptodepth fastsecurity, cwe-327

What it finds

In ECB mode equal blocks of plaintext give equal blocks of ciphertext, so the structure of the data shows through the encryption. CBC with a random IV, or an authenticated mode such as GCM, hides it.

From the rule's source, ecb_mode.rs.

Example from the rule's tests
using System.Security.Cryptography; class Encrypt{    void Setup(Aes aes)    {        aes.Mode = CipherMode.ECB;tx0 reports: ECB mode shows patterns of the plaintext        aes.Mode = CipherMode.CBC;    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:ecb-mode" = "off"

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:ecb-mode] reason="..."

tx0 explain tx0/csharp:ecb-mode shows the same in the terminal. Found a false positive? Report it.