Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge pull request #7828 from Infisical/fix/gc-patch-2

Akhil Mohanfdfa5dde61c0
diff --cc backend/src/keystore/keystore.ts
index c4d2828cc8,69e0bef4b6..e7dd95077d
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@@ -274,9 -257,9 +274,10 @@@ type TWaitTillReady =
export type TKeyStoreFactory = {
setItem: (key: string, value: string | number | Buffer, prefix?: string) => Promise<"OK">;
getItem: (key: string, prefix?: string) => Promise<string | null>;
+ getItemBuffer: (key: string, prefix?: string) => Promise<Buffer | null>;
getItemPrimary: (key: string, prefix?: string) => Promise<string | null>;
getItems: (keys: string[], prefix?: string) => Promise<(string | null)[]>;
+ getItemsPrimary: (keys: string[], prefix?: string) => Promise<(string | null)[]>;
setExpiry: (key: string, expiryInSeconds: number) => Promise<number>;
ttl: (key: string) => Promise<number>;
setItemWithExpiry: (
@@@ -391,11 -372,13 +392,16 @@@ export const keyStoreFactory =
const getItem = async (key: string, prefix?: string) =>
pickPrimaryOrSecondaryRedis(primaryRedis, redisReadReplicas).get(prefix ? `${prefix}:${key}` : key);
+ // Reads a value written as raw bytes. Callers holding binary blobs (ciphertext) use this instead of
+ // getItem so the payload never round-trips through a base64 string on either side.
+ const getItemBuffer = async (key: string, prefix?: string) =>
+ pickPrimaryOrSecondaryRedis(primaryRedis, redisReadReplicas).getBuffer(prefix ? `${prefix}:${key}` : key);
+
const getItemPrimary = async (key: string, prefix?: string) => primaryRedis.get(prefix ? `${prefix}:${key}` : key);
+ const getItemsPrimary = async (keys: string[], prefix?: string) =>
+ primaryRedis.mget(keys.map((key) => (prefix ? `${prefix}:${key}` : key)));
+
const getItems = async (keys: string[], prefix?: string) =>
pickPrimaryOrSecondaryRedis(primaryRedis, redisReadReplicas).mget(
keys.map((key) => (prefix ? `${prefix}:${key}` : key))