[KYUUBI #7745] Add internal security token compatibility mode by aajisaka · Pull Request #7762 · apache/kyuubi · GitHub
Skip to content

[KYUUBI #7745] Add internal security token compatibility mode - #7762

Open
aajisaka wants to merge 3 commits into
apache:masterfrom
aajisaka:legacy-iv-compatibility
Open

aajisaka wants to merge 3 commits into
apache:masterfrom
aajisaka:legacy-iv-compatibility

Conversation

@aajisaka

Copy link
Copy Markdown
Member

Why are the changes needed?

To fix #7745

Add kyuubi.internal.security.crypto.compatibilityMode to support rolling upgrades from Kyuubi 1.11.1 or earlier.

  • STRICT (default, same as 1.12.0 behavior) issues and accepts only random-IV-prefixed tokens
  • READ_COMPATIBLE accepts both formats while issuing current tokens
  • MIGRATE issues legacy zero-IV tokens while accepting both.

Document the phased MIGRATE to READ_COMPATIBLE to STRICT rollout and cover legacy token generation, secret normalization, and random-IV behavior in tests.

How was this patch tested?

Added unit tests.

Was this patch assisted by generative AI tooling?

Assisted-by: OpenCode (MiMo-V2.6-Pro)

Add kyuubi.internal.security.crypto.compatibilityMode to support
rolling upgrades from Kyuubi 1.11.1 or earlier. STRICT issues and
accepts only random-IV-prefixed tokens, READ_COMPATIBLE accepts
both formats while issuing current tokens, and MIGRATE issues
legacy zero-IV tokens while accepting both.

Document the phased MIGRATE to READ_COMPATIBLE to STRICT rollout
and cover legacy token generation, secret normalization, and
random-IV behavior in tests.
@github-actions github-actions Bot added kind:documentation Documentation is a feature! module:common labels Sep 23, 2026

@wangzhigang1999 wangzhigang1999 left a comment

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.

Thanks @aajisaka, LGTM. I tested a57caf2f8 on a Kubernetes test cluster with Spark in local mode, using the PR server to launch the unmodified 1.11.1 engine JAR.

Keeping the same engine running and restarting only the server, I confirmed:

  • STRICT: authentication failed.
  • MIGRATE: SQL succeeded.
  • READ_COMPATIBLE: authentication failed.
  • Switching back to MIGRATE: SQL succeeded again.

I also checked the loaded classes to confirm the engine used the 1.11.1 InternalSecurityAccessor. The engine registered under the namespace supplied by the new server without any ZooKeeper changes. This confirms that legacy token issuance is needed for the scenario in #7745; decrypt-time fallback alone is insufficient.

During validation, I noticed an existing REST issue: invalid internal tokens return HTTP 500 because authToken throws KyuubiSQLException, while AuthenticationFilter catches only AuthenticationException. I reproduced this on 1.11.1 too, so I think we should handle it in a separate follow-up rather than block this PR.

Comment thread docs/deployment/migration-guide.md Outdated
Comment thread docs/deployment/migration-guide.md Outdated
@pan3793

pan3793 commented Sep 29, 2026

Copy link
Copy Markdown
Member

Comment thread docs/security/internal_secure_access.md Outdated
@aajisaka

aajisaka commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

…lity mode

Move the compatibility mode under the legacy namespace as
kyuubi.internal.security.legacy.crypto.compatMode, since the mode is
temporary and will be removed. Use 1.11.x rather than 1.11.1 in the
rolling upgrade wording, as 1.12.0 already issues random-IV tokens
and thus behaves like STRICT, and state that replacing engines is
only needed when an engine resource such as
kyuubi.session.engine.spark.main.resource is set explicitly,
since otherwise a replacement server picks up the engine jars shipped
in its KYUUBI_HOME.

This branch has not been deployed

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

Labels

kind:documentation Documentation is a feature! module:common

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants