You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2023/01/05 23:39:32 UTC

[GitHub] [airflow] wolfier commented on issue #28756: All Airflow Configurations set via Environment Variable are masked when `expose_config` is set as `non-sensitive-only`

wolfier commented on issue #28756:
URL: https://github.com/apache/airflow/issues/28756#issuecomment-1372933160

   I believe the issue is because when the configuration is [fetched as a dictionary](https://github.com/apache/airflow/blob/2.5.0/airflow/www/views.py#L3838-L3842), the values have already been hidden because `display_sensitive` is passed as `False`. The dictionary is built by calling [_include_envs](https://github.com/apache/airflow/blob/2.5.0/airflow/configuration.py#L1012) which hides any configuration that does not end with `_cmd` and `_secret`.
   
   Instead, `conf.as_dict` should be passed with `display_sensitive` as `True`. That way, all configurations are not hidden and can be selectively hidden with `SENSITIVE_CONFIG_VALUES`.
   
   ```python
   conf_dict = conf.as_dict(True, True)
   
   for sect, key in SENSITIVE_CONFIG_VALUES:
       if sect in conf_dict and key in conf_dict[sect]:
           value, source = conf_dict[sect][key]
           conf_dict[sect][key] = ("< hidden >", source)
   
   table = [
       (section, key, str(value), source)
       for section, parameters in conf_dict.items()
       for key, (value, source) in parameters.items()
   ]
   ``` 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org