You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/09/27 13:23:33 UTC
[PR] Mask XCom values in the audit log [airflow]
potiuk opened a new pull request, #73791:
URL: https://github.com/apache/airflow/pull/73791
The audit log masks the value of Variable and Connection writes unconditionally, because it records that something was written rather than what. XCom create and update requests fell through to per-key name redaction, so their values were stored in the audit log as sent. This masks the XCom value the same way; the key and map index are kept. Adds unit tests for the masker and route tests asserting the stored audit entry for create and update carries `"value": "***"`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #73791:
URL: https://github.com/apache/airflow/pull/73791#issuecomment-6270300812
### Backport successfully created: v3-4-test
Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
<table>
<tr>
<th>Status</th>
<th>Branch</th>
<th>Result</th>
</tr>
<tr>
<td>✅</td>
<td>v3-4-test</td>
<td><a href="https://github.com/apache/airflow/pull/75113"><img src="https://img.shields.io/badge/PR-75113-blue" alt="PR Link"></a></td>
</tr>
</table>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "fat-catTW (via GitHub)" <gi...@apache.org>.
fat-catTW commented on PR #73791:
URL: https://github.com/apache/airflow/pull/73791#issuecomment-5955039646
I think this fixes the sensitive part, but the new XCom branch seems to drop the existing path/query audit context when the request has a body.
Before this change, XCom requests fell through to the generic JSON branch, which merged the existing `extra_fields` with the masked body:
`extra_fields = {**extra_fields, **masked_body_json}`
So a PATCH like `.../xcomEntries/report_rows?map_index=0` kept `xcom_key` / `map_index` from path/query and added the body.
With the new branch:
`extra_fields = _mask_xcom_fields(request_body or extra_fields)`
a body such as `{"value": "secret"}` replaces the existing `extra_fields`, so the audit entry becomes essentially `{"value": "***", "method": "PATCH"}` and no longer identifies which XCom was updated.
Maybe we can merge the masked XCom body into the existing extra_fields instead? I think that would keep the previous audit context while still masking value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #73791:
URL: https://github.com/apache/airflow/pull/73791
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "fat-catTW (via GitHub)" <gi...@apache.org>.
fat-catTW commented on code in PR #73791:
URL: https://github.com/apache/airflow/pull/73791#discussion_r4166922319
##########
airflow-core/src/airflow/api_fastapi/logging/decorators.py:
##########
@@ -246,6 +258,8 @@ async def log_action(
extra_fields = _mask_variable_fields(request_body or extra_fields)
elif "connection" in event_name:
extra_fields = _mask_connection_fields(request_body or extra_fields)
+ elif "xcom" in event_name:
+ extra_fields = _mask_xcom_fields(request_body or extra_fields)
Review Comment:
I think this fixes the sensitive part, but the new XCom branch seems to drop the existing path/query audit context when the request has a body.
Before this change, XCom requests fell through to the generic JSON branch, which merged the existing `extra_fields` with the masked body:
`extra_fields = {**extra_fields, **masked_body_json}`
So a PATCH like `.../xcomEntries/report_rows?map_index=0` kept `xcom_key` / `map_index` from path/query and added the body.
With the new branch:
`extra_fields = _mask_xcom_fields(request_body or extra_fields)`
a body such as `{"value": "secret"}` replaces the existing `extra_fields`, so the audit entry becomes essentially `{"value": "***", "method": "PATCH"}` and no longer identifies which XCom was updated.
Maybe we can merge the masked XCom body into the existing `extra_fields` instead? I think that would keep the previous audit context while still masking `value`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #73791:
URL: https://github.com/apache/airflow/pull/73791#discussion_r4179548987
##########
airflow-core/src/airflow/api_fastapi/logging/decorators.py:
##########
@@ -246,6 +258,8 @@ async def log_action(
extra_fields = _mask_variable_fields(request_body or extra_fields)
elif "connection" in event_name:
extra_fields = _mask_connection_fields(request_body or extra_fields)
+ elif "xcom" in event_name:
+ extra_fields = _mask_xcom_fields(request_body or extra_fields)
Review Comment:
Good catch, thank you — you're right: the XCom branch replaced the path/query context with the body, so an update row lost `xcom_key`. Fixed in fba6f3e95b by merging the masked body into the existing `extra_fields` (`_mask_xcom_fields({**extra_fields, **masked_body_json})`), as you suggested. `test_patch_xcom_entry_audit_log_masks_value` now also asserts that `xcom_key` is kept.
---
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Mask XCom values in the audit log [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #73791:
URL: https://github.com/apache/airflow/pull/73791#issuecomment-6207506928
@amoghrajesh @pierrejeambrun Rebased on main to resolve a conflict. Could one of you review it for 3.4.0 (cut 2026-10-19)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org