Skip to content

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

fix ui to not show the shared secrets as if you had access

adilson0178a5ad74f5
diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx
index 591b4c4d86..15f276f7a1 100644
--- a/frontend/src/hooks/api/secrets/queries.tsx
+++ b/frontend/src/hooks/api/secrets/queries.tsx
@@ -130,7 +130,10 @@ export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => {
sec.valueOverride = personalSecret.value;
sec.overrideAction = "modified";
sec.isOverrideEmpty = personalSecret.isEmpty;
- sec.secretValueHidden = false;
+ // NOTE: do not force `secretValueHidden = false` here. It reflects whether the SHARED value is
+ // readable; a user with only the personal-override permission can read their override but not the
+ // shared value. Keep the shared entry's real value so the shared row renders the no-access state
+ // instead of attempting a forbidden fetch. Override display is gated on the override's own fields.
}
});
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 0b1114492d..b62b630dd7 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
@@ -107,8 +107,13 @@ export const SecretDetailSidebar = ({
const { mutateAsync: redactSecretValue } = useRedactSecretValue();
+ // A personal override is always readable by its owner, so its fetch must not depend on the shared
+ // value's `secretValueHidden` (true when the user lacks read access to the shared secret).
const canFetchSecretValue =
- Boolean(originalSecret) && !originalSecret.secretValueHidden && !originalSecret.isEmpty;
+ Boolean(originalSecret) &&
+ (originalSecret?.idOverride
+ ? !originalSecret.isOverrideEmpty
+ : !originalSecret.secretValueHidden && !originalSecret.isEmpty);
const fetchSecretValueParams = {
environment,
@@ -162,10 +167,8 @@ export const SecretDetailSidebar = ({
const getOverrideDefaultValue = () => {
if (isLoadingSecretValue) return HIDDEN_SECRET_VALUE;
- if (secret.secretValueHidden) {
- return canEditSecretValue ? HIDDEN_SECRET_VALUE : "";
- }
-
+ // The personal override is always readable by its owner; it is not gated on the shared value's
+ // `secretValueHidden`.
if (isErrorFetchingSecretValue) return "Error loading secret value...";
return secret.valueOverride || "";
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
index d0b45f7537..3f0b50e5f0 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
@@ -130,9 +130,13 @@ export const SecretItem = memo(
const [isFieldFocused, setIsFieldFocused] = useToggle();
+ // A personal override is always readable by its owner, so its fetch/display must not depend on the
+ // shared value's `secretValueHidden` (which is true when the user lacks read access to the shared secret).
+ const hasPersonalOverride = Boolean(originalSecret.idOverride);
const canFetchSecretValue =
- !originalSecret.secretValueHidden &&
- !originalSecret.isEmpty &&
+ (hasPersonalOverride
+ ? !originalSecret.isOverrideEmpty
+ : !originalSecret.secretValueHidden && !originalSecret.isEmpty) &&
pendingAction !== PendingAction.Create;
const fetchSecretValueParams = {
@@ -140,7 +144,7 @@ export const SecretItem = memo(
secretPath,
secretKey: originalSecret.originalKey || originalSecret.key,
projectId: currentProject.id,
- isOverride: Boolean(originalSecret.idOverride)
+ isOverride: hasPersonalOverride
};
const {
@@ -200,10 +204,8 @@ export const SecretItem = memo(
const getOverrideDefaultValue = () => {
if (isLoadingSecretValue) return undefined;
- if (secret.secretValueHidden && !isPending) {
- return canEditSecretValue ? HIDDEN_SECRET_VALUE : "";
- }
-
+ // The personal override belongs to the current user and is always readable by them, so it is not
+ // gated on the shared value's `secretValueHidden`.
if (isErrorFetchingSecretValue) return undefined;
return secret.valueOverride || "";