JelyFishhhhhh commented on code in PR #73797:
URL: https://github.com/apache/airflow/pull/73797#discussion_r4409979908
##########
shared/secrets_masker/src/airflow_shared/secrets_masker/secrets_masker.py:
##########
@@ -590,6 +610,8 @@ def should_hide_value_for_key(self, name):
if isinstance(name, str) and self.hide_sensitive_var_conn_fields:
name = name.strip().lower()
normalized = re.sub(r"\W+", "_", name)
+ if normalized.rsplit("__", 1)[-1] in DEFAULT_SENSITIVE_FIELD_NAMES:
Review Comment:
Done in the rebase: the whole-name check now looks at both the plain
normalized form and the camelCase-split form from #74840, so `kubeConfig` and
`routingKey` are hidden while `kubeConfigPath` is not. Added those three keys
to `test_hiding_whole_field_names`.
---
Drafted-by: Claude Code (Opus 5.5) (no human review before posting)
##########
airflow-core/tests/unit/always/test_providers_manager.py:
##########
@@ -269,6 +270,40 @@ def test_connection_form_widgets(self,
yaml_ui_metadata_counts):
# widgets loaded from YAML metadata only
assert len(connections_form_widgets) == yaml_widgets
+ @pytest.mark.execution_timeout(120)
+ def test_sensitive_connection_fields_are_redactable(self):
+ """
+ Every connection field a provider declares as sensitive must be in the
redaction allowlist.
+
+ Providers already state which fields are secret; this asserts the
allowlist never drifts
+ apart from them.
+ """
+ pytest.importorskip("flask_appbuilder", reason="connection form
widgets need flask_appbuilder")
+
+ # Check the shipped defaults rather than the process-wide masker, whose
+ # sensitive_variables_fields is only populated once settings have been
configured.
+ masker = SecretsMasker()
+ masker.sensitive_variables_fields = list(DEFAULT_SENSITIVE_FIELDS)
+
+ # "config" is too generic a field name to add to the allowlist;
apprise's
+ # "config" field is handled separately.
+ allowed_unredacted = {("config", "apache-airflow-providers-apprise")}
+
+ provider_manager = ProvidersManager()
+ missing = sorted(
+ {
+ (widget.field_name, widget.package_name)
+ for widget in provider_manager.connection_form_widgets.values()
Review Comment:
Switched the test to `_connection_form_widgets_from_metadata` and dropped
the `importorskip` and the timeout. Seven of the nine names are declared
`format: password` in provider metadata, so the test still fails on main
without the new names. Also updated the apprise comment to say that `config` is
masked in API responses but not in task logs.
---
Drafted-by: Claude Code (Opus 5.5) (no human review 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]