Skip to content

Commit

Permalink
Encrypt broker password in database
Browse files Browse the repository at this point in the history
Signed-off-by: Don Bowman <don@agilicus.com>
  • Loading branch information
donbowman committed Feb 2, 2019
1 parent e911120 commit 83f72ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion superset/connectors/druid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
Boolean, Column, DateTime, ForeignKey, Integer, String, Table, Text, UniqueConstraint,
)
from sqlalchemy.orm import backref, relationship
from sqlalchemy_utils import EncryptedType

from superset import conf, db, security_manager
from superset.connectors.base.models import BaseColumn, BaseDatasource, BaseMetric
Expand Down Expand Up @@ -103,7 +104,7 @@ class DruidCluster(Model, AuditMixinNullable, ImportMixin):
metadata_last_refreshed = Column(DateTime)
cache_timeout = Column(Integer)
broker_user = Column(String(255))
broker_pass = Column(String(255))
broker_pass = Column(EncryptedType(String(255), conf.get('SECRET_KEY')))

export_fields = ('cluster_name', 'broker_host', 'broker_port',
'broker_endpoint', 'cache_timeout', 'broker_user',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,30 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""add_druid_auth.py
"""add_druid_auth_py.py
Revision ID: b94b03d92795
Revision ID: e553e78e90c5
Revises: 18dc26817ad2
Create Date: 2019-01-31 15:09:54.944703
Create Date: 2019-02-01 16:07:04.268023
"""

# revision identifiers, used by Alembic.
revision = 'b94b03d92795'
revision = 'e553e78e90c5'
down_revision = '18dc26817ad2'

from alembic import op
import sqlalchemy as sa
from sqlalchemy_utils import EncryptedType



def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('clusters', sa.Column('broker_pass', sa.String(length=255), nullable=True))
op.add_column('clusters', sa.Column('broker_pass', EncryptedType(), nullable=True))
op.add_column('clusters', sa.Column('broker_user', sa.String(length=255), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
Expand Down

0 comments on commit 83f72ec

Please sign in to comment.