Apply the ambiguous-id refusal to get_config in the Key Vault backend - #70899
Conversation
|
CI fixed, and the fix reaches beyond this PR — the Amazon tests already on The failures were # main — structlog renders the args before the stdlib record exists
LogRecord(msg="Connection id 'prod--x' contains '--'", args=())
"prod--x" in r.msg -> True
# compat targets — plain stdlib logging keeps the template
LogRecord(msg="%s id %r contains %r", args=("Connection", "prod--x", "--"))
"prod--x" in r.msg -> False <- the failure
"prod--x" in r.getMessage() -> True
This is my own regression: I switched those assertions from |
47506d7 to
ce3c021
Compare
|
Rewritten to Azure only — the repair to I had folded the Amazon test fix in here because it was the same one-line cause, but that conflated two things: this PR is a follow-up guard for Key Vault, whereas This branch is now: The |
Follow-up to apache#70876. The check used to live in _get_secret, which all three getters share. Moving it up into get_conn_value and get_variable left get_config reaching _get_secret unguarded, so the helper's claim that such an id is refused for every lookup stopped being true. Not a cross-team read -- get_config never receives a team_name -- but two getters and the docstring disagreed with the third. The same gap was found in review of the Amazon sibling (apache#70878) and fixed there; this is the Azure half, which had already merged by then. _names_a_team_namespace stays an instance method here, unlike Amazon's: it builds the candidate path with self.build_path and self.sep. The refusal-logging assertion uses getMessage() rather than msg, since how a record carries its payload differs between the Airflow version this runs on and the ones the provider compat tests use.
ce3c021 to
d41d9da
Compare
Backport failed to create: v3-3-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker cfe3f0b v3-3-testThis should apply the commit to the v3-3-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
Follow-up to #70876.
The ambiguous-id check used to live in
_get_secret, which all three gettersshare. Moving it up into
get_conn_valueandget_variableleftget_configreaching
_get_secretunguarded, so_names_a_team_namespace's claim that suchan id is refused for every lookup stopped being true the moment it was written —
two getters and the docstring disagreed with the third.
Not a cross-team read.
get_confignever receives ateam_name, so no teamnamespace is reachable through it. The defect is the inconsistency and the false
docstring, not an exposure.
@shahar1 found this while reviewing the Amazon sibling (#70878), where it is
already fixed. Azure had the same shape and had merged by then, so this is the
other half.
_names_a_team_namespacestays an instance method here, unlike Amazon's,because it builds the candidate path with
self.build_pathandself.sep.Test plan
test_refusing_an_ambiguous_id_is_loggedextended toget_config; verifiedit fails without the guard
structlog, which renders format args into
msgbefore the stdlib recordexists, so
record.argsis empty and there is no structured payload toassert on; it now asserts level, logger and the refused id
test_key_vault.py— 20 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