An IP address is written in the source
What it finds
An address in the code ties the program to one network: moving a server means a new release, and the address is visible to everyone who reads the code. Configuration or name resolution keeps it out. Reported are string literals that consist of an IPv4 address, except loopback, 0.0.0.0, broadcast and the ranges reserved for documentation, which are not addresses of real machines.
From the rule's source, hardcoded_ip_address.rs.
SERVER = "10.20.30.40"tx0 reports: the IP address 10.20.30.40 is written in the sourceLOCAL = "127.0.0.1"ANY = "0.0.0.0"DOC = "192.0.2.10"VERSION = "1.2.3.4.5"DATE = "2024.01.02.03" 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/python:hardcoded-ip-address" = "note"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/python:hardcoded-ip-address] reason="..."tx0 explain tx0/python:hardcoded-ip-address shows the same in the terminal. Found a false positive? Report it.