authorgravatar for saiansh2525@gmail.comYash Singh <saiansh2525@gmail.com> 2026-09-25 15:17:22-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-25 15:17:22-05:00
logf5bd2fddbf00021b29c1dbe32210240886806718
tree5461162f3102c53fe27868d87ec755bf06e6fac2
parent1a0c915c41024ddb47e16befd9fc730c1173af02
signature Signed by PGP key B5690EEEBB952194

fix(server): load Cursor keyring with createRequire (#13678)


1 files changed, 5 insertions(+), 1 deletions(-)

apps/server/src/provider/cursorCredentialStore.ts+5-1
...@@ -1,5 +1,9 @@...@@ -1,5 +1,9 @@
1import * as NodeModule from "node:module";
2
1const CACHE_MS = 5 * 60_000;3const CACHE_MS = 5 * 60_000;
24
5const requireForKeyring = NodeModule.createRequire(import.meta.url);
6
3/** Share one Keychain request across usage history and limits in this server process. */7/** Share one Keychain request across usage history and limits in this server process. */
4export function makeCachedCursorAccessTokenReader(8export function makeCachedCursorAccessTokenReader(
5 read: () => Promise<string | null>,9 read: () => Promise<string | null>,
...@@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader(...@@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader(
2428
25/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */29/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */
26export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => {30export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => {
27 const { AsyncEntry } = await import("@napi-rs/keyring");31 const { AsyncEntry } = requireForKeyring("@napi-rs/keyring") as typeof import("@napi-rs/keyring");
28 return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null;32 return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null;
29});33});