Skip to content

[KYUUBI #7671][AUTHZ] Cover all injected authz rules in the excludedRules check - #7672

Open
alexandrefimov wants to merge 1 commit into
apache:masterfrom
alexandrefimov:kyuubi-authz-excluded-rules-prefix
Open

[KYUUBI #7671][AUTHZ] Cover all injected authz rules in the excludedRules check#7672
alexandrefimov wants to merge 1 commit into
apache:masterfrom
alexandrefimov:kyuubi-authz-excluded-rules-prefix

Conversation

@alexandrefimov

Copy link
Copy Markdown
Contributor

Why are the changes needed?

Closes #7671, the follow-up @wForget asked for while reviewing #7637.

AuthzConfigurationChecker matches org.apache.kyuubi.plugin.spark.authz.ranger in the effective spark.sql.optimizer.excludedRules, which was the whole extension when the check was written. Most rules live under org.apache.kyuubi.plugin.spark.authz.rule now, so a rule added there is outside the denylist. This matches the extension's own package instead.

It is future-proofing rather than a fix for a live bypass, and worth saying why. spark.sql.optimizer.excludedRules filters optimizer batches only and Spark has no analyzer counterpart, so the resolution rules that apply masking and row filtering cannot be excluded at all. Of the four optimizer rules RangerSparkExtension injects, RuleAuthorization is in …authz.ranger and already covered; the other three — RuleEliminateMarker, RuleEliminatePermanentViewMarker, RuleEliminateTypeOf — only strip markers after the check has run, and excluding one of them breaks the query instead of lifting a check.

The change does reject configurations that are accepted today, which is why it is separate from #7637 rather than part of it.

How was this patch tested?

A new case in AuthzConfigurationCheckerSuite covers the three …authz.rule rules by their ruleName, through both paths the checker guards: the value in effect, and the SET syntax.

30 tests green across AuthzConfigurationCheckerSuite, DataMaskingForInMemoryParquetSuite and the row filtering suite. With the constant reverted to the ranger package the new case fails, so it tests the change rather than the code around it.

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

Assisted-by: Claude Opus 5

…ludedRules check

AuthzConfigurationChecker rejects a spark.sql.optimizer.excludedRules value that
names org.apache.kyuubi.plugin.spark.authz.ranger, which was the whole extension
when the check was written. Most rules live under
org.apache.kyuubi.plugin.spark.authz.rule now, so a rule added there is outside
the denylist. Match the extension's own package instead.

Of the four optimizer rules the extension injects, the three in …authz.rule only
strip markers after the check has run, so excluding one of them breaks the query
rather than lifting a check - this is future-proofing rather than a live bypass,
and it rejects configurations that are accepted today.
@alexandrefimov

Copy link
Copy Markdown
Contributor Author

The one red check, Flink Test (8, 1.20, normal), is FlinkOperationOnYarnSuite: get catalogs failing with Time out retrieving Flink engine service url. This PR only touches extensions/spark/kyuubi-spark-authz. It is not #7644 either — that one is fixed by bf10595ba, which this branch is based on — and master runs are green, so it looks like a one-off rather than something to file.

Could someone re-run that job? The (17, 3.11, 3.5, …mirror…) job was cancelled in the same run and needs the re-run too.

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.

[FEATURE][AUTHZ] AuthzConfigurationChecker should cover every authz rule the extension injects

1 participant