mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 06:28:11 +00:00
feat: added min check for secret sharing
This commit is contained in:
@@ -62,6 +62,11 @@ export const secretSharingServiceFactory = ({
|
|||||||
throw new BadRequestError({ message: "Expiration date cannot be more than 30 days" });
|
throw new BadRequestError({ message: "Expiration date cannot be more than 30 days" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fiveMins = 5 * 60 * 1000;
|
||||||
|
if (expiryTime - currentTime < fiveMins) {
|
||||||
|
throw new BadRequestError({ message: "Expiration time cannot be less than 5 mins" });
|
||||||
|
}
|
||||||
|
|
||||||
if (secretValue.length > 10_000) {
|
if (secretValue.length > 10_000) {
|
||||||
throw new BadRequestError({ message: "Shared secret value too long" });
|
throw new BadRequestError({ message: "Shared secret value too long" });
|
||||||
}
|
}
|
||||||
@@ -112,6 +117,11 @@ export const secretSharingServiceFactory = ({
|
|||||||
throw new BadRequestError({ message: "Expiration date cannot exceed more than 30 days" });
|
throw new BadRequestError({ message: "Expiration date cannot exceed more than 30 days" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fiveMins = 5 * 60 * 1000;
|
||||||
|
if (expiryTime - currentTime < fiveMins) {
|
||||||
|
throw new BadRequestError({ message: "Expiration time cannot be less than 5 mins" });
|
||||||
|
}
|
||||||
|
|
||||||
const encryptWithRoot = kmsService.encryptWithRootKey();
|
const encryptWithRoot = kmsService.encryptWithRootKey();
|
||||||
const encryptedSecret = encryptWithRoot(Buffer.from(secretValue));
|
const encryptedSecret = encryptWithRoot(Buffer.from(secretValue));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user