prevent using local http proxies per annex.security.allowed-http-addresses

A local http proxy would bypass the security configuration. So,
the security configuration has to be applied when choosing whether to
use the proxy.

While http rebinding attacks against the dns lookup of the proxy IP
address seem very unlikely, this implementation does prevent them, since
it resolves the IP address once, checks it, and then reconfigures
http-client's proxy using the resolved address.

This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
Joey Hess 2018-06-18 13:32:20 -04:00
parent 8703fdd3b7
commit cc08135e65
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 117 additions and 33 deletions

View file

@ -81,8 +81,13 @@ getUrlOptions = Annex.getState Annex.urloptions >>= \case
then Nothing
else Just (addrConnectionRestricted addr)
}
manager <- liftIO $ U.newManager $
(settings, pr) <- liftIO $
restrictManagerSettings r U.managerSettings
case pr of
Nothing -> return ()
Just ProxyRestricted -> toplevelWarning True
"http proxy settings not used due to annex.security.allowed-http-addresses configuration"
manager <- liftIO $ U.newManager settings
return (U.DownloadWithConduit, manager)
httpAddressesUnlimited :: Annex Bool