[KYUUBI #7727][UTIL] Trim each side of the pair in genKeyValuePair - #7728
Open
LuciferYang wants to merge 1 commit into
Open
[KYUUBI #7727][UTIL] Trim each side of the pair in genKeyValuePair#7728LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
pan3793
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
Closes #7727.
genKeyValuePairtrimmed only the concatenated string (s"$key=$value".trim), so whitespace between the key and value survived:genKeyValuePair("abc ", "123")returned"abc =123".redactConfValuessplits an assembled argument on the first=and matches the key against an exact key set, so a spaced key ("<key> =") misses the set and the value is not redacted.This matters for the Data Agent engine's API key.
kyuubi.engine.data.agent.openai.api.keyis not matched by the default pattern-based redaction, so exact-key redaction is its only guard, and session conf keys are not trimmed on the way to the engine command. A key carrying a trailing space slipped both stages and logged the API key value. Trimming each side (s"${key.trim}=${value.trim}") makes the assembled pair carry no inner whitespace, so the exact-key stage sees the clean key.Utils.redactCommandLineArgsalso assembles throughgenKeyValuePair, so the same fix closes the hole at both assembly points.How was this patch tested?
Added
CommandUtilsSuitecases: symmetric-trim assertions (genKeyValuePair("abc ", " 123")->"abc=123", including a tab) and a redaction round-trip that assembles a spaced Data Agent api-key argument and assertsredactConfValuesmasks it. Both fail on the old.trim.kyuubi-util-scalagreen on Zulu 17.0.18 (22/22), scalastyle 0 errors, spotless clean;kyuubi-commonUtilsSuite(which exercisesredactCommandLineArgs) 14/14.Was this patch assisted by generative AI tooling?
Assisted-by: Claude Opus 4.8