mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 11:27:32 +00:00
greptile review fixes
This commit is contained in:
@@ -282,8 +282,12 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
sshProductEnabled: z.boolean().optional(),
|
sshProductEnabled: z.boolean().optional(),
|
||||||
scannerProductEnabled: z.boolean().optional(),
|
scannerProductEnabled: z.boolean().optional(),
|
||||||
shareSecretsProductEnabled: z.boolean().optional(),
|
shareSecretsProductEnabled: z.boolean().optional(),
|
||||||
maxSharedSecretLifetime: z.number().optional(),
|
maxSharedSecretLifetime: z.number().max(2592000, "Max Shared Secret lifetime cannot exceed 30 days").optional(),
|
||||||
maxSharedSecretViewLimit: z.number().nullable().optional()
|
maxSharedSecretViewLimit: z
|
||||||
|
.number()
|
||||||
|
.max(1000, "Max Shared Secret view count cannot exceed 1000")
|
||||||
|
.nullable()
|
||||||
|
.optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ export const secretSharingServiceFactory = ({
|
|||||||
const expiresAtTimestamp = new Date(expiresAt).getTime();
|
const expiresAtTimestamp = new Date(expiresAt).getTime();
|
||||||
const lifetime = expiresAtTimestamp - new Date().getTime();
|
const lifetime = expiresAtTimestamp - new Date().getTime();
|
||||||
|
|
||||||
|
// org.maxSharedSecretLifetime is in seconds
|
||||||
if (org.maxSharedSecretLifetime && lifetime / 1000 > org.maxSharedSecretLifetime) {
|
if (org.maxSharedSecretLifetime && lifetime / 1000 > org.maxSharedSecretLifetime) {
|
||||||
throw new BadRequestError({ message: "Secret lifetime exceeds organization limit" });
|
throw new BadRequestError({ message: "Secret lifetime exceeds organization limit" });
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -30,8 +30,8 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
|
|||||||
allowSecretSharingOutsideOrganization={
|
allowSecretSharingOutsideOrganization={
|
||||||
currentOrg?.allowSecretSharingOutsideOrganization ?? true
|
currentOrg?.allowSecretSharingOutsideOrganization ?? true
|
||||||
}
|
}
|
||||||
maxSharedSecretLifetime={currentOrg.maxSharedSecretLifetime}
|
maxSharedSecretLifetime={currentOrg?.maxSharedSecretLifetime}
|
||||||
maxSharedSecretViewLimit={currentOrg.maxSharedSecretViewLimit}
|
maxSharedSecretViewLimit={currentOrg?.maxSharedSecretViewLimit}
|
||||||
/>
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export const ShareSecretForm = ({
|
|||||||
const privateSharedSecretCreator = useCreateSharedSecret();
|
const privateSharedSecretCreator = useCreateSharedSecret();
|
||||||
const createSharedSecret = isPublic ? publicSharedSecretCreator : privateSharedSecretCreator;
|
const createSharedSecret = isPublic ? publicSharedSecretCreator : privateSharedSecretCreator;
|
||||||
|
|
||||||
|
// Note: maxSharedSecretLifetime is in seconds
|
||||||
const filteredExpiresInOptions = maxSharedSecretLifetime
|
const filteredExpiresInOptions = maxSharedSecretLifetime
|
||||||
? expiresInOptions.filter((v) => v.value / 1000 <= maxSharedSecretLifetime)
|
? expiresInOptions.filter((v) => v.value / 1000 <= maxSharedSecretLifetime)
|
||||||
: expiresInOptions;
|
: expiresInOptions;
|
||||||
|
|||||||
Reference in New Issue
Block a user