Skip to content

fix(query): add JWT verification time tolerance#19909

Open
chagelo wants to merge 1 commit into
databendlabs:mainfrom
chagelo:fix-jwt-time-tolerance
Open

fix(query): add JWT verification time tolerance#19909
chagelo wants to merge 1 commit into
databendlabs:mainfrom
chagelo:fix-jwt-time-tolerance

Conversation

@chagelo

@chagelo chagelo commented May 22, 2026

Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Add explicit 5-second JWT verification time tolerance for both key-pair auth and JWKS auth.

  • fixes: Add time_tolerance to JWT verification for key-pair and JWKS auth #19795
  • Apply the same verification options across RSA/ECDSA/Ed25519 key-pair verification and JWKS verification.
  • Pin Databend to a small, explicit 5-second clock-skew window instead of inheriting jwt-simple's much wider default tolerance.
  • Add regression coverage for tolerated small iat clock skew and rejected larger future iat values.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why
cargo test -p databend-common-users --test it jwt_time_tolerance
cargo test -p databend-common-users --test it jwt
cargo clippy -p databend-common-users --test it -- -D warnings

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add time_tolerance to JWT verification for key-pair and JWKS auth

1 participant