This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [urllib] proxy_bypass_registry doesn't handle invalid proxy override values
Type: crash Stage:
Components: Windows Versions: Python 3.7, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: kwojniak_box, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-08-20 20:26 by kwojniak_box, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg350038 - (view) Author: Kevin Wojniak (kwojniak_box) Date: 2019-08-20 20:26
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.
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82081
2019-08-20 20:26:53kwojniak_boxcreate