Skip to content

Commit

Permalink
MAINT Removes pyopenssl dependency (#1965)
Browse files Browse the repository at this point in the history
* MAINT Removes pyopenssl dependency

Signed-off-by: Thomas J. Fan <[email protected]>

* MAINT Remove pyopenssl from requirements pip

Signed-off-by: Thomas J. Fan <[email protected]>

* STY Run linter

Signed-off-by: Thomas J. Fan <[email protected]>

* CLN Remove unneeded files

Signed-off-by: Thomas J. Fan <[email protected]>

---------

Signed-off-by: Thomas J. Fan <[email protected]>
  • Loading branch information
thomasjpfan authored Nov 19, 2023
1 parent f6ae51c commit 5c968c7
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 74 deletions.
3 changes: 0 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ cryptography==41.0.5
# azure-storage-blob
# msal
# pyjwt
# pyopenssl
dataclasses-json==0.5.9
# via flytekit
decorator==5.1.1
Expand Down Expand Up @@ -387,8 +386,6 @@ pyjwt[crypto]==2.8.0
# via
# msal
# pyjwt
pyopenssl==23.3.0
# via flytekit
pytest==7.4.3
# via
# -r dev-requirements.in
Expand Down
2 changes: 0 additions & 2 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ cryptography==41.0.3
# great-expectations
# msal
# pyjwt
# pyopenssl
# snowflake-connector-python
css-html-js-minify==2.5.5
# via sphinx-material
Expand Down Expand Up @@ -941,7 +940,6 @@ pyjwt[crypto]==2.8.0
# snowflake-connector-python
pyopenssl==23.2.0
# via
# flytekit
# snowflake-connector-python
pyparsing==3.1.1
# via
Expand Down
15 changes: 3 additions & 12 deletions flytekit/clients/auth_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import requests
from flyteidl.service.auth_pb2 import OAuth2MetadataRequest, PublicClientAuthConfigRequest
from flyteidl.service.auth_pb2_grpc import AuthMetadataServiceStub
from OpenSSL import crypto

from flytekit.clients.auth.authenticator import (
Authenticator,
Expand Down Expand Up @@ -155,14 +154,6 @@ def get_authenticated_channel(cfg: PlatformConfig) -> grpc.Channel:
return upgrade_channel_to_authenticated(cfg, channel)


def load_cert(cert_file: str) -> crypto.X509:
"""
Given a cert-file loads the PEM certificate and returns
"""
st_cert = open(cert_file, "rt").read()
return crypto.load_certificate(crypto.FILETYPE_PEM, st_cert)


def bootstrap_creds_from_server(endpoint: str) -> grpc.ChannelCredentials:
"""
Retrieves the SSL cert from the remote and uses that. should be used only if insecure-skip-verify
Expand Down Expand Up @@ -209,9 +200,9 @@ def get_channel(cfg: PlatformConfig, **kwargs) -> grpc.Channel:
if cfg.insecure_skip_verify:
credentials = bootstrap_creds_from_server(cfg.endpoint)
elif cfg.ca_cert_file_path:
credentials = grpc.ssl_channel_credentials(
crypto.dump_certificate(crypto.FILETYPE_PEM, load_cert(cfg.ca_cert_file_path))
)
with open(cfg.ca_cert_file_path, "rb") as f:
st_cert = f.read()
credentials = grpc.ssl_channel_credentials(st_cert)
else:
credentials = grpc.ssl_channel_credentials(
root_certificates=kwargs.get("root_certificates", None),
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
# TODO: Remove upper-bound after protobuf community fixes it. https://github.com/flyteorg/flyte/issues/4359
"protobuf<4.25.0",
"pyarrow>=4.0.0,<11.0.0",
"pyopenssl",
"python-dateutil>=2.1",
"python-json-logger>=2.0.0",
"pytimeparse>=1.1.8,<2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ cryptography==41.0.4
# azure-storage-blob
# msal
# pyjwt
# pyopenssl
# secretstorage
cycler==0.11.0
# via matplotlib
Expand Down Expand Up @@ -253,8 +252,6 @@ pygments==2.15.1
# via rich
pyjwt[crypto]==2.8.0
# via msal
pyopenssl==23.2.0
# via flytekit
pyparsing==3.0.9
# via matplotlib
python-dateutil==2.8.2
Expand Down
9 changes: 0 additions & 9 deletions tests/flytekit/unit/clients/test_auth_helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os.path
from http import HTTPStatus
from unittest.mock import MagicMock, patch

Expand All @@ -19,7 +18,6 @@
RemoteClientConfigStore,
get_authenticator,
get_session,
load_cert,
upgrade_channel_to_authenticated,
upgrade_channel_to_proxy_authenticated,
wrap_exceptions_channel,
Expand Down Expand Up @@ -177,13 +175,6 @@ def test_upgrade_channel_to_proxy_auth():
assert isinstance(out_ch._interceptor._authenticator, CommandAuthenticator)


def test_load_cert():
cert_file = os.path.join(os.path.dirname(__file__), "testdata", "rootCACert.pem")
f = load_cert(cert_file)
assert f
print(f)


def test_get_proxy_authenticated_session():
"""Test that proxy auth headers are added to http requests if the proxy command is provided in the platform config."""
expected_token = "foo-bar"
Expand Down
17 changes: 0 additions & 17 deletions tests/flytekit/unit/clients/testdata/rootCACert.pem

This file was deleted.

27 changes: 0 additions & 27 deletions tests/flytekit/unit/clients/testdata/rootCAKey.pem

This file was deleted.

0 comments on commit 5c968c7

Please sign in to comment.