apache / apache/kyuubi

Spaced conf keys escape exact-key redaction in logged engine commands

Open Beginner friendly
#7,727 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
2.4k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

`genKeyValuePair` assembles a `key=value` command-line argument by trimming only the concatenated string:

```scala
def genKeyValuePair(key: String, value: String): String = s"$key=$value".trim
```

`.trim` on the whole string strips the outer ends but leaves any whitespace between the key and the value. `genKeyValuePair("abc ", "123")` returns `"abc =123"`, with the space kept before the `=`, so the trim the method advertises is only half applied.

This has a concrete consequence for secret redaction. `redactConfValues` splits each assembled argument on `=` and matches the key against an exact key set. When a conf key carries stray whitespace, the assembled argument is `" ="`, so the extracted key `" "` misses the exact set and the value is not redacted.

The gap is reachable for the Data Agent engine's API key. `kyuubi.engine.data.agent.openai.api.key` is not matched by the default pattern-based redaction (`secret|password|token|access.key`), so exact-key redaction is the only stage that would mask it. Session conf keys are not trimmed on the way through, so a key submitted with a trailing space escapes that stage and the API key value lands in the engine launch command written to the server log.

### Affects Version(s)

master (1.13.0-SNAPSHOT), and earlier releases carrying `kyuubi-util-scala`.

### Are you willing to submit PR?

Yes.

Contributor guide

Open the contributing guide

Research direction

Start by locating genKeyValuePair and redactConfValues in the kyuubi-util-scala code, then inspect the existing tests for command assembly and configuration redaction. Reproduce a key with trailing whitespace and verify that exact-key values, including the Data Agent API key, are masked in the logged engine command.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.