tridentli / trident

Trident is a trusted and secure communication platform for enabling better communication between groups of trusted parties
https://trident.li
Apache License 2.0
20 stars 9 forks source link

IPTrk and XFF: Odd behavior when using same IP range as the system #145

Open teward opened 5 years ago

teward commented 5 years ago

In a production environment, we have an IP range of, say, 1.2.3.0/24 at the 'corporate' environment. Of that, 1.2.3.162/29 is the IP range assigned use on the box itself.

When we set "xff_trusted_cidr" to [ "127.0.0.1/8", "1.2.3.0/24" ], IPTrk ends up ignoring the XFF header and setting the IP address in IPTrk to 127.0.0.1, but only for IPs fitting within the /24.

This is not expected behavior in which Trident would trust the headers from both the localhost and the IP address falling into the specified CIDR range that isn't local host.

This sounds a lot like a bug in how IPTrk parses XFF Trusted CIDR and handles the actual reading of XFF.