TEZ-4756: DAGUtils: configuration handling improvements - #539
abstractdog wants to merge 2 commits into
Conversation
Route each key/value pair through Hadoop's ConfigRedactor when building the ATS configuration map, so values matching the cluster's configured sensitive-key pattern are masked in the map published to Timeline. Adds a unit test. Co-Authored-By: Claude Code <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new unit test includes credential-like strings that can trigger secret-scanning and it should be adjusted to use safe placeholders and more reliably exercise default redaction behavior.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Improves how Tez publishes AM configuration data to YARN Timeline/ATS by redacting sensitive configuration values (based on Hadoop’s sensitive-key patterns) before building the ATS configuration map, and adds a unit test covering redaction behavior.
Changes:
- Route all configuration values through Hadoop
ConfigRedactorinDAGUtils.convertConfigurationToATSMap. - Add a unit test verifying sensitive keys are masked and non-sensitive keys remain unchanged.
File summaries
| File | Description |
|---|---|
| tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java | Redacts configuration values via ConfigRedactor before publishing to ATS. |
| tez-dag/src/test/java/org/apache/tez/dag/history/utils/TestDAGUtils.java | Adds a unit test validating redaction behavior for sensitive configuration keys. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| @Test | ||
| public void testConvertConfigurationToATSMapRedactsSecrets() { | ||
| Configuration conf = new Configuration(false); |
There was a problem hiding this comment.
ack, DAGAppMaster for example simply instantiates new Configuration(), so this makes sense
| // These keys are covered by Hadoop's default | ||
| // hadoop.security.sensitive-config-keys pattern. | ||
| conf.set("fs.s3a.secret.key", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYSECRET"); | ||
| conf.set("fs.s3a.access.key", "AKIAIOSFODNN7EXAMPLE"); | ||
| conf.set("ssl.server.keystore.password", "SuperSecretKeystorePass!"); | ||
| conf.set("hadoop.security.credential.provider.password", "credpass"); | ||
|
|
||
| Map<String, String> ats = DAGUtils.convertConfigurationToATSMap(conf); | ||
|
|
||
| assertEquals("org.apache.tez.dag.app.dag.impl.DAGSchedulerNaturalOrder", | ||
| ats.get("tez.am.dag.scheduler.class")); | ||
| assertEquals("normal-job", ats.get("mapreduce.job.name")); | ||
| assertFalse(ats.get("fs.s3a.secret.key").contains("SECRET"), | ||
| "s3a secret key must be redacted, got: " + ats.get("fs.s3a.secret.key")); | ||
| assertFalse(ats.get("ssl.server.keystore.password").contains("SuperSecret"), | ||
| "keystore password must be redacted, got: " + ats.get("ssl.server.keystore.password")); | ||
| assertFalse(ats.get("hadoop.security.credential.provider.password").contains("credpass"), | ||
| "credential provider password must be redacted, got: " | ||
| + ats.get("hadoop.security.credential.provider.password")); |
There was a problem hiding this comment.
ack, even if I like these realistic values
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
Route each key/value pair through Hadoop's ConfigRedactor when building the ATS configuration map, so values matching the cluster's configured sensitive-key pattern are masked in the map published to Timeline. Adds a unit test.