Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: ui for reindex secret reference
=d4555f969830
diff --git a/frontend/src/hooks/api/secrets/index.ts b/frontend/src/hooks/api/secrets/index.tsindex b24b5ed192..b58e8779aa 100644--- a/frontend/src/hooks/api/secrets/index.ts+++ b/frontend/src/hooks/api/secrets/index.ts@@ -1,4 +1,5 @@export {+ useBackfillSecretReference,useCreateSecretBatch,useCreateSecretV3,useDeleteSecretBatch,diff --git a/frontend/src/hooks/api/secrets/mutations.tsx b/frontend/src/hooks/api/secrets/mutations.tsxindex 448daee3be..e397c7b550 100644--- a/frontend/src/hooks/api/secrets/mutations.tsx+++ b/frontend/src/hooks/api/secrets/mutations.tsx@@ -87,11 +87,11 @@ export const useCreateSecretV3 = ({const randomBytes = latestFileKey? decryptAssymmetric({- ciphertext: latestFileKey.encryptedKey,- nonce: latestFileKey.nonce,- publicKey: latestFileKey.sender.publicKey,- privateKey: PRIVATE_KEY- })+ ciphertext: latestFileKey.encryptedKey,+ nonce: latestFileKey.nonce,+ publicKey: latestFileKey.sender.publicKey,+ privateKey: PRIVATE_KEY+ }): crypto.randomBytes(16).toString("hex");const reqBody = {@@ -148,11 +148,11 @@ export const useUpdateSecretV3 = ({const randomBytes = latestFileKey? decryptAssymmetric({- ciphertext: latestFileKey.encryptedKey,- nonce: latestFileKey.nonce,- publicKey: latestFileKey.sender.publicKey,- privateKey: PRIVATE_KEY- })+ ciphertext: latestFileKey.encryptedKey,+ nonce: latestFileKey.nonce,+ publicKey: latestFileKey.sender.publicKey,+ privateKey: PRIVATE_KEY+ }): crypto.randomBytes(16).toString("hex");const reqBody = {@@ -244,11 +244,11 @@ export const useCreateSecretBatch = ({const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY") as string;const randomBytes = latestFileKey? decryptAssymmetric({- ciphertext: latestFileKey.encryptedKey,- nonce: latestFileKey.nonce,- publicKey: latestFileKey.sender.publicKey,- privateKey: PRIVATE_KEY- })+ ciphertext: latestFileKey.encryptedKey,+ nonce: latestFileKey.nonce,+ publicKey: latestFileKey.sender.publicKey,+ privateKey: PRIVATE_KEY+ }): crypto.randomBytes(16).toString("hex");const reqBody = {@@ -297,11 +297,11 @@ export const useUpdateSecretBatch = ({const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY") as string;const randomBytes = latestFileKey? decryptAssymmetric({- ciphertext: latestFileKey.encryptedKey,- nonce: latestFileKey.nonce,- publicKey: latestFileKey.sender.publicKey,- privateKey: PRIVATE_KEY- })+ ciphertext: latestFileKey.encryptedKey,+ nonce: latestFileKey.nonce,+ publicKey: latestFileKey.sender.publicKey,+ privateKey: PRIVATE_KEY+ }): crypto.randomBytes(16).toString("hex");const reqBody = {@@ -379,3 +379,13 @@ export const createSecret = async (dto: CreateSecretDTO) => {const { data } = await apiRequest.post(`/api/v3/secrets/${dto.secretKey}`, dto);return data;};++export const useBackfillSecretReference = () =>+ useMutation<{ message: string }, {}, { projectId: string }>({+ mutationFn: async ({ projectId }) => {+ const { data } = await apiRequest.post("/api/v3/secrets/backfill-secret-references", {+ projectId+ });+ return data.message;+ }+ });diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsxnew file mode 100644index 0000000000..6aca7e36e7--- /dev/null+++ b/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx@@ -0,0 +1,44 @@+import { createNotification } from "@app/components/notifications";+import { Button } from "@app/components/v2";+import { useProjectPermission, useWorkspace } from "@app/context";+import { useBackfillSecretReference } from "@app/hooks/api";+import { ProjectMembershipRole } from "@app/hooks/api/roles/types";++export const BackfillSecretReferenceSecretion = () => {+ const { currentWorkspace } = useWorkspace();+ const { membership } = useProjectPermission();+ const backfillSecretReferences = useBackfillSecretReference();++ if (!currentWorkspace) return null;++ const handleBackfill = async () => {+ if (backfillSecretReferences.isLoading) return;+ try {+ await backfillSecretReferences.mutateAsync({ projectId: currentWorkspace.id || "" });+ createNotification({ text: "Successfully re-indexed secret references", type: "success" });+ } catch {+ createNotification({ text: "Failed to re-index secret references", type: "error" });+ }+ };++ const isAdmin = membership.roles.includes(ProjectMembershipRole.Admin);+ return (+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="flex w-full items-center justify-between">+ <p className="text-xl font-semibold">Resync Secret References</p>+ </div>+ <p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">+ Trigger this to reindex all your inline secret references to map integration+ synchronization.+ </p>+ <Button+ variant="outline_bg"+ isLoading={backfillSecretReferences.isLoading}+ onClick={handleBackfill}+ isDisabled={!isAdmin}+ >+ Resync Secret References+ </Button>+ </div>+ );+};diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/index.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/index.tsxnew file mode 100644index 0000000000..3e16514613--- /dev/null+++ b/frontend/src/views/Settings/ProjectSettingsPage/components/BackfillSecretReferenceSection/index.tsx@@ -0,0 +1 @@+export { BackfillSecretReferenceSecretion } from "./BackfillSecretReferenceSection";diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsxindex bbd8e78d40..7d7c30fb0a 100644--- a/frontend/src/views/Settings/ProjectSettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx+++ b/frontend/src/views/Settings/ProjectSettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx@@ -1,4 +1,5 @@import { AutoCapitalizationSection } from "../AutoCapitalizationSection";+import { BackfillSecretReferenceSecretion } from "../BackfillSecretReferenceSection";import { DeleteProjectSection } from "../DeleteProjectSection";import { E2EESection } from "../E2EESection";import { EnvironmentSection } from "../EnvironmentSection";@@ -13,6 +14,7 @@ export const ProjectGeneralTab = () => {<SecretTagsSection /><AutoCapitalizationSection /><E2EESection />+ <BackfillSecretReferenceSecretion /><DeleteProjectSection /></div>);diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/index.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/index.tsxindex 72ac106a32..9d97c8bb82 100644--- a/frontend/src/views/Settings/ProjectSettingsPage/components/index.tsx+++ b/frontend/src/views/Settings/ProjectSettingsPage/components/index.tsx@@ -1,4 +1,5 @@export { AutoCapitalizationSection } from "./AutoCapitalizationSection";+export { BackfillSecretReferenceSecretion } from "./BackfillSecretReferenceSection";export { DeleteProjectSection } from "./DeleteProjectSection";export { E2EESection } from "./E2EESection";export { EnvironmentSection } from "./EnvironmentSection";