mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 07:26:11 +00:00
Types
This commit is contained in:
@@ -269,7 +269,14 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
const { secsGroupedByBlindIndex: conflictGroupByBlindIndex } =
|
const { secsGroupedByBlindIndex: conflictGroupByBlindIndex } =
|
||||||
await secretService.fnSecretBlindIndexCheckV2({
|
await secretService.fnSecretBlindIndexCheckV2({
|
||||||
folderId,
|
folderId,
|
||||||
inputSecrets: secretCreationCommits.map(({ secretBlindIndex }) => ({ secretBlindIndex }))
|
inputSecrets: secretCreationCommits.map(({ secretBlindIndex }) => {
|
||||||
|
if (!secretBlindIndex) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Missing secret blind index"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { secretBlindIndex };
|
||||||
|
})
|
||||||
});
|
});
|
||||||
secretCreationCommits
|
secretCreationCommits
|
||||||
.filter(({ secretBlindIndex }) => conflictGroupByBlindIndex[secretBlindIndex || ""])
|
.filter(({ secretBlindIndex }) => conflictGroupByBlindIndex[secretBlindIndex || ""])
|
||||||
@@ -291,7 +298,14 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
({ secretBlindIndex, secret }) =>
|
({ secretBlindIndex, secret }) =>
|
||||||
secret && secret.secretBlindIndex !== secretBlindIndex
|
secret && secret.secretBlindIndex !== secretBlindIndex
|
||||||
)
|
)
|
||||||
.map(({ secretBlindIndex }) => ({ secretBlindIndex }))
|
.map(({ secretBlindIndex }) => {
|
||||||
|
if (!secretBlindIndex) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Missing secret blind index"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { secretBlindIndex };
|
||||||
|
})
|
||||||
});
|
});
|
||||||
secretUpdationCommits
|
secretUpdationCommits
|
||||||
.filter(
|
.filter(
|
||||||
@@ -381,10 +395,14 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
folderId,
|
folderId,
|
||||||
tx,
|
tx,
|
||||||
actorId: "",
|
actorId: "",
|
||||||
inputSecrets: secretDeletionCommits.map(({ secretBlindIndex }) => ({
|
inputSecrets: secretDeletionCommits.map(({ secretBlindIndex }) => {
|
||||||
secretBlindIndex,
|
if (!secretBlindIndex) {
|
||||||
type: SecretType.Shared
|
throw new BadRequestError({
|
||||||
}))
|
message: "Missing secret blind index"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { secretBlindIndex, type: SecretType.Shared };
|
||||||
|
})
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
const updatedSecretApproval = await secretApprovalRequestDAL.updateById(
|
const updatedSecretApproval = await secretApprovalRequestDAL.updateById(
|
||||||
@@ -638,7 +656,13 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
),
|
),
|
||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
const commitsGroupByBlindIndex = groupBy(approvalCommits, (i) => i.secretBlindIndex);
|
|
||||||
|
const commitsGroupByBlindIndex = groupBy(approvalCommits, (i) => {
|
||||||
|
if (!i.secretBlindIndex) {
|
||||||
|
throw new BadRequestError({ message: "Missing secret blind index" });
|
||||||
|
}
|
||||||
|
return i.secretBlindIndex;
|
||||||
|
});
|
||||||
if (tagIds.length) {
|
if (tagIds.length) {
|
||||||
await secretApprovalRequestSecretDAL.insertApprovalSecretTags(
|
await secretApprovalRequestSecretDAL.insertApprovalSecretTags(
|
||||||
Object.keys(commitTagIds).flatMap((blindIndex) =>
|
Object.keys(commitTagIds).flatMap((blindIndex) =>
|
||||||
|
|||||||
@@ -86,7 +86,13 @@ export const registerMfaRouter = async (server: FastifyZodProvider) => {
|
|||||||
secure: appCfg.HTTPS_ENABLED
|
secure: appCfg.HTTPS_ENABLED
|
||||||
});
|
});
|
||||||
|
|
||||||
return { token: token.access, ...user };
|
return {
|
||||||
|
...user,
|
||||||
|
token: token.access,
|
||||||
|
protectedKey: user.protectedKey || null,
|
||||||
|
protectedKeyIV: user.protectedKeyIV || null,
|
||||||
|
protectedKeyTag: user.protectedKeyTag || null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
|
|||||||
encryptedPrivateKey: data.user.encryptedPrivateKey,
|
encryptedPrivateKey: data.user.encryptedPrivateKey,
|
||||||
iv: data.user.iv,
|
iv: data.user.iv,
|
||||||
tag: data.user.tag,
|
tag: data.user.tag,
|
||||||
protectedKey: data.user.protectedKey,
|
protectedKey: data.user.protectedKey || null,
|
||||||
protectedKeyIV: data.user.protectedKeyIV,
|
protectedKeyIV: data.user.protectedKeyIV || null,
|
||||||
protectedKeyTag: data.user.protectedKeyTag
|
protectedKeyTag: data.user.protectedKeyTag || null
|
||||||
} as const;
|
} as const;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user