Fix config secrets not masked in task logs after reset_secrets_masker (#63921)#64016
Draft
deepujain wants to merge 2 commits intoapache:mainfrom
Draft
Fix config secrets not masked in task logs after reset_secrets_masker (#63921)#64016deepujain wants to merge 2 commits intoapache:mainfrom
deepujain wants to merge 2 commits intoapache:mainfrom
Conversation
1c4eb96 to
7839403
Compare
Member
|
@deepujain This PR has been converted to draft because it does not yet meet our Pull Request quality criteria. Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the Airflow Slack. |
Member
|
See comments in related issues. |
…apache#63921) reset_secrets_masker() clears all patterns from the SDK secrets masker, including config-level secrets (webserver.secret_key, api.secret_key, api_auth.jwt_secret) that were registered at startup. After the reset, task subprocess logs no longer mask these secrets. Re-register config secrets by calling conf.mask_secrets() immediately after the reset when airflow.configuration is available (which is always the case since supervisors are spawned from workers).
7839403 to
002a237
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reset_secrets_masker()insupervise()clears all patterns from the SDK secrets masker — including config-level secrets (webserver.secret_key,api.secret_key,api_auth.jwt_secret) that were registered at startup byconf.mask_secrets(). After the reset, these secrets appear in plaintext in task subprocess logs when printed viaprint()orstructlog.The fix calls
conf.mask_secrets()immediately afterreset_secrets_masker()to re-register config-level secrets before the task subprocess is forked.Changes
task-sdk/src/airflow/sdk/execution_time/supervisor.py— Afterreset_secrets_masker(), conditionally callconf.mask_secrets()whenairflow.configurationis loaded (always true for worker-spawned supervisors) to re-register config secrets in the SDK masker.task-sdk/tests/task_sdk/execution_time/test_supervisor.py— Regression test verifying that config secrets are re-masked afterreset_secrets_masker()+conf.mask_secrets().Fixes #63921