Give kyuubi.server.redaction.regex a default so REDACTED redacts on a stock install - #7639
Open
zanarellidev wants to merge 1 commit into
Open
Conversation
… stock install
kyuubi.server.conf.retrieveMode defaults to REDACTED since 1.12.0, but the
regex it depends on (kyuubi.server.redaction.regex) has no default, so
GET /api/v1/sessions and /api/v1/sessions/{handle} return session conf
(including spark.password-style keys) unredacted out of the box. The test
suite masked this: SessionsResourceSuite sets the pattern explicitly on its
shared conf, so no test exercised the stock-default path.
Give kyuubi.server.redaction.regex a default of
"(?i)secret|password|token|access[.]key", the same pattern
SparkSQLEngine already falls back to for spark.redaction.regex, so REDACTED
actually redacts by default instead of silently behaving like ORIGINAL.
This also improves Utils.redactCommandLineArgs, which shares the same
config entry for redacting spawned command-line args.
Member
|
@zanarellidev, thanks for raising this PR. it's unnecessary to emphasize the default value in config |
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.
Follow-up from a private report I sent to security@apache.org (forwarded to the Kyuubi PMC, cc @yikf @pan3793 @turboFei). @aajisaka reviewed the original patch (which made the REST session-conf response fail closed on an unset regex) and flagged it as a breaking change for the conf-map shape, and suggested the master-branch fix should instead give the redaction regex a real default. This PR is that.
Why are the changes needed?
kyuubi.server.conf.retrieveModedefaults toREDACTEDsince 1.12.0, but the regex it depends on (kyuubi.server.redaction.regex) has no default (createOptional, nocreateWithDefault).ApiUtils.buildConf'sREDACTEDcase hands thatNonestraight toUtils.redact, whoseNonebranch returns the conf map untouched. SoGET /api/v1/sessionsandGET /api/v1/sessions/{handle}return session conf — includingspark.password-style keys — unredacted on a stock install, even though the retrieve mode isREDACTED.SessionsResourceSuitemasked this: its sharedconfsetskyuubi.server.redaction.regexto(?i)passwordexplicitly (line 45), so no existing test exercises the stock-default path.Fix
Give
kyuubi.server.redaction.regexa default of"(?i)secret|password|token|access[.]key"— the same fallback patternSparkSQLEnginealready uses forspark.redaction.regex(SparkSQLEngine.scala:275), so this isn't a new convention.REDACTEDnow actually redacts by default instead of silently behaving likeORIGINAL. As a side effect,Utils.redactCommandLineArgs(which shares the same config entry for redacting spawned command-line args) gets the same improvement.Also updated
SERVER_CONF_RETRIEVE_MODE's doc to reflect that the redaction pattern now has a default.How was this patch tested?
SessionsResourceSuite: "get /sessions redacts spark confs by default with no explicit redaction regex" — explicitly unsets the redaction pattern (withNoExplicitRedactionPattern) and asserts aspark.passwordvalue comes back redacted, not raw."shouldNeverLeak" equaled "shouldNeverLeak"); with the default applied, it passes.build/mvn test -pl kyuubi-server -am -DwildcardSuites=org.apache.kyuubi.server.api.v1.SessionsResourceSuite: 9/9 relevant tests pass (3 unrelated tests in this suite —submit operation and get operation handle,fix kyuubi session leak caused by engine stop,list all type operations under session— fail identically on unmodifiedmasterin this environment; confirmed pre-existing/environmental, not related to this change).dev/reformatrun; diff scoped back down to the 4 files this PR touches (the initial pass also reformatted unrelated pre-existing drift acrosskyuubi-hive-beeline/kyuubi-hive-jdbc, reverted before committing).Was this patch authored or co-authored using generative AI tooling?
Assisted-by: Claude Sonnet 5