A proxy is configured to forward the client's IP address to the server behind it

tx0/ts:proxy-forwards-client-iprecommendedwarningsecurity/configurationdepth fastsecurity

What it finds

With xfwd: true, http-proxy and http-proxy-middleware add X-Forwarded-For and related headers with the address of the client. When the target is a third party, that discloses the users' addresses to it.

Reported are createProxyMiddleware, createProxyServer and createProxy calls with xfwd: true.

From the rule's source, proxy_forwards_client_ip.rs.

Example from the rule's tests
declare function createProxyMiddleware(o: object): unknown;export const api = createProxyMiddleware({ target: "https://api.example.com", xfwd: true });tx0 reports: this proxy forwards the client's IP address
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 from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:proxy-forwards-client-ip" = "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:proxy-forwards-client-ip] reason="..."

tx0 explain tx0/ts:proxy-forwards-client-ip shows the same in the terminal. Found a false positive? Report it.