Content-Length: 332358 | pFad | http://github.com/apache/airflow/pull/50895

8C Mask secrets when retrieving variables from secrets backend by amoghrajesh · Pull Request #50895 · apache/airflow · GitHub
Skip to content

Mask secrets when retrieving variables from secrets backend #50895

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

amoghrajesh
Copy link
Contributor

Follow up to this: #50880 (comment)


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@jroachgolf84
Copy link
Contributor

Does this mask ALL Variables retrieved from a Secrets Backend?

@amoghrajesh
Copy link
Contributor Author

@jroachgolf84 not all. Only the ones that are deemed sensitive.

@@ -180,6 +181,7 @@ def _get_variable(key: str, deserialize_json: bool) -> Any:
import json

var_val = json.loads(var_val)
mask_secret(var_val, key) # type: ignore[arg-type]
Copy link
Member

Choose a reason for hiding this comment

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

We should probably not type-ignore this but actually check the type? var_val can technically be a number or even None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Valid that it can be a number but the "None" type is covered above on line 179

Copy link
Contributor Author

@amoghrajesh amoghrajesh May 22, 2025

Choose a reason for hiding this comment

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

Handled it for the case of "str" because secrets_backend.get_variable(key=key) returns str | None.

@amoghrajesh amoghrajesh requested a review from uranusjr May 22, 2025 09:26
@amoghrajesh amoghrajesh added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label May 22, 2025
@amoghrajesh amoghrajesh added this to the Airflow 3.0.2 milestone May 22, 2025
@amoghrajesh
Copy link
Contributor Author

@uranusjr could you take a look at this when you get some time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:task-sdk backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/apache/airflow/pull/50895

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy