Skip to content

Check if the lower of provided values are sensitives in config endpoint - #34712

Merged
ephraimbuddy merged 4 commits into
apache:mainfrom
hussein-awala:conf_enpoint
Oct 7, 2023
Merged

Check if the lower of provided values are sensitives in config endpoint#34712
ephraimbuddy merged 4 commits into
apache:mainfrom
hussein-awala:conf_enpoint

Conversation

@hussein-awala

Copy link
Copy Markdown
Member

No description provided.

@hussein-awalahussein-awala added this to the Airflow 2.7.2 milestone Oct 2, 2023
@boring-cyborgboring-cyborgBot added the area:API Airflow's REST/HTTP API label Oct 2, 2023
@hussein-awalahussein-awala added the type:bug-fix Changelog: Bug Fixes label Oct 2, 2023
@uranusjr

Copy link
Copy Markdown
Member

We don’t currently normalise entries in sensitive_config_values to lowercase. Should we do that to ensure things are compared correctly?

)

if (section, option) in conf.sensitive_config_values:
if (section.lower(), option.lower()) in conf.sensitive_config_values:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of this, I think we should do what we do in the webserver

updater=configupdater.ConfigUpdater()
updater.read(AIRFLOW_CONFIG)
forsect, keyinconf.sensitive_config_values:
ifupdater.has_option(sect, key):
updater[sect][key].value="< hidden >"
config=str(updater)
.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I cannot fix the problem, because it checks if the value exists in the configuration as it is. But since we don't read any configuration from the user in this view, it's safe because all the configuration in both side (sensitive dict and configuration dict) are in low format.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree with @hussein-awala . I think the proposed way is right. The "www/views.py" code displays all the sections/options from the config and then then from sensitive_config_values. What we are preventing here is that differently cased section/option is passed by the user, so the source of section/key are not the config itself, but external to it. We can safely assume that the config has the right sections/keys (that's why the code in views.py works). But we cannot make the same assumption about the values passed by the user so we have to lowercase them.

@ephraimbuddy
ephraimbuddy merged commit f044589 into apache:mainOct 7, 2023
ephraimbuddy pushed a commit that referenced this pull request Oct 7, 2023
…nt (#34712)
* Check if the lower of provided values are sensitives in config endpoint
* update unit test
* ensure that all values in sensitive dict are in lower characters
(cherry picked from commit f044589)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:APIAirflow's REST/HTTP APItype:bug-fixChangelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@hussein-awala@uranusjr@potiuk@ephraimbuddy