nhuantho commented on code in PR #59873:
URL: https://github.com/apache/airflow/pull/59873#discussion_r2653421511
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/config.py:
##########
@@ -25,6 +31,22 @@ class ConfigOption(StrictBaseModel):
key: str
value: str | tuple[str, str]
+ @model_validator(mode="after")
+ def redact_value(self) -> Self:
+ if self.value is None:
+ return self
+ if isinstance(self.value, tuple):
+ return self
+ try:
+ value_dict = json.loads(self.value)
+ redacted_dict = redact(value_dict, max_depth=1)
+ self.value = json.dumps(redacted_dict)
+ return self
+ except json.JSONDecodeError:
+ # value is not a serialized string representation of a dict.
+ self.value = str(redact(self.value, self.key))
+ return self
Review Comment:
@jason810496 I tested with `smtp_password` in
`airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_config.py`
--
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]