Skip to content

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

move project grant to secrets management section

Matheus Nogueirabfb77c38087c
diff --git a/frontend/src/hooks/api/projectFolderGrants/mutations.tsx b/frontend/src/hooks/api/projectFolderGrants/mutations.tsx
index a2069b7326..449a867116 100644
--- a/frontend/src/hooks/api/projectFolderGrants/mutations.tsx
+++ b/frontend/src/hooks/api/projectFolderGrants/mutations.tsx
@@ -3,7 +3,11 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { projectFolderGrantKeys } from "./queries";
-import { TCreateProjectFolderGrantDTO, TDeleteProjectFolderGrantDTO, TProjectFolderGrant } from "./types";
+import {
+ TCreateProjectFolderGrantDTO,
+ TDeleteProjectFolderGrantDTO,
+ TProjectFolderGrant
+} from "./types";
const invalidateTargetProjectSecrets = (
queryClient: ReturnType<typeof useQueryClient>,
diff --git a/frontend/src/hooks/api/projectFolderGrants/queries.tsx b/frontend/src/hooks/api/projectFolderGrants/queries.tsx
index f138f253c0..9f76a77167 100644
--- a/frontend/src/hooks/api/projectFolderGrants/queries.tsx
+++ b/frontend/src/hooks/api/projectFolderGrants/queries.tsx
@@ -5,7 +5,8 @@ import { apiRequest } from "@app/config/request";
import { TProjectFolderGrant, TProjectFolderGrantReceived } from "./types";
export const projectFolderGrantKeys = {
- listByProject: (sourceProjectId: string) => [{ sourceProjectId }, "project-folder-grants"] as const,
+ listByProject: (sourceProjectId: string) =>
+ [{ sourceProjectId }, "project-folder-grants"] as const,
listReceived: (targetProjectId: string) =>
[{ targetProjectId }, "project-folder-grants-received"] as const
};
@@ -14,9 +15,12 @@ export const useListProjectFolderGrants = (sourceProjectId: string) =>
useQuery({
queryKey: projectFolderGrantKeys.listByProject(sourceProjectId),
queryFn: async () => {
- const { data } = await apiRequest.get<{ grants: TProjectFolderGrant[] }>("/api/v1/project-folder-grants", {
- params: { sourceProjectId }
- });
+ const { data } = await apiRequest.get<{ grants: TProjectFolderGrant[] }>(
+ "/api/v1/project-folder-grants",
+ {
+ params: { sourceProjectId }
+ }
+ );
return data.grants;
},
enabled: Boolean(sourceProjectId)
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
index 4e92a7b82e..0c01a1baf2 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx
@@ -65,7 +65,8 @@ const Content = ({
.filter(([subject]) => subject !== ProjectPermissionSub.Integrations || hasNativeIntegrations)
.filter(
([subject]) =>
- subject !== ProjectPermissionSub.ProjectFolderGrant || config?.isCrossProjectSecretSharingEnabled
+ subject !== ProjectPermissionSub.ProjectFolderGrant ||
+ config?.isCrossProjectSecretSharingEnabled
)
.filter(
([subject]) => !allowedSubjects || allowedSubjects.includes(subject as ProjectPermissionSub)
diff --git a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
index 6ddf42fd14..70ffe4a980 100644
--- a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
@@ -23,7 +23,10 @@ import {
IconButton
} from "@app/components/v3";
import { useProject } from "@app/context";
-import { useDeleteProjectFolderGrant, useListProjectFolderGrants } from "@app/hooks/api/projectFolderGrants";
+import {
+ useDeleteProjectFolderGrant,
+ useListProjectFolderGrants
+} from "@app/hooks/api/projectFolderGrants";
import { ShareSecretsSheet } from "./ShareSecretsSheet";
@@ -105,7 +108,7 @@ export const CrossProjectSharingSection = () => {
<div
key={grant.id}
className="grid items-center gap-x-3 px-4 py-3"
- style={{ gridTemplateColumns: "minmax(7rem,max-content) 1fr 5.5rem 1.75rem" }}
+ style={{ gridTemplateColumns: "minmax(7rem,max-content) 1fr auto 1.75rem" }}
>
{/* env */}
<Badge variant="neutral" className="gap-1.5">
@@ -126,10 +129,10 @@ export const CrossProjectSharingSection = () => {
</div>
{/* secret count */}
- <div className="flex items-center justify-end gap-1.5 text-xs text-mineshaft-400">
+ <div className="flex items-center justify-end gap-1.5 whitespace-nowrap text-xs text-mineshaft-400">
<KeyRound className="size-3 shrink-0" />
<span className="tabular-nums">
- {grant.secretCount} {grant.secretCount === 1 ? "secret" : "secrets"}
+ {grant.secretCount} shared {grant.secretCount === 1 ? "secret" : "secrets"}
</span>
</div>
diff --git a/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
index ce525facee..4fd324e81d 100644
--- a/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
@@ -1,21 +1,14 @@
import { ProjectOverviewChangeSection } from "@app/components/project/ProjectOverviewChangeSection";
-import { useOrganization, useServerConfig } from "@app/context";
import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection";
-import { CrossProjectSharingSection } from "../CrossProjectSharingSection";
import { DeleteProjectProtection } from "../DeleteProjectProtection";
import { DeleteProjectSection } from "../DeleteProjectSection";
export const ProjectGeneralTab = () => {
- const { config } = useServerConfig();
- const { currentOrg } = useOrganization();
return (
<div>
<ProjectOverviewChangeSection showSlugField />
<AuditLogsRetentionSection />
- {config.isCrossProjectSecretSharingEnabled && currentOrg.allowCrossProjectSecretSharing && (
- <CrossProjectSharingSection />
- )}
<DeleteProjectProtection />
<DeleteProjectSection />
</div>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
index 0327e566a5..da2690a232 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
@@ -48,7 +48,7 @@ export const SettingsPage = () => {
{
name: "Policies",
description:
- "Configure validation rules, retention, sharing, and other behaviors that govern this project's secrets.",
+ "Configure validation rules, retention, cross-project sharing, and other behaviors that govern this project's secrets.",
key: "tab-secret-policies",
Component: PoliciesTab
},
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/PoliciesTab/PoliciesTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/PoliciesTab/PoliciesTab.tsx
index 2cfc613191..4e5563d3a2 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/PoliciesTab/PoliciesTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/PoliciesTab/PoliciesTab.tsx
@@ -1,4 +1,5 @@
-import { useServerConfig } from "@app/context";
+import { useOrganization, useServerConfig } from "@app/context";
+import { CrossProjectSharingSection } from "@app/pages/project/SettingsPage/components/CrossProjectSharingSection";
import { PointInTimeVersionLimitSection } from "../PointInTimeVersionLimitSection";
import { PreferencesSection } from "../PreferencesSection";
@@ -7,11 +8,15 @@ import { SecretValidationRulesSection } from "../SecretValidationRulesSection";
export const PoliciesTab = () => {
const { config } = useServerConfig();
+ const { currentOrg } = useOrganization();
return (
<div>
<SecretValidationRulesSection />
<PreferencesSection />
+ {config.isCrossProjectSecretSharingEnabled && currentOrg.allowCrossProjectSecretSharing && (
+ <CrossProjectSharingSection />
+ )}
<PointInTimeVersionLimitSection />
{config.paramsFolderSecretDetectionEnabled && <SecretDetectionIgnoreValuesSection />}
</div>