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

Do not log the hook password even at DEBUG level #22627

Merged
merged 3 commits into from
Mar 31, 2022

Conversation

collinmcnulty
Copy link
Contributor

The BaseHook currently logs connection details including password at the DEBUG level. While the password is redacted under normal conditions in task logs, there are edge cases where this can lead to a password leaking into logs, such as calling python code that uses a hook from a BashOperator.

The value of logging the password simply seems small relative to the consequences of leaking to logs even in edge cases. There remain plenty of ways to log the password if that is explicitly what you want to do, such as airflow connection list.

@boring-cyborg boring-cyborg bot added the area:core-operators Operators, Sensors and hooks within Core Airflow label Mar 30, 2022
@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Mar 30, 2022
@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@kaxil kaxil force-pushed the dont-log-hook-password branch from 13b430b to 83ef01b Compare March 30, 2022 19:24
Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Should we also remove extra_dejson? Some connectons also contain potentially sensitive data in there.

@jedcunningham
Copy link
Member

extra does get masked based on key.

@potiuk
Copy link
Member

potiuk commented Mar 30, 2022

extra does get masked based on key.

I believe there are some edge ceses where it is not masked (for example when the Hook is called by Bash), and I think the whole idea was to catch those edge cases.

@jedcunningham
Copy link
Member

jedcunningham commented Mar 30, 2022

The way extra is masked based on key covers the edge cases I'm aware of (in this case, MASK_SECRETS_IN_LOGS being False). There easily could be others though 🤷‍♂️.

That said, I'm thinking we should just remove this DEBUG log in its entirety. We already INFO the conn_id, which should be sufficient for debugging purposes imo.

@potiuk
Copy link
Member

potiuk commented Mar 30, 2022

The way extra is masked based on key covers the edge cases I'm aware of (in this case, MASK_SECRETS_IN_LOGS being False). There easily could be others though 🤷‍♂️.

That said, I'm thinking we should just remove this DEBUG log in its entirety. We already INFO the conn_id, which should be sufficient for debugging purposes imo.

Fine for me.

@collinmcnulty
Copy link
Contributor Author

I'll edit the PR to remove it entirely.

@jedcunningham jedcunningham force-pushed the dont-log-hook-password branch from 4835d90 to ff63d9c Compare March 30, 2022 23:50
@jedcunningham jedcunningham merged commit 88165b3 into apache:main Mar 31, 2022
ephraimbuddy pushed a commit to astronomer/airflow that referenced this pull request Mar 31, 2022
jedcunningham pushed a commit to astronomer/airflow that referenced this pull request Mar 31, 2022
jedcunningham pushed a commit to astronomer/airflow that referenced this pull request Mar 31, 2022
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Apr 8, 2022
@potiuk potiuk added this to the Airflow 2.3.0 milestone Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core-operators Operators, Sensors and hooks within Core Airflow full tests needed We need to run full set of tests for this PR to merge type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants