summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorWerWolv <werwolv98@gmail.com>2022-07-03 08:29:46 +0200
committerGitHub <noreply@github.com>2022-07-03 08:29:46 +0200
commitbaa02c129fa5419405bcfd9b8740598be2d19f0f (patch)
treee83a641c9ccb6ae49c77d6d3dcffd83461c57228 /backend
parent1e6b3edbf2a6bab0305f5ee914e581716fddd0d5 (diff)
downloaddecky-loader-baa02c129fa5419405bcfd9b8740598be2d19f0f.tar.gz
decky-loader-baa02c129fa5419405bcfd9b8740598be2d19f0f.zip
Fixed plugin installation ssl verification issue (#101)
* Added cert location debugging * Install certifi * Try adding manual cacert in install request * Properly use ssl * More efficiently load ssl certificate
Diffstat (limited to 'backend')
-rw-r--r--backend/browser.py4
-rw-r--r--backend/helpers.py7
-rw-r--r--backend/utilities.py4
3 files changed, 12 insertions, 3 deletions
diff --git a/backend/browser.py b/backend/browser.py
index c491f17a..df0c478c 100644
--- a/backend/browser.py
+++ b/backend/browser.py
@@ -13,6 +13,8 @@ from subprocess import Popen
import json
+import helpers
+
class PluginInstallContext:
def __init__(self, artifact, name, version, hash) -> None:
self.artifact = artifact
@@ -72,7 +74,7 @@ class PluginBrowser:
self.log.info(f"Installing {name} (Version: {version})")
async with ClientSession() as client:
self.log.debug(f"Fetching {artifact}")
- res = await client.get(artifact)
+ res = await client.get(artifact, ssl=helpers.get_ssl_context())
if res.status == 200:
self.log.debug("Got 200. Reading...")
data = await res.read()
diff --git a/backend/helpers.py b/backend/helpers.py
new file mode 100644
index 00000000..a75f1075
--- /dev/null
+++ b/backend/helpers.py
@@ -0,0 +1,7 @@
+import ssl
+import certifi
+
+ssl_ctx = ssl.create_default_context(cafile=certifi.where())
+
+def get_ssl_context():
+ return ssl_ctx \ No newline at end of file
diff --git a/backend/utilities.py b/backend/utilities.py
index 570ed568..834faeb2 100644
--- a/backend/utilities.py
+++ b/backend/utilities.py
@@ -4,7 +4,7 @@ from json.decoder import JSONDecodeError
from aiohttp import ClientSession, web
from injector import inject_to_tab
-
+import helpers
class Utilities:
def __init__(self, context) -> None:
@@ -48,7 +48,7 @@ class Utilities:
async def http_request(self, method="", url="", **kwargs):
async with ClientSession() as web:
- async with web.request(method, url, **kwargs) as res:
+ async with web.request(method, url, ssl=helpers.get_ssl_context(), **kwargs) as res:
return {
"status": res.status,
"headers": dict(res.headers),