phanikumv commented on code in PR #76803:
URL: https://github.com/apache/airflow/pull/76803#discussion_r4611747468
##########
task-sdk/src/airflow/sdk/execution_time/loop.py:
##########
@@ -121,8 +120,7 @@ def execute_loop_gate(gate: LoopGateOperator, context:
Context) -> None:
f"until must return a bool or LoopDecision, got
{type(result).__name__}"
)
if reason is not None:
- # Mask here, where we can know what the task has masked.
- reason = cast("str", redact(reason))
+ # The supervisor masks the reason, for a gate of every language.
Review Comment:
Moving `redact` out of here masks the stored `loop_decision`, but `reason`
is also used a few lines down in `suffix`, which goes into the
`LoopMaxIterationsExceeded` message. The task runner keeps that exception as
`context["exception"]` and passes it to `on_failure_callback` and to the
failure email, which renders `str(error)` without masking. So a Dag with a
Slack or email failure callback in `default_args` now sends an unmasked secret
from a reason, where before this PR it sent `***`. I checked at this head with
a registered mask: the exception text, and what a failure callback and the
email receive, contain the secret. With the base `loop.py` they show `***`.
Could the message keep using a masked copy, with the unmasked reason only
going into the payload for the supervisor?
```python
suffix = "" if reason is None else f": {redact(reason)}"
```
A test that the `LoopMaxIterationsExceeded` text is masked would pin it
down. The ADR consequence about Python reasons being redacted one process later
could mention this too.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]