Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Custom Sensitive Variable fields feature #9446

Merged
merged 4 commits into from
Jun 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,23 @@
'access_token',
}

sensitive_variable_fields = conf.get('admin', 'sensitive_variable_fields')
if sensitive_variable_fields:
DEFAULT_SENSITIVE_VARIABLE_FIELDS.update(sensitive_variable_fields.split(','))

def get_sensitive_variables_fields():

sensitive_fields = DEFAULT_SENSITIVE_VARIABLE_FIELDS
sensitive_variable_fields = conf.get('admin', 'sensitive_variable_fields')
if sensitive_variable_fields:
sensitive_fields.update(set(sensitive_variable_fields.split(',')))

return sensitive_fields


def should_hide_value_for_key(key_name):
# It is possible via importing variables from file that a key is empty.
if key_name:
config_set = conf.getboolean('admin', 'hide_sensitive_variable_fields')

field_comp = any(s in key_name.strip().lower() for s in DEFAULT_SENSITIVE_VARIABLE_FIELDS)
field_comp = any(s in key_name.strip().lower() for s in get_sensitive_variables_fields())
return config_set and field_comp
return False

Expand Down