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
address review comments
adilson9cb110b4392b
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsxindex 9ec89dc95f..a7e6ae698a 100644--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx@@ -16,7 +16,6 @@ import {ShieldBanIcon,TimerIcon} from "lucide-react";-import ms from "ms";import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";import {@@ -97,6 +96,7 @@ import { ApprovalStatus, TWorkspaceUser } from "@app/hooks/api/types";import { RequestAccessModal } from "./components/RequestAccessModal";import { ReviewAccessRequestModal } from "./components/ReviewAccessModal";+import { formatAccessDuration, parseAccessDurationMs } from "./AccessApprovalRequest.utils";type FilterMenuProps = {className?: string;@@ -682,9 +682,10 @@ export const AccessApprovalRequest = ({<Badge variant="info"><TimerIcon /><span className="whitespace-nowrap">- {request.temporaryRange- ? ms(ms(request.temporaryRange), { long: true })- : "Temporary"}+ {(() => {+ const rangeMs = parseAccessDurationMs(request.temporaryRange);+ return rangeMs ? formatAccessDuration(rangeMs) : "Temporary";+ })()}</span></Badge>) : (diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.utils.ts b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.utils.tsindex acde84e59c..3dd53519bc 100644--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.utils.ts+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.utils.ts@@ -12,11 +12,35 @@ export const parseAccessDurationMs = (value?: string | null) => {}};+const DURATION_UNITS = [+ { label: "day", ms: 24 * 60 * 60 * 1000 },+ { label: "hour", ms: 60 * 60 * 1000 },+ { label: "minute", ms: 60 * 1000 },+ { label: "second", ms: 1000 }+] as const;++// Break a duration into its exact day/hour/minute/second parts instead of letting+// ms() round to a single unit (e.g. 90m -> "1 hour 30 minutes", not "2 hours").+export const formatAccessDuration = (durationMs: number) => {+ const parts: string[] = [];+ let remaining = durationMs;++ DURATION_UNITS.forEach(({ label, ms: unitMs }) => {+ const count = Math.floor(remaining / unitMs);+ if (count > 0) {+ parts.push(`${count} ${label}${count === 1 ? "" : "s"}`);+ remaining -= count * unitMs;+ }+ });++ return parts.length ? parts.join(" ") : "0 seconds";+};+// Single source for the access-duration copy so the label a requester previews in// RequestAccessForm matches what reviewers later see in ReviewAccessModal.export const getAccessDurationLabel = (isTemporary?: boolean, temporaryRange?: string | null) => {if (!isTemporary || !temporaryRange) return "Permanent";const rangeMs = parseAccessDurationMs(temporaryRange);if (!rangeMs) return `Valid for ${temporaryRange} after approval`;- return `Valid for ${ms(rangeMs, { long: true })} after approval`;+ return `Valid for ${formatAccessDuration(rangeMs)} after approval`;};diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessForm.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessForm.tsxindex 80ef8dc1a7..6f1d91f967 100644--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessForm.tsx+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/components/RequestAccessForm.tsx@@ -93,8 +93,6 @@ type TResourceConfig = {Icon: LucideIcon;// Tailwind extracts classes statically, so every tint must be a full literal stringiconTileClassName: string;- countBadgeClassName: string;- summaryIconClassName: string;actions: TResourceAction[];};@@ -104,8 +102,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Secrets",Icon: KeyIcon,iconTileClassName: "border-accent/10 bg-accent/15 text-accent",- countBadgeClassName: "border-accent/10 bg-accent/15 text-accent",- summaryIconClassName: "text-accent",actions: [{value: ProjectPermissionActions.Read,@@ -138,8 +134,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Folders",Icon: FolderIcon,iconTileClassName: "border-folder/10 bg-folder/15 text-folder",- countBadgeClassName: "border-folder/10 bg-folder/15 text-folder",- summaryIconClassName: "text-folder",actions: [{value: ProjectPermissionActions.Create,@@ -166,8 +160,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Dynamic Secrets",Icon: FingerprintIcon,iconTileClassName: "border-dynamic-secret/10 bg-dynamic-secret/15 text-dynamic-secret",- countBadgeClassName: "border-dynamic-secret/10 bg-dynamic-secret/15 text-dynamic-secret",- summaryIconClassName: "text-dynamic-secret",actions: [{value: ProjectPermissionDynamicSecretActions.ReadRootCredential,@@ -206,8 +198,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Secret Rotation",Icon: RefreshCwIcon,iconTileClassName: "border-secret-rotation/10 bg-secret-rotation/15 text-secret-rotation",- countBadgeClassName: "border-secret-rotation/10 bg-secret-rotation/15 text-secret-rotation",- summaryIconClassName: "text-secret-rotation",actions: [{value: ProjectPermissionSecretRotationActions.Read,@@ -252,8 +242,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Secret Imports",Icon: ImportIcon,iconTileClassName: "border-import/10 bg-import/15 text-import",- countBadgeClassName: "border-import/10 bg-import/15 text-import",- summaryIconClassName: "text-import",actions: [{value: ProjectPermissionActions.Read,@@ -286,8 +274,6 @@ const RESOURCE_CONFIGS: TResourceConfig[] = [label: "Honey Tokens",Icon: HexagonIcon,iconTileClassName: "border-yellow-700/10 bg-yellow-700/15 text-yellow-700",- countBadgeClassName: "border-yellow-700/10 bg-yellow-700/15 text-yellow-700",- summaryIconClassName: "text-yellow-700",actions: [{value: ProjectPermissionHoneyTokenActions.Read,