Skip to content

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

fix(agent-vault): address review on personal values

Scott Wilson1ed42324acd9
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.ts
index 20e6c509dd..193f384476 100644
--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts
+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts
@@ -2176,6 +2176,93 @@ describe("Agent Vault V1 Router", async () => {
}
});
+ test("an admin keeps their values through a revoke, and a demotion clears the ones they hold no grant for", async () => {
+ const granted = await createAccessBundle("mp-admin-granted");
+ const ungranted = await createAccessBundle("mp-admin-ungranted");
+ const credential = { type: "bearer", memberProvidedFields: ["credential-value"] };
+ const grantedService = await createService(granted.id, {
+ name: "linear",
+ hostPattern: "api.linear.app",
+ credential
+ });
+ const ungrantedService = await createService(ungranted.id, {
+ name: "notion",
+ hostPattern: "api.notion.com",
+ credential
+ });
+
+ const admin = await createMemberIdentity(`mp-admin-${Date.now()}`);
+ const valuesOf = async () =>
+ (await testDb("agent_vault_personal_values").where({ identityId: admin.id }).select("serviceId"))
+ .map((row: { serviceId: string }) => row.serviceId)
+ .sort();
+ try {
+ const promote = await inject("PATCH", "/api/v1/agent-vault/members", {
+ machineIdentityIds: [admin.id],
+ role: "admin"
+ });
+ expect(promote.statusCode).toBe(200);
+ expect((await inject("POST", membersUrl(granted.id), { machineIdentityIds: [admin.id] })).statusCode).toBe(200);
+ expect((await setValues(admin.as, granted.id, grantedService.id, { "credential-value": "a" })).statusCode).toBe(
+ 200
+ );
+ expect(
+ (await setValues(admin.as, ungranted.id, ungrantedService.id, { "credential-value": "b" })).statusCode
+ ).toBe(200);
+
+ // Still an admin, so the bundle is still theirs to use.
+ expect((await inject("DELETE", membersUrl(granted.id), { machineIdentityIds: [admin.id] })).statusCode).toBe(
+ 200
+ );
+ expect(await valuesOf()).toEqual([grantedService.id, ungrantedService.id].sort());
+
+ expect((await inject("POST", membersUrl(granted.id), { machineIdentityIds: [admin.id] })).statusCode).toBe(200);
+ const demote = await inject("PATCH", "/api/v1/agent-vault/members", {
+ machineIdentityIds: [admin.id],
+ role: "member"
+ });
+ expect(demote.statusCode).toBe(200);
+ expect(await valuesOf()).toEqual([grantedService.id]);
+ } finally {
+ await admin.cleanup();
+ }
+ });
+
+ test("a personal variable on a bundle the member lost drops out of Used By and can be deleted", async () => {
+ const bundle = await createAccessBundle("mp-lost-reach");
+ const service = await createService(bundle.id, {
+ name: "sentry",
+ hostPattern: "sentry.io",
+ credential: { type: "bearer", memberProvidedFields: ["credential-value"] }
+ });
+
+ const member = await createMemberIdentity(`mp-lost-reach-${Date.now()}`);
+ try {
+ expect((await inject("POST", membersUrl(bundle.id), { machineIdentityIds: [member.id] })).statusCode).toBe(200);
+ const created = await member.as("POST", variablesUrl, { scope: "personal", key: "SENTRY", value: "s" });
+ expect(created.statusCode).toBe(200);
+ const variableId = (JSON.parse(created.payload) as { variable: { id: string } }).variable.id;
+ expect(
+ (await setValues(member.as, bundle.id, service.id, { "credential-value": "{{SENTRY}}" })).statusCode
+ ).toBe(200);
+ expect((await member.as("DELETE", `${variablesUrl}/${variableId}`)).statusCode).toBe(409);
+
+ // Paths outside Agent Vault (a group removal, a lapsed role) drop the grant without clearing values, and the
+ // API has no way to stage that here.
+ await testDb("memberships").where({ scopeResourceId: bundle.id, actorIdentityId: member.id }).del();
+
+ const listed = await member.as("GET", personalVariablesUrl);
+ expect(listed.statusCode).toBe(200);
+ expect(JSON.parse(listed.payload).variables).toEqual([
+ expect.objectContaining({ id: variableId, usedByServices: [] })
+ ]);
+ expect((await member.as("DELETE", `${variablesUrl}/${variableId}`)).statusCode).toBe(200);
+ expect(await testDb("agent_vault_personal_values").where({ identityId: member.id })).toHaveLength(0);
+ } finally {
+ await member.cleanup();
+ }
+ });
+
test("an admin is asked for values only on the bundles granted to them", async () => {
const ungranted = await createAccessBundle("mp-mine-ungranted");
const service = await createService(ungranted.id, {
diff --git a/backend/src/db/migrations/20261013120000_agent-vault-personal-values.ts b/backend/src/db/migrations/20261013120000_agent-vault-personal-values.ts
index 9f8038e788..9b07c524c3 100644
--- a/backend/src/db/migrations/20261013120000_agent-vault-personal-values.ts
+++ b/backend/src/db/migrations/20261013120000_agent-vault-personal-values.ts
@@ -140,6 +140,7 @@ export async function down(knex: Knex): Promise<void> {
await knex.schema.dropTableIfExists(TableName.AgentVaultPersonalValueReference);
await dropOnUpdateTrigger(knex, TableName.AgentVaultPersonalValueReference);
+ await knex.raw(`DROP VIEW IF EXISTS analytics.??`, [TableName.AgentVaultPersonalValue]);
await knex.schema.dropTableIfExists(TableName.AgentVaultPersonalValue);
await dropOnUpdateTrigger(knex, TableName.AgentVaultPersonalValue);
diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-access-bundle-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-access-bundle-router.ts
index 43932efd76..99fe18e16c 100644
--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-access-bundle-router.ts
+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-access-bundle-router.ts
@@ -56,18 +56,6 @@ const AccessBundleSchema = AgentVaultAccessBundlesSchema.pick({
updatedAt: true
});
-// A passthrough switch is a replacement: mergeCredential returns a null secret and updateService nulls
-// the sealed column. The old check only looked at bearer and basic, so it reported no replacement for the
-// one case that destroys the credential outright.
-const isStoredSecretReplaced = (credential?: z.infer<typeof AgentVaultCredentialUpdateSchema>) => {
- if (!credential) return false;
- if (credential.type === AgentVaultCredentialType.Bearer) return credential.value !== undefined;
- if (credential.type === AgentVaultCredentialType.Basic) {
- return credential.username !== undefined || credential.password !== undefined;
- }
- return true;
-};
-
const variableKeysOf = (service: { variableReferences: { key: string }[] }) => [
...new Set(service.variableReferences.map((reference) => reference.key))
];
@@ -407,13 +395,14 @@ export const registerAgentVaultAccessBundleRouter = async (server: FastifyZodPro
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.OAUTH]),
handler: async (req) => {
- const { service, accessBundleName } = await server.services.agentVaultAccessBundle.updateService({
- projectId: req.internalAgentVaultProjectId,
- ctx: actorContext(req),
- accessBundleId: req.params.accessBundleId,
- serviceId: req.params.serviceId,
- ...req.body
- });
+ const { service, accessBundleName, credentialReplaced } =
+ await server.services.agentVaultAccessBundle.updateService({
+ projectId: req.internalAgentVaultProjectId,
+ ctx: actorContext(req),
+ accessBundleId: req.params.accessBundleId,
+ serviceId: req.params.serviceId,
+ ...req.body
+ });
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
@@ -454,7 +443,7 @@ export const registerAgentVaultAccessBundleRouter = async (server: FastifyZodPro
substitutionsReplaced: req.body.substitutions
?.filter((substitution) => substitution.value !== undefined)
.map((substitution) => substitution.placeholder),
- credentialReplaced: isStoredSecretReplaced(req.body.credential),
+ credentialReplaced,
variableKeys:
req.body.credential || req.body.customHeaders || req.body.substitutions
? variableKeysOf(service)
diff --git a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
index cb8793dd3a..3ea733a8ae 100644
--- a/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
+++ b/backend/src/ee/services/agent-vault-access-bundle/agent-vault-access-bundle-service.ts
@@ -323,6 +323,32 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
memberProvidedFields: TAgentVaultMemberProvidedField[] | null;
};
+ // Sending a value replaces the stored secret, and so does a write that drops a field the admin held: handing it to
+ // members, or changing the type over a secret that was stored.
+ const isStoredSecretReplaced = (
+ credential: TAgentVaultCredentialUpdate,
+ stored: TAgentVaultServices,
+ written: TCredentialWrite["secret"]
+ ) => {
+ if (written === undefined) return false;
+ if (credential.type !== stored.credentialType) return Boolean(stored.encryptedCredential) || written !== null;
+ if (credential.type === AgentVaultCredentialType.Passthrough) return false;
+
+ const previousMemberFields = (stored.memberProvidedFields ?? []) as TAgentVaultMemberProvidedField[];
+ const keyOfField: [TAgentVaultMemberProvidedField, string][] =
+ credential.type === AgentVaultCredentialType.Bearer
+ ? [[AgentVaultVariableReferenceField.CredentialValue, "value"]]
+ : [
+ [AgentVaultVariableReferenceField.CredentialUsername, "username"],
+ [AgentVaultVariableReferenceField.CredentialValue, "password"]
+ ];
+ return keyOfField.some(
+ ([field, key]) =>
+ (credential as Record<string, unknown>)[key] !== undefined ||
+ (!previousMemberFields.includes(field) && written?.[key] === undefined)
+ );
+ };
+
const BASIC_NEEDS_A_HALF_MESSAGE =
"A basic credential needs a username, a password, or both. Set one, or leave one to each member.";
@@ -1223,6 +1249,7 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
let credentialUpdate = {};
// Undefined leaves the sealed secret, and the references read off it, as they are.
let writtenSecret: TCredentialWrite["secret"];
+ let credentialReplaced = false;
let effectiveCredentialConfig = service.credentialConfig as TAgentVaultCredentialConfig;
if (credential) {
const { config, secret, memberProvidedFields } = mergeCredential(
@@ -1237,6 +1264,7 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
encryptedCredential = encryptor({ plainText: Buffer.from(JSON.stringify(secret)) }).cipherTextBlob;
}
writtenSecret = secret;
+ credentialReplaced = isStoredSecretReplaced(credential, service, secret);
credentialUpdate = {
credentialType: credential.type,
@@ -1513,7 +1541,8 @@ export const agentVaultAccessBundleServiceFactory = (deps: TAgentVaultAccessBund
result.updatedSubstitutions,
result.variableReferences
),
- accessBundleName: bundle.name
+ accessBundleName: bundle.name,
+ credentialReplaced
};
};
diff --git a/backend/src/ee/services/agent-vault-member/agent-vault-membership-service.ts b/backend/src/ee/services/agent-vault-member/agent-vault-membership-service.ts
index 42f23f7dfe..c1f1c8d431 100644
--- a/backend/src/ee/services/agent-vault-member/agent-vault-membership-service.ts
+++ b/backend/src/ee/services/agent-vault-member/agent-vault-membership-service.ts
@@ -578,6 +578,20 @@ export const agentVaultMembershipServiceFactory = ({
tx
);
+ // A demoted admin no longer reaches the bundles they hold no grant on, so what they saved there goes.
+ if (role !== ProjectMembershipRole.Admin) {
+ await clearPersonalValuesAfterRevoke(
+ { agentVaultPersonalValueDAL, userGroupMembershipDAL, identityGroupMembershipDAL },
+ {
+ projectId,
+ userIds: named(toChange, AgentVaultMemberType.User),
+ identityIds: named(toChange, AgentVaultMemberType.MachineIdentity),
+ groupIds: named(toChange, AgentVaultMemberType.Group)
+ },
+ tx
+ );
+ }
+
return {
updated: toChange.map((actor) => ({
type: actor.type,
diff --git a/backend/src/ee/services/agent-vault-personal-value/agent-vault-personal-value-dal.ts b/backend/src/ee/services/agent-vault-personal-value/agent-vault-personal-value-dal.ts
index a46921a7d2..a43abf50e7 100644
--- a/backend/src/ee/services/agent-vault-personal-value/agent-vault-personal-value-dal.ts
+++ b/backend/src/ee/services/agent-vault-personal-value/agent-vault-personal-value-dal.ts
@@ -2,6 +2,8 @@ import { Knex } from "knex";
import { TDbClient } from "@app/db";
import {
+ AccessScope,
+ ProjectMembershipRole,
RESOURCE_SCOPE,
ResourceType,
TableName,
@@ -139,7 +141,8 @@ export const agentVaultPersonalValueDALFactory = (db: TDbClient) => {
* Clears what these actors saved for the services of `accessBundleId` (or of every bundle in the project) where
* they no longer hold a grant, directly or through any group they are in, so being granted the bundle again
* starts from nothing. An admin reaches every bundle without a grant, so only the actors a revoke named are
- * considered: everyone else's values are left alone.
+ * considered, and one who is still a project admin, directly or through a group, keeps everything. Call it after
+ * the revoke, removal or demotion has been written in `tx`, so the admin check sees the new roles.
*/
const deleteForActorsWithoutGrant = async (
{
@@ -200,6 +203,38 @@ export const agentVaultPersonalValueDALFactory = (db: TDbClient) => {
if (identityIds.length) void actor.orWhereIn(`${table}.identityId`, identityIds);
})
.whereExists(services)
+ .whereNotExists((admin) => {
+ void admin
+ .from(TableName.Membership)
+ .join(TableName.MembershipRole, `${TableName.MembershipRole}.membershipId`, `${TableName.Membership}.id`)
+ .where(`${TableName.Membership}.scope`, AccessScope.Project)
+ .where(`${TableName.Membership}.scopeProjectId`, projectId)
+ .where(`${TableName.Membership}.isActive`, true)
+ .where(`${TableName.MembershipRole}.role`, ProjectMembershipRole.Admin)
+ .where((live) => {
+ void live
+ .where(`${TableName.MembershipRole}.isTemporary`, false)
+ .orWhere(`${TableName.MembershipRole}.temporaryAccessEndTime`, ">", tx.fn.now());
+ })
+ .where((holder) => {
+ void holder
+ .whereRaw(`??.?? = ??.??`, [TableName.Membership, "actorUserId", table, "userId"])
+ .orWhereRaw(`??.?? = ??.??`, [TableName.Membership, "actorIdentityId", table, "identityId"])
+ .orWhereIn(
+ `${TableName.Membership}.actorGroupId`,
+ tx(TableName.UserGroupMembership)
+ .whereRaw(`??.?? = ??.??`, [TableName.UserGroupMembership, "userId", table, "userId"])
+ .select("groupId")
+ )
+ .orWhereIn(
+ `${TableName.Membership}.actorGroupId`,
+ tx(TableName.IdentityGroupMembership)
+ .whereRaw(`??.?? = ??.??`, [TableName.IdentityGroupMembership, "identityId", table, "identityId"])
+ .select("groupId")
+ );
+ })
+ .select(tx.raw("1"));
+ })
.delete();
} catch (error) {
throw new DatabaseError({ error, name: "Delete agent vault personal values without a grant" });
diff --git a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts
index 34121612dd..1590f59001 100644
--- a/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts
+++ b/backend/src/ee/services/agent-vault-variable/agent-vault-variable-service.ts
@@ -9,14 +9,17 @@ import { PgSqlLock } from "@app/keystore/keystore";
import { DatabaseErrorCode } from "@app/lib/error-codes";
import { BadRequestError, ConflictError, NotFoundError } from "@app/lib/errors";
import { hasPostgresErrorCode } from "@app/lib/errors/postgres";
+import { TGenericPermission } from "@app/lib/types";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { KmsDataKey } from "@app/services/kms/kms-types";
+import { TMembershipDALFactory } from "@app/services/membership/membership-dal";
import { isUniqueViolation } from "../agent-vault/agent-vault-db-error-fns";
import { AgentVaultVariableScope } from "../agent-vault/agent-vault-enums";
import { ownerOf, TAgentVaultOwner } from "../agent-vault/agent-vault-owner-fns";
-import { getAgentVaultPermission } from "../agent-vault/agent-vault-permission";
+import { getAgentVaultPermission, getAgentVaultReachability } from "../agent-vault/agent-vault-permission";
import { AGENT_VAULT_MAX_PERSONAL_VARIABLES, AGENT_VAULT_MAX_VARIABLES } from "../agent-vault/agent-vault-variable-fns";
+import { TAgentVaultPersonalValueDALFactory } from "../agent-vault-personal-value/agent-vault-personal-value-dal";
import {
TAgentVaultServiceUsingVariable,
TAgentVaultVariable,
@@ -34,6 +37,8 @@ import {
type TAgentVaultVariableServiceFactoryDep = {
agentVaultVariableDAL: TAgentVaultVariableDALFactory;
+ agentVaultPersonalValueDAL: Pick<TAgentVaultPersonalValueDALFactory, "delete">;
+ membershipDAL: Pick<TMembershipDALFactory, "findResourceMembershipsForActor">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
};
@@ -49,6 +54,8 @@ const isOwnedBy = (variable: TAgentVaultVariable, owner: TAgentVaultOwner) =>
export const agentVaultVariableServiceFactory = ({
agentVaultVariableDAL,
+ agentVaultPersonalValueDAL,
+ membershipDAL,
permissionService,
kmsService
}: TAgentVaultVariableServiceFactoryDep) => {
@@ -108,6 +115,25 @@ export const agentVaultVariableServiceFactory = ({
return { variable, scope: { projectId, owner: null } };
};
+ // A member who lost a bundle keeps their personal variables, but not a view into the bundle: its services drop out
+ // of what they see. Shared variables are admin-only, and an admin reaches every bundle.
+ const splitByReach = async (
+ { projectId, ctx, owner }: { projectId: string; ctx: TGenericPermission; owner: TAgentVaultOwner | null },
+ services: TAgentVaultServiceUsingVariable[]
+ ) => {
+ if (!owner || !services.length) return { reachable: services, unreachable: [] };
+ const { accessBundleIds } = await getAgentVaultReachability(
+ { permissionService, membershipDAL },
+ { projectId, ctx }
+ );
+ if (!accessBundleIds) return { reachable: services, unreachable: [] };
+ const reach = new Set(accessBundleIds);
+ return {
+ reachable: services.filter((service) => reach.has(service.accessBundleId)),
+ unreachable: services.filter((service) => !reach.has(service.accessBundleId))
+ };
+ };
+
// Values never leave through this projection; only the audited value endpoint returns one.
const projectVariable = (variable: TAgentVaultVariable, services: TAgentVaultServiceUsingVariable[]) => ({
id: variable.id,
@@ -162,9 +188,12 @@ export const agentVaultVariableServiceFactory = ({
...query,
limit: limit ?? query.keys?.length ?? AGENT_VAULT_VARIABLE_LIST_DEFAULT_LIMIT
});
- const services = await agentVaultVariableDAL.findServicesUsing(variables.map((variable) => variable.id));
+ const { reachable } = await splitByReach(
+ { projectId, ctx, owner: scope.owner },
+ await agentVaultVariableDAL.findServicesUsing(variables.map((variable) => variable.id))
+ );
- return { variables: variables.map((variable) => projectVariable(variable, services)), totalCount };
+ return { variables: variables.map((variable) => projectVariable(variable, reachable)), totalCount };
};
const createVariable = async ({ key, value, scope: scopeName, ...rest }: TCreateVariableDTO) => {
@@ -254,11 +283,16 @@ export const agentVaultVariableServiceFactory = ({
throw err;
}
- return { variable: projectVariable(result.updated, result.services), previousKey: result.previous.key };
+ const { reachable } = await splitByReach({ ...rest, owner: scope.owner }, result.services);
+ return { variable: projectVariable(result.updated, reachable), previousKey: result.previous.key };
};
const deleteVariable = async ({ variableId, ...rest }: TVariableByIdDTO) => {
const { scope } = await findAccessibleVariable({ variableId, ...rest });
+ const { accessBundleIds } = scope.owner
+ ? await getAgentVaultReachability({ permissionService, membershipDAL }, rest)
+ : { accessBundleIds: null };
+ const reach = accessBundleIds ? new Set(accessBundleIds) : null;
// The refusal here is the real check. The row lock waits for any save adding a reference to this variable, since
// those take it FOR SHARE. The deferred foreign keys only back it up, and only raise at commit.
@@ -271,7 +305,17 @@ export const agentVaultVariableServiceFactory = ({
if (!variable) throw notFound(variableId);
const services = await agentVaultVariableDAL.findServicesUsing([variable.id], tx);
- if (services.length) throw new ConflictError({ message: inUseMessage(variable.key, services, scope) });
+ const blocking = reach ? services.filter((service) => reach.has(service.accessBundleId)) : services;
+ if (blocking.length) throw new ConflictError({ message: inUseMessage(variable.key, blocking, scope) });
+
+ // What the owner saved on a bundle they no longer reach can't be edited or used, so it doesn't hold the
+ // variable in place.
+ if (scope.owner && services.length) {
+ await agentVaultPersonalValueDAL.delete(
+ { ...scope.owner, $in: { serviceId: services.map((service) => service.serviceId) } },
+ tx
+ );
+ }
await agentVaultVariableDAL.deleteById(variable.id, tx);
return variable;
diff --git a/backend/src/ee/services/agent-vault/CLAUDE.md b/backend/src/ee/services/agent-vault/CLAUDE.md
index c646d59827..752fcbb6c2 100644
--- a/backend/src/ee/services/agent-vault/CLAUDE.md
+++ b/backend/src/ee/services/agent-vault/CLAUDE.md
@@ -270,10 +270,15 @@ variables**, rows of `agent_vault_variables` with an owner, that only their own
service row: a credential type change deletes every member's values for the service, and taking a field back
from members deletes that field's. Adding a member-provided field keeps what members saved, and they add only
the new one.
-- **Losing a bundle clears what an actor saved for its services** (`clearPersonalValuesAfterRevoke`), so a later grant
- starts from nothing. It runs on a bundle revoke and on removal from Agent Vault, for the actors the revoke named
- and the members of a named group, and skips anyone who still holds the bundle through another grant. Admins
- reach every bundle without a grant, so the cleanup never sweeps actors the revoke didn't name. Personal variables survive all of this.
+- **Losing a bundle through Agent Vault clears what an actor saved for its services** (`clearPersonalValuesAfterRevoke`).
+ It runs on a bundle revoke, on removal from Agent Vault, and on a demotion from admin, for the actors named and the
+ members of a named group, after that change is written. It skips anyone who still holds the bundle through another
+ grant, and anyone who is still a project admin, since an admin reaches every bundle. Platform paths (group
+ removal, a lapsed role, project, org or SCIM removal) don't run it, so values can outlive the grant there and
+ return with a later one. They are only ever the same actor's, and resolve still checks reach. Deleting a personal
+ variable also clears the owner's values on bundles they no longer reach, which otherwise would hold the variable
+ in place with nothing able to edit them. Personal variables survive all of this, and their Used By lists only
+ the bundles the owner still reaches.
- Personal variables follow the shared variables' reference rules: sealed text names them by id, a reference row
per personal value (`agent_vault_personal_value_references`, a deferred foreign key), the delete takes the variable
row `FOR UPDATE` and a personal values save takes the rows it references `FOR SHARE`. Used By on a variable reads
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 1f3b896fd2..cf759730dd 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -2010,6 +2010,8 @@ export const registerRoutes = async (
const agentVaultVariableService = agentVaultVariableServiceFactory({
agentVaultVariableDAL,
+ agentVaultPersonalValueDAL,
+ membershipDAL,
permissionService,
kmsService
});
diff --git a/docs/documentation/platform/agent-vault/access-bundles.mdx b/docs/documentation/platform/agent-vault/access-bundles.mdx
index 316be9ef6b..ac246a16b4 100644
--- a/docs/documentation/platform/agent-vault/access-bundles.mdx
+++ b/docs/documentation/platform/agent-vault/access-bundles.mdx
@@ -86,4 +86,4 @@ Only you can read your personal values, so admins can't see them either.
- To change your personal values, open the service's actions menu, select **Update My Personal Values**, and enter the values you want to change (a field you leave blank keeps its saved value)
- To delete your personal values, select **Remove** in the same dialog, then select **Remove Personal Values**
-If you lose access to the access bundle, Infisical deletes the personal values you set up for its services.
+If an admin removes you from the access bundle or from Agent Vault, Infisical deletes the personal values you set up for its services.