Skip to content

Add ConnectionResponse serializer safeguard - #63883

Merged
pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:add-connection-response-safeguard-for-non-json-string
Mar 23, 2026
Merged

pierrejeambrun merged 1 commit into
apache:mainfrom
astronomer:add-connection-response-safeguard-for-non-json-string

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Mar 18, 2026 •

Copy link
Copy Markdown
Member

This adds a safeguard and makes the code intent less confusing. It would be easy to assume that this could 'leak' some sensitive data if the extra wasn't a valid JSON. (But the DB layer guarantee this). Instead of relying on that db layer implicitly, make the coupling explicit.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@pierrejeambrun pierrejeambrun self-assigned this Mar 18, 2026
@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Mar 18, 2026
@pierrejeambrun
pierrejeambrun force-pushed the add-connection-response-safeguard-for-non-json-string branch 2 times, most recently from 8d6fce3 to b8653c3 Compare March 20, 2026 10:32
@pierrejeambrun
pierrejeambrun force-pushed the add-connection-response-safeguard-for-non-json-string branch from b8653c3 to a51d980 Compare March 20, 2026 16:54
@pierrejeambrun
pierrejeambrun force-pushed the add-connection-response-safeguard-for-non-json-string branch from a51d980 to 39175fd Compare March 23, 2026 10:12
@pierrejeambrun
pierrejeambrun merged commit 09ed27a into apache:main Mar 23, 2026
145 checks passed
@pierrejeambrun
pierrejeambrun deleted the add-connection-response-safeguard-for-non-json-string branch March 23, 2026 13:47
abhijeets25012-tech pushed a commit to abhijeets25012-tech/airflow that referenced this pull request Apr 9, 2026
bbovenzi pushed a commit that referenced this pull request Aug 12, 2026
#63883 added a fail-closed safeguard on ``ConnectionResponse.redact_extra``:
if the ``extra`` column ever slips past ``Connection._validate_extra`` (direct
SQL, buggy migration, legacy data) and reaches the response serializer as a
non-JSON string, the validator raises rather than returning the raw value.
The path is unreachable through normal ORM access because ``Connection.get_extra``
already fails on read, so the model-level guard is defense in depth. It had
no test until now — this feeds the Pydantic model directly to exercise the
branch and pin the fail-closed behavior.

closes: #63160
pierrejeambrun added a commit that referenced this pull request Aug 13, 2026
…71537)

#63883 added a fail-closed safeguard on ``ConnectionResponse.redact_extra``:
if the ``extra`` column ever slips past ``Connection._validate_extra`` (direct
SQL, buggy migration, legacy data) and reaches the response serializer as a
non-JSON string, the validator raises rather than returning the raw value.
The path is unreachable through normal ORM access because ``Connection.get_extra``
already fails on read, so the model-level guard is defense in depth. It had
no test until now — this feeds the Pydantic model directly to exercise the
branch and pin the fail-closed behavior.

closes: #63160
(cherry picked from commit 9ced296)
vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
…71537)

#63883 added a fail-closed safeguard on ``ConnectionResponse.redact_extra``:
if the ``extra`` column ever slips past ``Connection._validate_extra`` (direct
SQL, buggy migration, legacy data) and reaches the response serializer as a
non-JSON string, the validator raises rather than returning the raw value.
The path is unreachable through normal ORM access because ``Connection.get_extra``
already fails on read, so the model-level guard is defense in depth. It had
no test until now — this feeds the Pydantic model directly to exercise the
branch and pin the fail-closed behavior.

closes: #63160
(cherry picked from commit 9ced296)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants