Skip to content

Share concurrent API-key verification on cache expiry (0.1.25.62) - #303

Merged
amavashev merged 2 commits into
mainfrom
fix/coalesce-api-key-verification
Nov 28, 2026
Merged

amavashev merged 2 commits into
mainfrom
fix/coalesce-api-key-verification

Conversation

@amavashev

@amavashev amavashev commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Concurrent requests with the same credential now share one BCrypt calculation when the verification cache entry expires. The cache identity includes the submitted secret and the current stored hash. Key status, expiry, permissions and tenant state are checked on each request. Bumps the server version to 0.1.25.62.

Verification

  • The concurrency test runs eight requests against the same expired entry. It observed nine total BCrypt calls before the fix and two after it, including the call that primed the cache.
  • All 1,414 unit, contract and integration tests passed. JaCoCo line/branch coverage was 97.18%/95.09% for data and 97.62%/95.86% for API.
  • Ran the .61 release and .62 packaged JAR on fresh stacks with identical runtime, Redis and generator quotas. Both ran 10 quiet and 200 background reserve-commit cycles/s for 100 seconds per workload.
Background tenants Quiet p99, .61 Quiet p99, .62 Missed background starts, .61 → .62
1 228.04 ms 24.98 ms 544 → 0
16 195.12 ms 22.32 ms 574 → 5

Every quiet cycle completed in all four windows. Neither version recorded a request error or timeout. The benchmark history includes median latency, fixture details, and the single-window limitation.

Use Caffeine's per-key atomic load so a burst after expiry shares a single
BCrypt check. Continue reading the key and tenant from Redis per request.
Exercise eight concurrent validators after expiry using a controlled clock.
@amavashev
amavashev marked this pull request as ready for review November 28, 2026 13:47
@amavashev
amavashev merged commit 279b4b9 into main Nov 28, 2026
8 checks passed
@amavashev
amavashev deleted the fix/coalesce-api-key-verification branch November 28, 2026 19:11
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