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

Force loading provider configuration when using config.as_dict #38793

Closed
wants to merge 1 commit into from

Conversation

ephraimbuddy
Copy link
Contributor

It's not clear to me why the sensitive_config_values excludes providers when config.as_dict is used on the webserver. This has resulted in displaying sensitive provider configurations even when non-sensitive-only is used as the value of [webserver]expose_config.

This fixed it but still, it's not clear to me where things went wrong.

cc @potiuk

It's not clear to me why the sensitive_config_values excludes providers
when config.as_dict is used on the webserver. This has resulted in displaying
sensitive provider configurations even when non-sensitive-only is used as the
value of [webserver]expose_config.

This fixed it but still, it's not clear to me where things went wrong.
@ephraimbuddy ephraimbuddy requested a review from potiuk April 6, 2024 06:37
@@ -1439,11 +1439,13 @@ def as_dict(
("default", self._default_values),
("airflow.cfg", self),
]
# Force the providers configuration to be loaded
self.configuration_description = retrieve_configuration_description()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.configuration_description = retrieve_configuration_description()
if not self.configuration_description:
self.configuration_description = retrieve_configuration_description()

perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s there just that it doesn’t have providers configuration. so this would lead to old results.
where it was set initially, it was set not to load providers configuration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Probably needs a comment then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, expanding on the comment you did add 🤦

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the right fix (it will cause much slowe airflow import if we do it this way because importing airflow is initializing configuraiton (this is why by default it does not load provider configuration).

We are lazy-loading provider's configuration by ProvidersManager.iniitialize_providers_configuration(). I have a fix coming with modified tests. I noticed that teh test that was retrieving config for non-sensitive values was not really testing if configuration for non-sensitive values was working - it checked only if as_dict() was called with include_sensitive=False (but it did not really check if sensitive values were replaced).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashb
Copy link
Member

ashb commented Apr 6, 2024

Could we add a test to cover that this doesn't break again please?

@ephraimbuddy
Copy link
Contributor Author

Better fix: #38795

@ephraimbuddy ephraimbuddy deleted the fix-sensitive-secrets branch April 6, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants