Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
chore(agent-vault): say what each primary read guarantees, not who needs it
Scott Wilsonc3655f4a52dd
diff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-dal.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-dal.tsindex 9ecd120f9e..74a7b99173 100644--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-dal.ts+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-dal.ts@@ -20,9 +20,7 @@ export const agentVaultServiceDALFactory = (db: TDbClient) => {}};- // Reads the primary even without a tx. An update merges its credential against this row before the lock and- // compares it with the row under the lock, so a replica still behind the last save would turn the next one- // into a conflict with nobody else editing.+ // Reads the primary even without a tx, so the row is never older than the last committed save.const findByIdInAccessBundle = async ({ id, accessBundleId }: { id: string; accessBundleId: string },tx?: Knexdiff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-variable-reference-dal.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-variable-reference-dal.tsindex 02d12920e6..6776c973b0 100644--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-variable-reference-dal.ts+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-service-variable-reference-dal.ts@@ -35,8 +35,7 @@ export const agentVaultServiceVariableReferenceDALFactory = (db: TDbClient) => {}};- // Reads the primary even without a tx, like the variable list it counts usage for, so a service saved a- // moment ago shows as using its variables.+ // Reads the primary even without a tx, so a service saved a moment ago shows as using its variables.const findByVariableIds = async (variableIds: string[],tx?: Knexdiff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-variable-dal.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-variable-dal.tsindex 010d09cb30..d30517a3b3 100644--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-variable-dal.ts+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-variable-dal.ts@@ -12,8 +12,7 @@ export type TAgentVaultVariableValueRow = Pick<TAgentVaultVariables, "id" | "accexport const agentVaultVariableDALFactory = (db: TDbClient) => {const orm = ormify(db, TableName.AgentVaultVariable);- // Reads the primary even without a tx. The service sheet refetches this list the moment it creates a- // variable, and a replica that has not caught up would drop the new key and fail the reference to it.+ // Reads the primary even without a tx, so a variable created a moment ago is always listed.const findByAccessBundleId = async (accessBundleId: string, tx?: Knex): Promise<TAgentVaultVariables[]> => {try {return (await (tx || db)(TableName.AgentVaultVariable)@@ -25,8 +24,7 @@ export const agentVaultVariableDALFactory = (db: TDbClient) => {}};- // Reads the primary even without a tx. A service write maps keys to ids before it seals, outside its- // transaction, and a variable created a moment earlier may not have reached a replica yet.+ // Reads the primary even without a tx, so a key created a moment ago is always found.const findKeysByAccessBundleId = async (accessBundleId: string,tx?: Knexdiff --git a/backend/src/ee/services/agent-vault/CLAUDE.md b/backend/src/ee/services/agent-vault/CLAUDE.mdindex be656b772e..abc9a6ef29 100644--- a/backend/src/ee/services/agent-vault/CLAUDE.md+++ b/backend/src/ee/services/agent-vault/CLAUDE.md@@ -169,6 +169,9 @@ path decides what a service can reach, so it stays literal.- **Sealed text names a variable by id, `{{<uuid>}}`, never by key.** The key form exists only at the APIboundary: a service write maps keys to ids before it seals (`toStoredVariableReferences`), reading theprimary, since a variable created a moment earlier may not be on a replica yet. So a rename is one row.+- The variable list and its Used By rows read the primary too. The service sheet refetches the list the moment+ it creates a variable, and a replica that has not caught up would drop the new key and fail the reference+ to it.- `agent_vault_service_variable_references` holds a row per field per variable. It drives Used By, the deleterefusal, and the keys the service sheet lists under a stored value. **Resolve does not read it**: it pullsthe ids out of the decrypted fields, so a service saved mid-poll can never leave the two describing