From 9edb581f103d3e29b40d1c814cbe935a3d36f486 Mon Sep 17 00:00:00 2001 From: hughhhh Date: Fri, 21 Oct 2022 13:15:49 -0700 Subject: [PATCH] fix encrpytions --- superset/databases/models.py | 13 +++++++------ ...d8ec8595_create_ssh_tunnel_credentials_tbl.py | 16 +++++++--------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/superset/databases/models.py b/superset/databases/models.py index 4da6237bbd2a2..bdc6619ca6631 100644 --- a/superset/databases/models.py +++ b/superset/databases/models.py @@ -19,6 +19,7 @@ import sqlalchemy as sa from flask_appbuilder import Model from sqlalchemy.orm import backref, relationship +from sqlalchemy_utils import EncryptedType from superset import app from superset.models.core import Database @@ -48,19 +49,19 @@ class SSHTunnelCredentials( foreign_keys=[database_id], ) - server_address = sa.Column(sa.EncryptedType(sa.String, app_config["SECRET_KEY"])) - server_port = sa.Column(sa.EncryptedType(sa.String, app_config["SECRET_KEY"])) - username = sa.Column(sa.EncryptedType(sa.String, app_config["SECRET_KEY"])) + server_address = sa.Column(EncryptedType(sa.String, app_config["SECRET_KEY"])) + server_port = sa.Column(EncryptedType(sa.String, app_config["SECRET_KEY"])) + username = sa.Column(EncryptedType(sa.String, app_config["SECRET_KEY"])) # basic authentication password = sa.Column( - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True ) # password protected pkey authentication private_key = sa.Column( - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True ) private_key_password = sa.Column( - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True ) diff --git a/superset/migrations/versions/2022-10-20_10-48_f3c2d8ec8595_create_ssh_tunnel_credentials_tbl.py b/superset/migrations/versions/2022-10-20_10-48_f3c2d8ec8595_create_ssh_tunnel_credentials_tbl.py index 3670723a07818..9da57b25ab97f 100644 --- a/superset/migrations/versions/2022-10-20_10-48_f3c2d8ec8595_create_ssh_tunnel_credentials_tbl.py +++ b/superset/migrations/versions/2022-10-20_10-48_f3c2d8ec8595_create_ssh_tunnel_credentials_tbl.py @@ -30,7 +30,7 @@ import sqlalchemy as sa from alembic import op -from sqlalchemy_utils import UUIDType +from sqlalchemy_utils import EncryptedType, UUIDType from superset import app @@ -50,27 +50,25 @@ def upgrade(): # ImportExportMixin sa.Column("uuid", UUIDType(binary=True), primary_key=False, default=uuid4), # Specific to model - sa.Column( - "server_address", sa.EncryptedType(sa.String, app_config["SECRET_KEY"]) - ), - sa.Column("server_port", sa.EncryptedType(sa.String, app_config["SECRET_KEY"])), + sa.Column("server_address", EncryptedType(sa.String, app_config["SECRET_KEY"])), + sa.Column("server_port", EncryptedType(sa.String, app_config["SECRET_KEY"])), sa.Column( "username", - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), + EncryptedType(sa.String, app_config["SECRET_KEY"]), ), sa.Column( "password", - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True, ), sa.Column( "private_key", - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True, ), sa.Column( "private_key_password", - sa.EncryptedType(sa.String, app_config["SECRET_KEY"]), + EncryptedType(sa.String, app_config["SECRET_KEY"]), nullable=True, ), )