From 76e3c3d8128b8d65d3dfecd4d6c9de9d7a36c7e2 Mon Sep 17 00:00:00 2001 From: Hyukjin Kwon Date: Tue, 8 Sep 2026 12:46:51 +0900 Subject: [PATCH 1/2] [SPARK-59306][SS] Redact all JAAS credential styles in Kafka parameter logging ### What changes were proposed in this pull request? `KafkaRedactionUtil.redactJaasParam` redacts credential values in a `sasl.jaas.config` string before it is logged (at DEBUG). The previous regex `password="..."` only masked a double-quoted value of an option named `password`, so a `password` value in single-quoted or unquoted form, and the OAUTHBEARER `clientSecret` value, were not masked. This parses each `key=value` option in the JAAS entry (escape-aware for quoted values, so an escaped quote does not cut the value short) and redacts the value of an option in any quoting style when its name matches either: - the always-redacted credential options `password` and `clientSecret` (matched case-insensitively as a substring), which are masked unconditionally so redaction never depends on configuration; or - the configured `spark.redaction.regex`, which widens coverage on top of the built-in options. Because `spark.redaction.regex` replaces the default rather than extending it, consulting it alone would be fail-open (a user pattern that omits `password` would silently stop masking it); the union with the built-in options keeps the unconditional guarantee the old code had. Non-secret options (the login-module class, control flag, `username`, `serviceName`, `clientId`, ...) are left intact so the entry stays readable in logs. ### Why are the changes needed? So Kafka JAAS credentials are not exposed in DEBUG logs regardless of how they are quoted, and so the OAUTHBEARER `clientSecret` is masked as well as `password`. ### Does this PR introduce _any_ user-facing change? No functional change. This only affects DEBUG log output: `password` values in single-quoted and unquoted forms (in addition to the double-quoted form already masked), `clientSecret` values, and values of any option whose name matches `spark.redaction.regex` are now shown as `