A request is sent to an http:// or ws:// address
What it finds
A request over http:// or ws:// travels unencrypted: anyone on the network path can read it and change the answer, including code the page then runs.
Reported are literal URLs with these schemes passed to fetch, to the request methods of axios, got, superagent and Node's http module, to XMLHttpRequest.open, and to new WebSocket and new EventSource. A template counts by its first part, as in ` http://api.example.org/${path} . Addresses that never leave the machine or are reserved for examples and tests, such as localhost, 127.0.0.1, *.local, *.test and example.com`, are left alone.
From the rule's source, cleartext_request.rs.
import axios from "axios";export async function load(path: string) { await fetch("http://api.weather.io/v1/today");tx0 reports: http://api.weather.io is reached without encryption await axios.get(`http://cdn.shop.io/${path}`);tx0 reports: http://cdn.shop.io is reached without encryption const socket = new WebSocket("ws://live.chat.io/feed");tx0 reports: ws://live.chat.io is reached without encryption await fetch("https://api.weather.io/v1/today"); await fetch("http://localhost:3000/api"); await fetch("http://127.0.0.1/api"); await fetch("http://example.com/docs"); const xhr = new XMLHttpRequest(); xhr.open("GET", "http://legacy.bank.io/rates");tx0 reports: http://legacy.bank.io is reached return socket;} 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/ts:cleartext-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/ts:cleartext-request] reason="..."tx0 explain tx0/ts:cleartext-request shows the same in the terminal. Found a false positive? Report it.