mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 11:27:07 +00:00
greptile review fixes
This commit is contained in:
@@ -156,7 +156,7 @@ export const registerSecretSharingRouter = async (server: FastifyZodProvider) =>
|
|||||||
expiresAt: z.string(),
|
expiresAt: z.string(),
|
||||||
expiresAfterViews: z.number().min(1).optional(),
|
expiresAfterViews: z.number().min(1).optional(),
|
||||||
accessType: z.nativeEnum(SecretSharingAccessType).default(SecretSharingAccessType.Organization),
|
accessType: z.nativeEnum(SecretSharingAccessType).default(SecretSharingAccessType.Organization),
|
||||||
emails: z.string().email().array().optional()
|
emails: z.string().email().array().max(100).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -11,10 +11,13 @@ export const secretSharingKeys = {
|
|||||||
allSecretRequests: () => ["secretRequests"] as const,
|
allSecretRequests: () => ["secretRequests"] as const,
|
||||||
specificSecretRequests: ({ offset, limit }: { offset: number; limit: number }) =>
|
specificSecretRequests: ({ offset, limit }: { offset: number; limit: number }) =>
|
||||||
[...secretSharingKeys.allSecretRequests(), { offset, limit }] as const,
|
[...secretSharingKeys.allSecretRequests(), { offset, limit }] as const,
|
||||||
getSecretById: (arg: { id: string; hashedHex: string | null; password?: string }) => [
|
getSecretById: (arg: {
|
||||||
"shared-secret",
|
id: string;
|
||||||
arg
|
hashedHex: string | null;
|
||||||
],
|
password?: string;
|
||||||
|
email?: string;
|
||||||
|
token?: string;
|
||||||
|
}) => ["shared-secret", arg],
|
||||||
getSecretRequestById: (arg: { id: string }) => ["secret-request", arg] as const
|
getSecretRequestById: (arg: { id: string }) => ["secret-request", arg] as const
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +86,13 @@ export const useGetActiveSharedSecretById = ({
|
|||||||
token?: string;
|
token?: string;
|
||||||
}) => {
|
}) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: secretSharingKeys.getSecretById({ id: sharedSecretId, hashedHex, password }),
|
queryKey: secretSharingKeys.getSecretById({
|
||||||
|
id: sharedSecretId,
|
||||||
|
hashedHex,
|
||||||
|
password,
|
||||||
|
email,
|
||||||
|
token
|
||||||
|
}),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
|
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
|
||||||
`/api/v1/secret-sharing/shared/public/${sharedSecretId}`,
|
`/api/v1/secret-sharing/shared/public/${sharedSecretId}`,
|
||||||
|
|||||||
@@ -52,10 +52,15 @@ const schema = z.object({
|
|||||||
.refine(
|
.refine(
|
||||||
(val) => {
|
(val) => {
|
||||||
if (!val) return true;
|
if (!val) return true;
|
||||||
return val.split(",").every((email) => z.string().email().safeParse(email.trim()).success);
|
const emails = val
|
||||||
|
.split(",")
|
||||||
|
.map((email) => email.trim())
|
||||||
|
.filter((email) => email !== "");
|
||||||
|
if (emails.length > 100) return false;
|
||||||
|
return emails.every((email) => z.string().email().safeParse(email).success);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: "Must be a comma-separated list of valid emails or empty."
|
message: "Must be a comma-separated list of valid emails (max 100) or empty."
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@@ -249,7 +254,7 @@ export const ShareSecretForm = ({
|
|||||||
v ? SecretSharingAccessType.Organization : SecretSharingAccessType.Anyone
|
v ? SecretSharingAccessType.Organization : SecretSharingAccessType.Anyone
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
id="delete-secrets"
|
id="org-access-only"
|
||||||
>
|
>
|
||||||
Limit access to people within organization
|
Limit access to people within organization
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|||||||
Reference in New Issue
Block a user