[New-bugs-announce] [issue37900] [urllib] proxy_bypass_registry doesn't handle invalid proxy override values

Kevin Wojniak report at bugs.python.org
Tue Aug 20 16:26:53 EDT 2019


New submission from Kevin Wojniak <kwojniak at box.com>:

proxy_bypass_registry() will split the ProxyOverride registry key by semicolon. Then for each value it uses that value as a regular expression pattern with match(). However, if this value is not a valid regular expression, then match() will throw an exception that goes uncaught. This then breaks the loop and prevents the function from working correctly on other valid input.

It's easy to reproduce:

1. Set this registry key to 1 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable
2. Set HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride to this value (create as a string if necessary):
[]-78;
3. Call urllib.proxy_bypass()

My suggestion for a fix would be to catch exceptions from match() in the loop and continue the loop on error.

----------
components: Windows
messages: 350038
nosy: kwojniak_box, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [urllib] proxy_bypass_registry doesn't handle invalid proxy override values
type: crash
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37900>
_______________________________________


More information about the New-bugs-announce mailing list