A connection address uses a protocol without encryption
What it finds
new URL("http://api.example.net/data") connects without encryption, so the data and any credentials sent with it can be read and changed on the way. The same holds for ftp:// and telnet://.
Only addresses passed to new URL, new URI or URI.create are reported, and not those of the local machine (localhost, 127.0.0.1, [::1]) or of the reserved example domains.
From the rule's source, cleartext_url.rs.
import java.net.URI;import java.net.URL; class Endpoints { void open() throws Exception { URL a = new URL("http://api.partner.net/v1/data");tx0 reports: http sends data without encryption URL b = new URL("https://api.partner.net/v1/data"); URL c = new URL("http://localhost:8080/health"); URI d = URI.create("ftp://files.partner.net/drop");tx0 reports: ftp sends data URI e = URI.create("http://www.example.com/"); }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:unencrypted-url" = "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/java:unencrypted-url] reason="..."tx0 explain tx0/java:unencrypted-url shows the same in the terminal. Found a false positive? Report it.