Skip to content

Commit 40fa549

Browse files
committed
Secirity fix
1 parent d6a4f89 commit 40fa549

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fortls/langserver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,9 @@ def _update_version_pypi(self, test: bool = False):
16601660
if v.is_prerelease and not test:
16611661
return False
16621662
try:
1663-
with urllib.request.urlopen("https://pypi.org/pypi/fortls/json") as resp:
1663+
# For security reasons register as Request before opening
1664+
request = urllib.request.Request("https://pypi.org/pypi/fortls/json")
1665+
with urllib.request.urlopen(request) as resp:
16641666
info = json.loads(resp.read().decode("utf-8"))
16651667
# This is the only reliable way to compare version semantics
16661668
if version.parse(info["info"]["version"]) > v or test:

0 commit comments

Comments
 (0)