Skip to content

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

requested changes

Daniel Hougaard1321d3149401
diff --git a/backend/src/server/routes/v1/secret-sharing-router.ts b/backend/src/server/routes/v1/secret-sharing-router.ts
index 1225203732..6bbcabf19c 100644
--- a/backend/src/server/routes/v1/secret-sharing-router.ts
+++ b/backend/src/server/routes/v1/secret-sharing-router.ts
@@ -505,7 +505,7 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
orgId = await req.server.services.secretSharing.getSharedSecretOrgId(req.query.sharedSecretId);
if (!orgId) {
- throw new NotFoundError({ message: "Shared secret not found or has no organization" });
+ throw new NotFoundError({ message: "Shared secret not found" });
}
} else if (req.permission?.orgId) {
orgId = req.permission.orgId;
diff --git a/backend/src/services/secret-sharing/secret-sharing-dal.ts b/backend/src/services/secret-sharing/secret-sharing-dal.ts
index 61a2ce767f..8f6cb80235 100644
--- a/backend/src/services/secret-sharing/secret-sharing-dal.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-dal.ts
@@ -67,10 +67,13 @@ export const secretSharingDALFactory = (db: TDbClient) => {
.replicaNode()(TableName.SecretSharing)
.where(`${TableName.SecretSharing}.orgId`, orgId)
.where((qb) => {
- if ("userId" in actorFilters) {
+ if ("userId" in actorFilters && "identityId" in actorFilters) {
+ void qb
+ .where(`${TableName.SecretSharing}.userId`, actorFilters.userId)
+ .orWhere(`${TableName.SecretSharing}.identityId`, actorFilters.identityId);
+ } else if ("userId" in actorFilters) {
void qb.where(`${TableName.SecretSharing}.userId`, actorFilters.userId);
- }
- if ("identityId" in actorFilters) {
+ } else if ("identityId" in actorFilters) {
void qb.where(`${TableName.SecretSharing}.identityId`, actorFilters.identityId);
}
})
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts
index f39714117c..448228b6a2 100644
--- a/backend/src/services/secret-sharing/secret-sharing-service.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts
@@ -717,8 +717,7 @@ export const secretSharingServiceFactory = ({
message: "User does not have permission to delete shared secret"
});
}
- }
- if (actor === ActorType.IDENTITY) {
+ } else if (actor === ActorType.IDENTITY) {
if (sharedSecret.identityId !== actorId) {
throw new ForbiddenRequestError({
message: "Identity does not have permission to delete shared secret"
diff --git a/frontend/src/hooks/api/secretSharing/types.ts b/frontend/src/hooks/api/secretSharing/types.ts
index 40b2e8abea..54b1175bab 100644
--- a/frontend/src/hooks/api/secretSharing/types.ts
+++ b/frontend/src/hooks/api/secretSharing/types.ts
@@ -32,7 +32,7 @@ export type TCreateSharedSecretRequest = {
expiresIn: string;
maxViews?: number;
accessType?: SecretSharingAccessType;
- emails?: string[];
+ authorizedEmails?: string[];
};
export type TCreateSecretRequestRequestDTO = {
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index b4af440528..22a5138cbe 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -141,7 +141,7 @@ export const ShareSecretForm = ({
expiresIn,
maxViews: shouldLimitView ? Number(viewLimit) : undefined,
accessType,
- emails: processedEmails
+ authorizedEmails: processedEmails
});
if (processedEmails && processedEmails.length > 0) {