Skip to content

[KYUUBI #7387] Fix the redaction of sensitive values#7451

Open
LamiumAmplexicaule wants to merge 1 commit into
apache:masterfrom
LamiumAmplexicaule:fix-redaction
Open

[KYUUBI #7387] Fix the redaction of sensitive values#7451
LamiumAmplexicaule wants to merge 1 commit into
apache:masterfrom
LamiumAmplexicaule:fix-redaction

Conversation

@LamiumAmplexicaule
Copy link
Copy Markdown
Contributor

Why are the changes needed?

Fix the redaction of sensitive values when kyuubi.server.redaction.regex is configured.
Close #7387.

How was this patch tested?

Unit tests.

$ ./build/mvn clean install -Dtest=none -DwildcardSuites=org.apache.kyuubi.BatchTestHelper,org.apache.kyuubi.engine.EngineRefTests,org.apache.kyuubi.engine.EngineRefWithZookeeperSuite,org.apache.kyuubi.engine.JpsApplicationOperationSuite,org.apache.kyuubi.engine.dataagent.DataAgentProcessBuilderSuite,org.apache.kyuubi.engine.flink.FlinkProcessBuilderSuite,org.apache.kyuubi.engine.hive.HiveProcessBuilderSuite,org.apache.kyuubi.engine.hive.HiveYarnModeProcessBuilderSuite,org.apache.kyuubi.engine.jdbc.JdbcProcessBuilderSuite,org.apache.kyuubi.engine.jdbc.JdbcYarnModeProcessBuilderSuite,org.apache.kyuubi.engine.spark.SparkBatchProcessBuilderSuite,org.apache.kyuubi.engine.spark.SparkProcessBuilderSuite,org.apache.kyuubi.engine.trino.TrinoProcessBuilderSuite,org.apache.kyuubi.server.api.v1.AdminResourceSuite,org.apache.kyuubi.server.api.v1.BatchesResourceSuite,org.apache.kyuubi.server.rest.client.AdminCtlSuite,org.apache.kyuubi.server.rest.client.AdminRestApiSuite,org.apache.kyuubi.server.rest.client.PySparkBatchRestApiSuite,org.apache.kyuubi.UtilsSuite

Was this patch authored or co-authored using generative AI tooling?

No.

Comment on lines -328 to -338
var nextKV = false
commands.map {
case PATTERN_FOR_KEY_VALUE_ARG(key, value) if nextKV =>
case PATTERN_FOR_KEY_VALUE_ARG(key, value) =>
val (_, newValue) = redact(redactionPattern, Seq((key, value))).head
nextKV = false
genKeyValuePair(key, newValue)

case cmd if cmd == CONF =>
nextKV = true
cmd

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the test that checks whether the logs in FlinkProcessBuilder are redacted, I noticed that values in the -D format don’t get redacted, so I removed this filter.

import org.apache.kyuubi.util.command.CommandLineUtils._

class DataAgentProcessBuilder(
override val serverConf: KyuubiConf,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think adding an extra serverConf parameter is a good idea. This would result in two configurations that appear identical except for their names, which could cause significant confusion during usage—users might wonder, "Which configuration should I actually use?"

Copy link
Copy Markdown
Contributor Author

@LamiumAmplexicaule LamiumAmplexicaule May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your comments.

My understanding is that the reason redaction no longer happens after #7054 is that, in

val userConf = this.getConf.getUserDefaults(user)
, the sessionConf passed in has the serverOnly configs stripped out.

If we want to obtain kyuubi.server.redaction.regex from ProcessBuilder without passing serverConf, we need to explicitly set it somewhere.
However, it feels wrong to propagate server-side config into the session/engine configs, so I chose the approach of passing serverConf instead.

When passing conf as serverConf, if we strip out everything except serverOnly, we might avoid accidentally referencing serverConf.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am planning to update this PR to pass Option[Regex] instead of serverConf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] kyuubi.server.redaction.regex no longer redacts sensitive values in the "Launching engine:" log line

2 participants