Skip to content

Commit

Permalink
fix encrpytions
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Oct 21, 2022
1 parent d482df4 commit 9edb581
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
13 changes: 7 additions & 6 deletions superset/databases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
),
)
Expand Down

0 comments on commit 9edb581

Please sign in to comment.