fix(adapters): prevent Oracle/ClickHouse credential cache reuse - #118
Merged
Conversation
Oracle Easy Connect and ClickHouse HTTP URLs omit username/password (and ClickHouse database). Pool/client caches keyed only on those URLs reused an authenticated handle for wrong passwords or other databases — an auth bypass and silent cross-database query risk on shared hosts. Also dedupe concurrent BoundedPoolCache getOrCreate so parallel first acquires cannot leak undisposed pools. Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
huyplb
marked this pull request as ready for review
July 28, 2026 05:30
Contributor
Author
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_df7b8190-8dc0-4326-a7bb-c67e676787d5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
Oracle and ClickHouse connection strings omit username/password (and ClickHouse database). Cached pools/clients keyed only on those URLs reused an already-authenticated handle for a later request with a different password, user, or database.
Impact: On a shared API process this is an auth bypass (wrong password still gets the prior pool) and can run schema/query work against the wrong ClickHouse database.
Root cause
host:port/service; username/password are separatecreatePooloptions. The pool key included username but not a password fingerprint.http(s)://host:port; username/password/database are separatecreateClientoptions, but the client map keyed solely on the URL.Fix
credentialedCacheKey/nonSecretFingerprintand use them for Oracle pool keys and ClickHouse client keys.BoundedPoolCache.getOrCreateso parallel first acquires cannot leak undisposed pools.Validation
npx vitest run packages/core/src/cores/pool-cache.test.ts(7 tests, including credential partitioning + concurrent dedupe)Note
High Risk
Touches connection pooling and authentication caching in a shared process; incorrect keys could still leak sessions, but the change closes a concrete auth-bypass and wrong-database reuse bug.
Overview
Fixes credential cache reuse on Oracle and ClickHouse when the URL/connect string does not carry username, password, or database. A later request with different credentials could reuse an already-authenticated pool or HTTP client (wrong-password acceptance and wrong ClickHouse database).
Adds
credentialedCacheKeyandnonSecretFingerprint(djb2 hex, no plaintext passwords in keys) and switches Oracle pool keys and ClickHouse client map keys to include user, database, and password fingerprint.BoundedPoolCache.getOrCreatenow dedupes concurrent creates for the same key via apendingmap so parallel first acquires do not spawn extra pools.Tests cover key partitioning and concurrent dedupe; the helpers are re-exported from
@foxschema/core.Reviewed by Cursor Bugbot for commit 4d261f7. Bugbot is set up for automated code reviews on this repo. Configure here.