Mask nested entities when writing bulk audit-log entries - #70890
Open
potiuk wants to merge 1 commit into
Open
Conversation
The audit-log maskers for Variables and Connections dispatch on top-level key names. A bulk request body has exactly one top-level key, `actions`, and the entities sit two levels down in `actions[].entities[]` -- so neither `val`/`value` nor `extra` was ever seen, and the payload was recorded as supplied. Reach the entities before applying the existing per-entity masking. Bare id/key strings in a `delete` action carry nothing to mask and are left as they are.
potiuk
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 1, 2026 02:39
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.
The audit-log maskers for Variables and Connections dispatch on top-level key
names --
val/valuefor variables,extrafor connections. A bulk requestbody has exactly one top-level key,
actions, and the entities sit two levelsdown in
actions[].entities[], so neither masker ever saw a key it recognisedand the payload was recorded as supplied. The single-entity endpoints mask the
same fields correctly; only the bulk paths diverged.
Approach
_mask_bulk_entitieswalksactions[].entities[]and applies the existingper-entity masking to each entry, so the two shapes now agree. The per-entity
logic is unchanged and simply factored out (
_mask_connection_entity,_mask_variable_entity) so both call sites share it.deleteaction may list bare id/key strings rather than entity objects;those carry nothing to mask and are passed through.
Nonefor a non-bulk body so the flat path is untouched.(
actionsnot a list, missingentities, non-dict actions) must not raise --each is covered by a test.
Worth noting for connections: a nested
passwordwas already covered, but onlywhile
hide_sensitive_var_conn_fieldsis enabled, since that is key-nameredaction.
extrawas never covered by it -- the name is not a recognisedsensitive field and the value is a JSON string, which
redactreturnsunchanged. Masking
extrahere is structural and so does not depend on thatsetting.
Test plan
TestMaskBulkFields-- bulk variables, bulk connectionextra, multipleactions/entities, delete-by-key, and five malformed shapes
guard tests correctly pass either way
test_decorators.py-- 30 passedtest_variables.py+test_connections.py-- 230 passedruff check/ruff formatcleanWas generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 5 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions