Page MenuHomePhabricator

Normalize remote IP addresses when writing to logs, etc
ClosedPublic

Authored by epriestley on Dec 5 2016, 6:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 10:47 AM
Unknown Object (File)
Wed, Apr 24, 10:47 AM
Unknown Object (File)
Wed, Apr 24, 10:47 AM
Unknown Object (File)
Wed, Apr 24, 10:47 AM
Unknown Object (File)
Mon, Apr 22, 3:47 AM
Unknown Object (File)
Mar 27 2024, 8:40 PM
Unknown Object (File)
Mar 26 2024, 7:12 PM
Unknown Object (File)
Mar 5 2024, 1:03 AM
Subscribers
None

Details

Summary

Ref T11939. IPv4 addresses can normally only be written in one way, but IPv6 addresses have several formats.

For example, the addresses "FFF::", "FfF::", "fff::", "0ffF::", "0fFf:0::", and "0FfF:0:0:0:0:0:0:0" are all the same address.

Normalize all addresses before writing them to logs, etc, so we store the most-preferred form ("fff::", above).

Test Plan

Ran an SSH clone over IPv6:

$ git fetch ssh://local@::1/diffusion/26/locktopia.git

It worked; verified that address read out of SSH_CLIENT sensibly.

Faked my remote address as a non-preferred-form IPv6 address using preamble.php.

Failed to login, verified that the preferred-form version of the address appeared in the user activity log.

Made IPv6 requests over HTTP:

$ curl -H "Host: local.phacility.com" "http://[::1]/"

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Normalize remote IP addresses when writing to logs, etc.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Dec 5 2016, 6:40 PM
This revision was automatically updated to reflect the committed changes.