Skip to content

Support RFC 9964 ML-DSA JWT signing keys and user PAT rotation - #39890

Open
harshach wants to merge 2 commits into
mainfrom
agent/can-we-check-if-this-impacts
Open

harshach wants to merge 2 commits into
mainfrom
agent/can-we-check-if-this-impacts

Conversation

@harshach

@harshach harshach commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Issue: pending (per author request, opening as draft before filing a tracking issue).

Adds post-quantum RFC 9964 ML-DSA (ML-DSA-44, ML-DSA-65, ML-DSA-87) JWT signing-key support alongside existing RSA (RS256) for all OpenMetadata deployments, adds signing-key health diagnostics, raises default HTTP request header/input buffer sizes to 16KiB, and extends openmetadata-ops.sh regenerate-bot-tokens with --include-user-tokens to rotate active user Personal Access Tokens alongside bot tokens.

Type of change:

  • New feature

High-level design:

  • Algorithm-agnostic signing key layer (JwtSigningKey, MlDsaJwtAlgorithm):
    • JWTTokenGenerator auto-detects the configured PKCS#8 DER private key and X.509 SPKI DER public key using the Bouncy Castle 1.87 already on the classpath (zero new dependencies, Java 21 compatible).
    • RSA keys continue signing with RS256, verifying RS256/RS384/RS512 (preserving ADR:2026-11-12), and publishing standard kty: "RSA" JWKs (n, e, alg: "RS256").
    • ML-DSA keys sign and verify strictly with their matching RFC 9964 algorithm (ML-DSA-44, ML-DSA-65, or ML-DSA-87) and publish standard RFC 9964 kty: "AKP" JWKs (alg, pub, kid, use) on /api/v1/system/config/jwks.
    • LocalJwkProvider, JwtFilter, BotTokenRegenerator, InternalActionTokenSigner, OpenMetadataOperations.jwksListsKey(), and MCP OpenID discovery (OAuthHttpStatelessServerTransportProvider) all support both RSA and ML-DSA keys.
  • Backward compatibility (jwtTokenConfiguration & openmetadata-collate):
    • Added optional algorithm-neutral privateKeyFilePath / publicKeyFilePath fields to jwtTokenConfiguration.json (and regenerated jwtTokenConfiguration.ts and settings.ts) while keeping rsaprivateKeyFilePath / rsapublicKeyFilePath working for both RSA and ML-DSA DER files.
    • Preserved JWTTokenGenerator.getPublicKey() returning RSAPublicKey (adding getSigningPublicKey() returning PublicKey) and kept the deprecated init(TokenValidationAlgorithm, JWTTokenConfiguration) overload so downstream openmetadata-collate builds without breaking changes.
  • Signing-key health diagnostics:
    • Mirrors Fernet's ADR:2026-11-19: running the shipped default conf/private_key.der logs an error at startup and fails the new Signing Key step on /api/v1/system/status (never refusing startup). Own RSA keys < 3072 bits log a startup warning and report an informational pass.
  • HTTP buffer defaults:
    • Raised default SERVER_MAX_REQUEST_HEADER_SIZE and SERVER_INPUT_BUFFER_SIZE from 8KiB to 16KiB across conf/openmetadata.yaml, conf/openmetadata-h2-test.yaml, and local distributed-test server configs so ~5–6.8 KB ML-DSA bearer headers plus browser headers read cleanly without HTTP 431.
  • User Personal Access Token rotation (--include-user-tokens):
    • Added PersonalAccessTokenRegenerator + keyset-paginated TokenDAO.findPageByType + TokenRepository.replacePersonalAccessToken + --include-user-tokens (default false) on openmetadata-ops.sh regenerate-bot-tokens.
    • Preserves each PAT's tokenName, owner, and original expiry timestamp (skipping expired/deleted/bot entries and honoring --skip-current), while rotating the internal row UUID so CredentialVerifier's key-id fingerprint invalidates replaced PATs within maxStaleness.
  • Decision record & docs:
    • Added docs/decisions/2026-12-05-openmetadata-supports-ml-dsa-jwt-signing-keys.md and updated docs/jwt-signing-key-rotation.md.
  • Counterpart PR: https://github.com/open-metadata/openmetadata-collate/pull/9340 (raises Collate's conf/openmetadata.yaml header/input buffer defaults to 16KiB)

Tests:

Which test layer and why

  • Java unit tests (openmetadata-service, openmetadata-mcp): Exercise real Bouncy Castle ML-DSA-44/65/87 and RSA-2048/3072 keypairs, RFC 9964 JWKS serialization/parsing, JwtFilter local verification, InternalActionTokenSigner, signing-key health checks, BotTokenRegenerator, PersonalAccessTokenRegenerator, OpenMetadataOperations.jwksListsKey, and MCP OpenID discovery.
  • Java integration tests (openmetadata-integration-tests): Added --include-user-tokens cases to OpsRegenerateBotTokensIT to exercise real MySQL/Postgres TokenDAO.findPageByType, TokenRepository.replacePersonalAccessToken, ForkedOperations, and live CredentialVerifier maxStaleness convergence.

Use cases covered

  • Existing RS256 (RSA-2048 and RSA-3072) deployments continue signing, publishing kty: "RSA" JWKs, verifying tokens, and rotating bots/PATs without changes.
  • Deploying an ML-DSA-44, ML-DSA-65, or ML-DSA-87 DER key pair via either privateKeyFilePath/publicKeyFilePath or rsaprivateKeyFilePath/rsapublicKeyFilePath signs tokens with RFC 9964 alg, publishes kty: "AKP" JWKs, verifies through JwtFilter and InternalActionTokenSigner, and advertises ML-DSA-* in MCP OpenID discovery.
  • Tampered payloads, wrong keys, and mismatched algorithm headers (RS256/ML-DSA-87 against an ML-DSA-65 key) are rejected with SignatureVerificationException / AuthenticationException.
  • Running the shipped default key fails the /api/v1/system/status Signing Key step; own ML-DSA and RSA-3072+ keys pass cleanly.
  • openmetadata-ops.sh regenerate-bot-tokens --include-user-tokens rotates active user PATs across RSA→ML-DSA, RSA→RSA, and ML-DSA→RSA while preserving original expiry, skipping expired/deleted/bot entries, honoring --skip-current, and rotating row UUIDs so replaced PATs fail within maxStaleness.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated:
    • openmetadata-service/src/test/java/org/openmetadata/service/security/jwt/MlDsaJwtSigningTest.java (9/9 passed)
    • openmetadata-service/src/test/java/org/openmetadata/service/security/jwt/PersonalAccessTokenRegeneratorTest.java (6/6 passed)
    • openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/SystemRepositorySigningKeyStatusTest.java (2/2 passed)
    • openmetadata-service/src/test/java/org/openmetadata/service/security/jwt/BotTokenRegeneratorTest.java (11/11 passed)
    • openmetadata-service/src/test/java/org/openmetadata/service/util/OpenMetadataOperationsJwksTest.java (6/6 passed)
    • openmetadata-mcp/src/test/java/org/openmetadata/mcp/server/transport/OAuthHttpStatelessServerTransportProviderTest.java (62/62 passed)
  • Additional existing RS256 regression suites run locally (all passing):
    • JwtFilterTest (131/131), JWTTokenGeneratorTest (25/25), MultiUrlJwkProviderTest (9/9), MintedTokensAreRecognizedTest (5/5), InternalActionTokenSignerTest (3/3) — 269/269 unit tests passed.
  • Coverage %: JaCoCo report not yet run locally (pending before marking ready for review).

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for the new rotation CLI option and DAO/repository paths.
  • Files added/updated:
    • openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/OpsRegenerateBotTokensIT.java (compiled cleanly with mvn test-compile; live Docker execution pending before marking ready for review).

Focused Java unit tests passed locally (269/269 across 11 test classes in openmetadata-service and openmetadata-mcp), and openmetadata-integration-tests compiled cleanly. Live Docker execution of OpsRegenerateBotTokensIT (make java_affected_run) is pending before marking this PR ready.

Ingestion integration tests

  • Not applicable (no ingestion connector changes; make generate ARGS=--python-only check pending).

Playwright (UI) tests

  • Not applicable (no UI runtime changes; only regenerated TypeScript schema types jwtTokenConfiguration.ts and settings.ts).

Not applicable — backend security and CLI change only.

Manual testing performed

  1. Verified openssl genpkey -algorithm ML-DSA-65 key compatibility with Bouncy Castle 1.87 PKCS#8/SPKI DER loading via MlDsaJwtSigningTest.
  2. Verified scripts/harness/check_decision_records.py and .github/scripts/plan_local_java_tests.py --check-branch pass cleanly.
  3. Verified all pre-commit hooks (check json, Google Java Code Style, Decision records) pass on commit.

UI screen recording:

Not applicable — backend JWT signing key, health check, and ops CLI change with no UI feature changes.

Checklist:

  • I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.
  • My PR title is Fixes <issue-number>: <short explanation> (Draft PR — issue intentionally deferred per author request)
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above. (Draft PR — issue intentionally deferred per author request)
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: no DB migration needed (optional config-only fields on jwtTokenConfiguration.json).
  • For a UI feature or feature task: not applicable (backend-only change).
  • I have added tests (unit + integration) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md and fixed every 🔴 finding:
    • Initial pass reviewed 6d5d575f9e6dd33682b4a9b19484b2082cf2d1a2, fixed all 3 🔴 findings (rotated PAT row UUID for CredentialVerifier maxStaleness convergence, added OpsRegenerateBotTokensIT coverage, fixed tampered-payload test to assert SignatureVerificationException) and both 🟡 findings (sub-second expiry precision and rollback assertions) in c63585f0e35992cbcd6e45bb39755096d335c7c4.
    • Placement: server startup/reload (JWTTokenGenerator), REST/WS/MCP auth (JwtFilter, LocalJwkProvider), /v1/system/config/jwks, MCP OpenID discovery, /v1/system/status, InternalActionTokenSigner, and openmetadata-ops.sh regenerate-bot-tokens.
    • Trade-off: 16 KiB request header/input buffer defaults accommodate 5–6.8 KB ML-DSA bearer tokens with zero new dependencies or DB migrations; rotating the internal PAT row UUID preserves CredentialVerifier's 5s maxStaleness bound without dropping the covering index on user_tokens.
    • Recommendation: all 🔴 and 🟡 findings addressed in c63585f0e35992cbcd6e45bb39755096d335c7c4; run OpsRegenerateBotTokensIT and link issue before marking ready.
  • Decision check: added docs/decisions/2026-12-05-openmetadata-supports-ml-dsa-jwt-signing-keys.md.

@harshach
harshach marked this pull request as ready for review December 6, 2026 06:11
@harshach
harshach requested review from a team, akash-jain-10 and tutte as code owners December 6, 2026 06:11
@harshach
harshach requested review from TeddyCr and removed request for a team December 6, 2026 06:11
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

ML-DSA JWT verification and PAT rotation change authentication and credential validity; key/JWKS handling errors could reject valid requests or admit invalid tokens.

Adds RFC 9964 ML-DSA (ML-DSA-44/65/87) JWT signing-key support alongside RSA RS256, a signing-key health check, 16KiB HTTP header and input buffer defaults, and a --include-user-tokens option for rotating user PATs. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant