Skip to content

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

fix(insights): count secrets hidden from the viewer as unlisted, not cleared

Dimitris Staratzis0961de2e0948
diff --git a/backend/src/ee/services/secret-read-activity/secret-read-activity-service.ts b/backend/src/ee/services/secret-read-activity/secret-read-activity-service.ts
index 193216cbff..e5b0e11c0e 100644
--- a/backend/src/ee/services/secret-read-activity/secret-read-activity-service.ts
+++ b/backend/src/ee/services/secret-read-activity/secret-read-activity-service.ts
@@ -833,7 +833,8 @@ export const secretReadActivityServiceFactory = ({
return {
principal,
secrets,
- unlistedCount: Math.max(0, principal.unreadCount - secretIds.length),
+ // Everything not in the list: past the cached cap, hidden from this viewer, or deleted since.
+ unlistedCount: Math.max(0, principal.unreadCount - secrets.length),
projectName: tracking.projectName,
trackingStartedAt: tracking.trackingStartedAt,
unusedAccessFrom: tracking.unusedAccessFrom,
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index c7689c69d8..b4be6825f2 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -980,7 +980,8 @@ export const INSIGHTS = {
secretKey: "The key of the secret.",
environment: "The slug of the environment the secret is in.",
secretPath: "The path of the folder the secret is in.",
- unlistedCount: "How many more of the principal's unread secrets are not listed. Zero unless it has more than 200."
+ unlistedCount:
+ "How many of the principal's unread secrets are not listed: past the first 200, in places the caller cannot see, or deleted since the results were computed."
},
GET_SECRETS_ACCESS_VOLUME: {
days: "One entry for each of the last seven days, oldest first. Days with no secret access are included with a total of zero.",
diff --git a/frontend/src/pages/secret-manager/InsightsPage/components/UnusedAccessPrincipalSheet.tsx b/frontend/src/pages/secret-manager/InsightsPage/components/UnusedAccessPrincipalSheet.tsx
index f32df4b8f4..c8cfd68708 100644
--- a/frontend/src/pages/secret-manager/InsightsPage/components/UnusedAccessPrincipalSheet.tsx
+++ b/frontend/src/pages/secret-manager/InsightsPage/components/UnusedAccessPrincipalSheet.tsx
@@ -59,7 +59,7 @@ const PrincipalSecrets = ({ data }: SecretsProps) => {
<EmptyTitle>Nothing to show</EmptyTitle>
<EmptyDescription>
{data.unlistedCount > 0
- ? "The unread secrets are ones you cannot see."
+ ? "Its unread secrets are in places you cannot see, or were deleted since the last update."
: "This principal has no unread secrets anymore."}
</EmptyDescription>
</EmptyHeader>
@@ -121,7 +121,8 @@ const PrincipalSecrets = ({ data }: SecretsProps) => {
{data.unlistedCount > 0 && (
<p className="text-xs text-muted">
{data.unlistedCount} more unread {data.unlistedCount === 1 ? "secret is" : "secrets are"}{" "}
- not listed.
+ not listed: past the first 200, in places you cannot see, or deleted since the last
+ update.
</p>
)}
</div>