Repository navigation
Read the msgraph connection extra with get_async_extra_dejson - #74161
Merged
Merged
Conversation
Connection.extra_dejson masks the extra's secrets with a synchronous call to the supervisor, which raises DeadlockImminentError when a hook reads it on an event loop with another async call in flight. Airflow 3.3.2+ has Connection.aextra_dejson() (apache#71890), but providers that still support older versions cannot call it directly, so async hooks fall back to json.loads(conn.extra) and skip the masking (apache#72130). get_async_extra_dejson(conn) awaits Connection.aextra_dejson() when it exists, and otherwise runs extra_dejson in a worker thread, where blocking on the supervisor is safe, as get_async_connection() does for get_connection(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 task done
KiotaRequestAdapterHook.get_async_conn() deserialized the raw extra with json.loads(connection.extra) to avoid extra_dejson, whose secret masking is a synchronous call on the event loop. That skipped masking the extra's values. It now uses common.compat's get_async_extra_dejson(), which masks them asynchronously on Airflow 3.3.2+ and from a worker thread on older versions. The deprecated sync get_conn() is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dabla
force-pushed
the
feature/msgraph-async-extra-dejson
branch
from
October 3, 2026 13:16
fa03e1a to
1705f49
Compare
shahar1
approved these changes
Oct 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dabla
marked this pull request as ready for review
October 3, 2026 13:38
1 task done
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.
KiotaRequestAdapterHook.get_async_conn()deserializes the raw connection extra withjson.loads(connection.extra), to avoidextra_dejson, whose secret masking sends to the supervisor synchronously and fails on the event loop (#54350, #55179). That works, but skips masking the extra's individual values (e.g. proxy credentials, client secrets in the extra).This switches the async path to
get_async_extra_dejson()from common.compat (#74147):Connection.aextra_dejson()on Airflow 3.3.2+ (masks asynchronously, #71890),extra_dejsonin a worker thread on older versions (safe there: from 3.2 the channel has a thread lock, and on 3.0/3.1 async code only runs in the triggerer, which serializes requests throughasend(); #74166 tests this against the real supervisor comms)._build_request_adapter()now receives the deserialized extra instead of parsing it. The deprecated syncget_conn()readsconnection.extra_dejsonagain (review suggestion), so its extra is masked too. Note that #54350 was not fixed in Airflow itself: it was closed through thejson.loadsworkaround in this hook (#55179), and Airflow only made the extra readable on an event loop with #71890 (3.3.2).extra_dejsonis safe inget_conn()because it is only called from sync code (nothing in the provider calls it from the async path); calling the deprecatedget_conn()from inside an event loop on Airflow < 3.3.2 would hit #54350 again, so useget_async_conn()there.Tests: a new test asserts
get_async_conn()reads the extra throughget_async_extra_dejson(); the existing msgraph hook/operator/sensor/trigger tests pass unchanged.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 5.5 following the guidelines