nsivabalan opened a new pull request, #20811: URL: https://github.com/apache/hudi/pull/20811
### Describe the issue this Pull Request addresses Several Hudi Streamer log lines can print credentials in plaintext: - `KafkaSource#createKafkaRDD` logs the full Kafka consumer params at DEBUG. With SASL or a secured Schema Registry these include `sasl.jaas.config` and `basic.auth.user.info`, so turning on debug logging leaks the Kafka password and the registry secret. - `BootstrapExecutor` logs the full bootstrap write config at INFO, with no masking. - The Hudi Streamer config dump (`HoodieStreamer#toSortedTruncatedString`) masks a value only when its key contains one of `hoodie.sensitive.config.keys` (default `ssl,tls,sasl,auth,credentials`). Keys such as `hoodie.datasource.hive_sync.password`, `hoodie.streamer.jdbc.password`, `hoodie.aws.secret.key` or `*.token` are printed as is. - Credentials embedded in a URL, e.g. a schema registry URL of the form `https://key:secret@host/subjects/...`, are printed by all of the above, because the key itself is not sensitive. ### Summary and Changelog Hudi Streamer, the bootstrap executor and the Kafka source now mask sensitive values the same way before logging them. - New `SensitiveConfigUtils` in hudi-utilities. It holds the masking that `HoodieStreamer` did inline, driven by `hoodie.sensitive.config.keys`: - `maskSensitiveValues(configs, props)` returns a key-sorted copy of a config map that is safe to log. The input map is not modified, since the Kafka params are still passed to the consumer. - `maskSensitiveValue(key, value, filters)` masks a single value. - `maskUrlCredentials(value)` removes the userinfo from every URL in a value, keeping scheme, host and path. It handles comma-separated URL lists and secrets that contain `/` or `@` (they are often not URL-encoded). - `KafkaSource#createKafkaRDD` masks both param maps in its DEBUG log, and only builds them when DEBUG is enabled. - `BootstrapExecutor` masks the bootstrap config it logs. - `HoodieStreamer#toSortedTruncatedString` uses the helper and now masks before truncating, so a truncated value cannot keep part of a secret. - The default of `hoodie.sensitive.config.keys` is extended from `ssl,tls,sasl,auth,credentials` to `ssl,tls,sasl,auth,credentials,password,secret,token`. Matching stays a substring check on the key, so `secret` also covers keys such as `*.secrets.*`. New test `TestSensitiveConfigUtils`: - default filters: asserts the full masked map of a SASL/Schema Registry Kafka config, that no secret appears in its string form, and that the input map is unchanged; - custom filters; - `TypedProperties` input; - URL credential removal, including secrets containing `/` or `@`, comma-separated lists, values without userinfo, plain e-mail addresses and null; - the Hudi Streamer config dump of a schema registry URL with credentials. ### Impact Log output only. The values of sensitive keys show as `SENSITIVE_INFO_MASKED` in these log lines, and URL credentials are dropped from logged values. Configs passed to Kafka, the write client and the schema provider are not changed. No public API change. Users who rely on seeing a password/secret/token value in the streamer config dump will now see it masked; they can override `hoodie.sensitive.config.keys` to restore the old list. ### Risk Level low. Only logging changes; the masked maps are copies. ### Documentation Update The default value and description of `hoodie.sensitive.config.keys` changed. The config docs are generated from the description. ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] Adequate tests were added if applicable 🤖 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
