Credentials are sent with HTTP basic authentication, which only encodes them
What it finds
An Authorization: Basic ... header carries the user name and password in Base64, which anyone who sees the request decodes; over a connection without TLS, or into a log, the credentials leak (CWE-522).
Reported is an Authorization header set through setRequestProperty, setHeader, addHeader or header to a value that starts with the literal Basic .
From the rule's source, basic_auth_header.rs.
import java.net.HttpURLConnection; class Client { void login(HttpURLConnection connection, String token) { connection.setRequestProperty("Authorization", "Basic " + token);tx0 reports: only encodes the credentials connection.setRequestProperty("Authorization", "Bearer " + token); }} 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/java:basic-auth-header" = "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:basic-auth-header] reason="..."tx0 explain tx0/java:basic-auth-header shows the same in the terminal. Found a false positive? Report it.