1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-19 18:28:39 +01:00
phorge-phorge/src/infrastructure/env
epriestley 6058d3305f Normalize remote IP addresses when writing to logs, etc
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]/"
```

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11939

Differential Revision: https://secure.phabricator.com/D16987
2016-12-05 11:20:29 -08:00
..
__tests__ phtize all the things 2015-05-22 21:16:39 +10:00
PhabricatorConfigDatabaseSource.php Add database configuration source to the source stack 2013-01-17 15:10:21 -08:00
PhabricatorConfigDefaultSource.php Read default values of custom config options 2013-01-19 08:36:08 -08:00
PhabricatorConfigDictionarySource.php Formalize configuration sources and source stacks 2012-12-25 06:44:29 -08:00
PhabricatorConfigFileSource.php phtize all the things 2015-05-22 21:16:39 +10:00
PhabricatorConfigLocalSource.php phtize all the things 2015-05-22 21:16:39 +10:00
PhabricatorConfigProxySource.php phtize all the things 2015-05-22 21:16:39 +10:00
PhabricatorConfigSiteSource.php Add an extensible "SiteSource" for configuration 2014-11-05 15:30:40 -08:00
PhabricatorConfigSource.php Extend from Phobject 2015-06-15 18:02:27 +10:00
PhabricatorConfigStackSource.php phtize all the things 2015-05-22 21:16:39 +10:00
PhabricatorEnv.php Normalize remote IP addresses when writing to logs, etc 2016-12-05 11:20:29 -08:00
PhabricatorScopedEnv.php Extend from Phobject 2015-06-15 18:02:27 +10:00