Skip to content

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

improvements: address feedback progress

Scott Wilson5a4b83d90065
diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts
index 93afb3b558..d8220e4f54 100644
--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts
+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts
@@ -446,9 +446,10 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => {
}
})
.where((bd) => {
- void bd
- .whereNull(`${TableName.SecretV2}.userId`)
- .orWhere({ [`${TableName.SecretV2}.userId` as "userId"]: userId || null });
+ void bd.whereNull(`${TableName.SecretV2}.userId`);
+ // scott: removing this as we don't need to count overrides
+ // and there is currently a bug when you move secrets that doesn't move the override so this can skew count
+ // .orWhere({ [`${TableName.SecretV2}.userId` as "userId"]: userId || null });
})
.countDistinct(`${TableName.SecretV2}.key`);
diff --git a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
index ada7411459..d4f09ea8fc 100644
--- a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
+++ b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx
@@ -130,6 +130,14 @@ export const SecretReferenceTree = ({ secretPath, environment, secretKey }: Prop
);
}
+ if (tree?.children?.length === 0) {
+ return (
+ <div className="flex items-center justify-center py-4">
+ <span className="text-mineshaft-400">This secret does not contain references</span>
+ </div>
+ );
+ }
+
return (
<div>
<FormControl label="Expanded value">
diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx
index b12cca38bb..e3cbf7f0ef 100644
--- a/frontend/src/hooks/api/secrets/queries.tsx
+++ b/frontend/src/hooks/api/secrets/queries.tsx
@@ -119,6 +119,7 @@ export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => {
sec.valueOverride = personalSecret.value;
sec.overrideAction = "modified";
sec.isEmpty = personalSecret.isEmpty;
+ sec.secretValueHidden = false;
}
});
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx
index 84b58fb7fa..be914024e7 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { useCallback, useEffect, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { subject } from "@casl/ability";
import {
@@ -15,10 +15,7 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- hasSecretReference,
- SecretReferenceTree
-} from "@app/components/secrets/SecretReferenceDetails";
+import { SecretReferenceTree } from "@app/components/secrets/SecretReferenceDetails";
import {
DeleteActionModal,
IconButton,
@@ -150,13 +147,20 @@ export const SecretEditRow = ({
control,
reset,
getValues,
+ setValue,
formState: { isDirty, isSubmitting }
} = useForm({
- values: {
+ defaultValues: {
value: (secretValueData?.valueOverride ?? secretValueData?.value) || null
}
});
+ useEffect(() => {
+ if (secretValueData && !isDirty) {
+ setValue("value", secretValueData.valueOverride ?? secretValueData.value);
+ }
+ }, [secretValueData]);
+
const { permission } = useProjectPermission();
const [isDeleting, setIsDeleting] = useToggle();
@@ -171,7 +175,7 @@ export const SecretEditRow = ({
};
const handleCopySecretToClipboard = async () => {
- if (!isSecretValueFetched) {
+ if (!isSecretValueFetched && !isDirty) {
try {
const data = await fetchSecretValue(fetchSecretValueParams);
@@ -402,18 +406,12 @@ export const SecretEditRow = ({
<Modal>
<ModalTrigger asChild>
<div className="opacity-0 group-hover:opacity-100">
- <Tooltip
- content={
- hasSecretReference(defaultValue || "")
- ? "Secret Reference Tree"
- : "Secret does not contain references"
- }
- >
+ <Tooltip content="Secret Reference Tree">
<IconButton
variant="plain"
ariaLabel="reference-tree"
className="h-full"
- isDisabled={!hasSecretReference(defaultValue || "") || !canReadSecretValue}
+ isDisabled={!canReadSecretValue || !secretId || isEmpty}
>
<FontAwesomeIcon icon={faProjectDiagram} />
</IconButton>
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
index fa839be843..c0ba7184ee 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
@@ -21,10 +21,7 @@ import { Link } from "@tanstack/react-router";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- hasSecretReference,
- SecretReferenceTree
-} from "@app/components/secrets/SecretReferenceDetails";
+import { SecretReferenceTree } from "@app/components/secrets/SecretReferenceDetails";
import {
Button,
Drawer,
@@ -843,26 +840,15 @@ export const SecretDetailSidebar = ({
)}
</div>
<div className="mt-auto flex items-center space-x-2 pb-4">
- <Tooltip
- content={
- hasSecretReference(secret?.value)
- ? undefined
- : "Secret does not contain any references."
- }
- className="z-[100] text-center"
+ <Button
+ className="flex-1"
+ variant="outline_bg"
+ isDisabled={cannotReadSecretValue || secret.isEmpty}
+ leftIcon={<FontAwesomeIcon icon={faProjectDiagram} />}
+ onClick={() => handlePopUpOpen("secretReferenceTree", secretKey)}
>
- <div className="flex-1">
- <Button
- className="w-full"
- variant="outline_bg"
- isDisabled={cannotReadSecretValue || !hasSecretReference(secret?.value)}
- leftIcon={<FontAwesomeIcon icon={faProjectDiagram} />}
- onClick={() => handlePopUpOpen("secretReferenceTree", secretKey)}
- >
- Secret Reference Tree
- </Button>
- </div>
- </Tooltip>
+ Secret Reference Tree
+ </Button>
<Tooltip content="Copy Secret ID" className="z-[100]">
<IconButton
variant="outline_bg"