Skip to content

Commit

Permalink
Merge pull request #279 from airbnb/crypto_msg
Browse files Browse the repository at this point in the history
Warning about Connections being stored in clear
  • Loading branch information
mistercrunch committed Aug 23, 2015
2 parents 8ce3e18 + 637f6e7 commit 4040ac5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions airflow/www/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,7 @@ class TaskInstanceModelView(ModelViewOnly):
class ConnectionModelView(wwwutils.SuperUserMixin, AirflowModelView):
create_template = 'airflow/conn_create.html'
edit_template = 'airflow/conn_edit.html'
list_template = 'airflow/conn_list.html'
verbose_name = "Connection"
verbose_name_plural = "Connections"
column_default_sort = ('conn_id', False)
Expand Down Expand Up @@ -1667,6 +1668,20 @@ def on_model_change(self, form, model, is_created):
for key in self.form_extra_fields.keys() if key in formdata}
model.extra = json.dumps(extra)

@classmethod
def is_secure(self):
"""
Used to display a message in the Connection list view making it clear
that the passwords can't be encrypted.
"""
is_secure = False
try:
import cryptography
is_secure = True
except:
pass
return is_secure

def on_form_prefill(self, form, id):
try:
d = json.loads(form.data.get('extra', '{}'))
Expand Down
9 changes: 9 additions & 0 deletions airflow/www/templates/airflow/conn_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends 'airflow/model_list.html' %}

{% block model_menu_bar %}
{% if not admin_view.is_secure() %}
<div class="alert alert-danger"><b>Warning:</b> Connection password are stored in clear until you install the Python "cryptography" library. Find the instructions on how to install it here: https://cryptography.io/en/latest/installation/</div>
{% endif %}
{{ super() }}
{% endblock %}

0 comments on commit 4040ac5

Please sign in to comment.