diff --git a/airflow/www/views.py b/airflow/www/views.py index 0c0dcff801a59..9051c0d793254 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -2566,10 +2566,13 @@ def action_varexport(self, ids, session=None): d = json.JSONDecoder() for var in qry: val = None - try: - val = d.decode(var.val) - except Exception: - val = var.val + if wwwutils.should_hide_value_for_key(var): + val = '*' * 8 + else: + try: + val = d.decode(var.val) + except Exception: + val = var.val var_dict[var.key] = val response = make_response(json.dumps(var_dict, sort_keys=True, indent=4)) diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py index 629f488fc7218..b6dc5eb56a9da 100644 --- a/airflow/www_rbac/views.py +++ b/airflow/www_rbac/views.py @@ -2030,10 +2030,13 @@ def action_varexport(self, items): var_dict = {} d = json.JSONDecoder() for var in items: - try: - val = d.decode(var.val) - except Exception: - val = var.val + if wwwutils.should_hide_value_for_key(var): + val = '*' * 8 + else: + try: + val = d.decode(var.val) + except Exception: + val = var.val var_dict[var.key] = val response = make_response(json.dumps(var_dict, sort_keys=True, indent=4))