A request is sent to a fixed URL over an unencrypted protocol
What it finds
http.Get("http://api.partner.net/v1/orders"): plain HTTP sends the request and the answer readable to every network in between, which can read them, change them, or answer in the server's place. HTTPS protects both, and is available for almost every service.
Reported are constant URLs with the scheme http, ftp or telnet given to http.Get, http.Head, http.Post, http.PostForm, http.NewRequest or http.NewRequestWithContext, resolved through the imports, unless the host is localhost, a loopback address, or a name under example.com, example.org, example.net, .local, .internal, .test, .svc or .localhost. Internal services without TLS are common, so the rule is strict.
From the rule's source, unencrypted_request.rs.
package p import "net/http" func fetch() { http.Get("http://api.partner.net/v1/orders")tx0 reports: the request goes over http http.Get("https://api.partner.net/v1/orders") http.Get("http://localhost:8080/health") http.Get("http://metrics.default.svc/metrics")} 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/go:unencrypted-request" = "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/go:unencrypted-request] reason="..."tx0 explain tx0/go:unencrypted-request shows the same in the terminal. Found a false positive? Report it.