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
chore: base removal of folders from PAM
Sheen Capadngand6867b169c23
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex 7634e7614c..20c300548d 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -659,7 +659,9 @@ export const pamAccountServiceFactory = ({const inputs = {resourceId: resource.id,- accountPath: path.join(folderPath, account.name)+ accountPath: path.join(folderPath, account.name),+ resourceName: resource.name,+ accountName: account.name};const canAccess = await fac.canAccess(approvalRequestGrantsDAL, resource.projectId, actor.id, inputs);diff --git a/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts b/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.tsindex d23bb2c24f..ae3dd5587b 100644--- a/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts+++ b/backend/src/services/approval-policy/pam-access/pam-access-policy-factory.ts@@ -13,6 +13,17 @@ import {} from "../approval-policy-types";import { TPamAccessPolicy, TPamAccessPolicyInputs, TPamAccessRequestData } from "./pam-access-policy-types";+// Helper function to check if a value matches any of the patterns in an array+const matchesAnyPattern = (value: string, patterns: string[]): boolean => {+ return patterns.some((pattern) => picomatch(pattern)(value));+};++// Helper function to calculate specificity score for a pattern+const calculateSpecificity = (pattern: string): { wildcardCount: number; length: number } => {+ const wildcardCount = (pattern.match(/\*/g) || []).length;+ return { wildcardCount, length: pattern.length };+};+export const pamAccessPolicyFactory: TApprovalResourceFactory<TPamAccessPolicyInputs,TPamAccessPolicy,@@ -25,28 +36,93 @@ export const pamAccessPolicyFactory: TApprovalResourceFactory<) => {const policies = await approvalPolicyDAL.findByProjectId(policyType, projectId);- let bestMatch: { policy: TPamAccessPolicy; wildcardCount: number; pathLength: number } | null = null;+ let bestMatch: { policy: TPamAccessPolicy; wildcardCount: number; patternLength: number } | null = null;- const normalizedAccountPath = inputs.accountPath.startsWith("/") ? inputs.accountPath.slice(1) : inputs.accountPath;+ let normalizedAccountPath: string | undefined;+ if (inputs.accountPath) {+ normalizedAccountPath = inputs.accountPath.startsWith("/") ? inputs.accountPath.slice(1) : inputs.accountPath;+ } else {+ normalizedAccountPath = undefined;+ }for (const policy of policies) {const p = policy as TPamAccessPolicy;for (const c of p.conditions.conditions) {- // Find the most specific path pattern- // TODO(andrey): Make matching logic more advanced by accounting for wildcard positions- for (const pathPattern of c.accountPaths) {- const normalizedPathPattern = pathPattern.startsWith("/") ? pathPattern.slice(1) : pathPattern;- if (picomatch(normalizedPathPattern)(normalizedAccountPath)) {- const wildcardCount = (pathPattern.match(/\*/g) || []).length;- const pathLength = pathPattern.length;-- if (- !bestMatch ||- wildcardCount < bestMatch.wildcardCount ||- (wildcardCount === bestMatch.wildcardCount && pathLength > bestMatch.pathLength)- ) {- bestMatch = { policy: p, wildcardCount, pathLength };+ let conditionMatches = false;+ let totalWildcards = 0;+ let totalPatternLength = 0;++ // Check new resource/account name based matching+ const hasResourceNames = c.resourceNames && c.resourceNames.length > 0;+ const hasAccountNames = c.accountNames && c.accountNames.length > 0;++ if (hasResourceNames || hasAccountNames) {+ // New matching logic: resourceNames AND/OR accountNames+ let resourceMatches = true;+ let accountMatches = true;++ if (hasResourceNames && inputs.resourceName) {+ resourceMatches = matchesAnyPattern(inputs.resourceName, c.resourceNames!);+ if (resourceMatches) {+ // Find the best matching pattern for specificity calculation+ for (const pattern of c.resourceNames!) {+ if (picomatch(pattern)(inputs.resourceName)) {+ const spec = calculateSpecificity(pattern);+ totalWildcards += spec.wildcardCount;+ totalPatternLength += spec.length;+ break;+ }+ }+ }+ } else if (hasResourceNames && !inputs.resourceName) {+ // Resource names required but not provided in inputs+ resourceMatches = false;+ }++ if (hasAccountNames && inputs.accountName) {+ accountMatches = matchesAnyPattern(inputs.accountName, c.accountNames!);+ if (accountMatches) {+ // Find the best matching pattern for specificity calculation+ for (const pattern of c.accountNames!) {+ if (picomatch(pattern)(inputs.accountName)) {+ const spec = calculateSpecificity(pattern);+ totalWildcards += spec.wildcardCount;+ totalPatternLength += spec.length;+ break;+ }+ }}+ } else if (hasAccountNames && !inputs.accountName) {+ // Account names required but not provided in inputs+ accountMatches = false;+ }++ conditionMatches = resourceMatches && accountMatches;+ }++ // Legacy matching: accountPaths (for backwards compatibility)+ const hasAccountPaths = c.accountPaths && c.accountPaths.length > 0;+ if (hasAccountPaths && !conditionMatches && normalizedAccountPath) {+ for (const pathPattern of c.accountPaths!) {+ const normalizedPathPattern = pathPattern.startsWith("/") ? pathPattern.slice(1) : pathPattern;+ if (picomatch(normalizedPathPattern)(normalizedAccountPath)) {+ const spec = calculateSpecificity(pathPattern);+ totalWildcards = spec.wildcardCount;+ totalPatternLength = spec.length;+ conditionMatches = true;+ break;+ }+ }+ }++ if (conditionMatches) {+ // Use specificity to determine the best match (fewer wildcards = more specific)+ if (+ !bestMatch ||+ totalWildcards < bestMatch.wildcardCount ||+ (totalWildcards === bestMatch.wildcardCount && totalPatternLength > bestMatch.patternLength)+ ) {+ bestMatch = { policy: p, wildcardCount: totalWildcards, patternLength: totalPatternLength };}}}@@ -69,16 +145,51 @@ export const pamAccessPolicyFactory: TApprovalResourceFactory<revokedAt: null});- const normalizedAccountPath = inputs.accountPath.startsWith("/") ? inputs.accountPath.slice(1) : inputs.accountPath;+ let normalizedAccountPath: string | undefined;+ if (inputs.accountPath) {+ normalizedAccountPath = inputs.accountPath.startsWith("/") ? inputs.accountPath.slice(1) : inputs.accountPath;+ } else {+ normalizedAccountPath = undefined;+ }// TODO(andrey): Move some of this check to be part of SQL queryreturn grants.some((grant) => {const grantAttributes = grant.attributes as TPamAccessPolicyInputs;- const normalizedGrantPath = grantAttributes.accountPath.startsWith("/")- ? grantAttributes.accountPath.slice(1)- : grantAttributes.accountPath;- const isMatch = picomatch(normalizedGrantPath);- return isMatch(normalizedAccountPath) && (!grant.expiresAt || grant.expiresAt > new Date());++ // Check new-style matching (resourceName and/or accountName)+ if (inputs.resourceName || inputs.accountName) {+ let resourceMatches = true;+ let accountMatches = true;++ if (inputs.resourceName && grantAttributes.resourceName) {+ resourceMatches = picomatch(grantAttributes.resourceName)(inputs.resourceName);+ } else if (inputs.resourceName && !grantAttributes.resourceName) {+ resourceMatches = false;+ }++ if (inputs.accountName && grantAttributes.accountName) {+ accountMatches = picomatch(grantAttributes.accountName)(inputs.accountName);+ } else if (inputs.accountName && !grantAttributes.accountName) {+ accountMatches = false;+ }++ if (resourceMatches && accountMatches && (!grant.expiresAt || grant.expiresAt > new Date())) {+ return true;+ }+ }++ // Legacy matching: accountPath+ if (normalizedAccountPath && grantAttributes.accountPath) {+ const normalizedGrantPath = grantAttributes.accountPath.startsWith("/")+ ? grantAttributes.accountPath.slice(1)+ : grantAttributes.accountPath;+ const isMatch = picomatch(normalizedGrantPath);+ if (isMatch(normalizedAccountPath) && (!grant.expiresAt || grant.expiresAt > new Date())) {+ return true;+ }+ }++ return false;});};diff --git a/backend/src/services/approval-policy/pam-access/pam-access-policy-schemas.ts b/backend/src/services/approval-policy/pam-access/pam-access-policy-schemas.tsindex 9fef86f8c4..b180c7f0b4 100644--- a/backend/src/services/approval-policy/pam-access/pam-access-policy-schemas.ts+++ b/backend/src/services/approval-policy/pam-access/pam-access-policy-schemas.ts@@ -14,7 +14,9 @@ import {// Inputsexport const PamAccessPolicyInputsSchema = z.object({- accountPath: z.string()+ accountPath: z.string().optional(),+ resourceName: z.string().optional(),+ accountName: z.string().optional()});const accountPathGlob = z.string().refine(@@ -30,14 +32,43 @@ const accountPathGlob = z.string().refine();// Conditions+const resourceNameGlob = z.string().refine(+ (el) => {+ try {+ picomatch.parse([el]);+ return true;+ } catch {+ return false;+ }+ },+ { message: "Invalid glob pattern for resource name" }+);++const accountNameGlob = z.string().refine(+ (el) => {+ try {+ picomatch.parse([el]);+ return true;+ } catch {+ return false;+ }+ },+ { message: "Invalid glob pattern for account name" }+);+export const PamAccessPolicyConditionsSchema = z.object({- accountPaths: accountPathGlob.array()+ // Deprecated: use resourceNames and accountNames instead+ accountPaths: accountPathGlob.array().optional(),+ // New fields for matching+ resourceNames: resourceNameGlob.array().optional(),+ accountNames: accountNameGlob.array().optional()}).array();const MutatePamAccessPolicyConditionsSchema = z.object({+ // Deprecated: use resourceNames and accountNames instead (kept for backwards compatibility)accountPaths: accountPathGlob.refine((el) => el.startsWith("/"), {message: "Path must start with /"@@ -46,7 +77,22 @@ const MutatePamAccessPolicyConditionsSchema = zmessage: "Path cannot end with /"}).array()+ .optional(),+ resourceNames: resourceNameGlob.array().optional(),+ accountNames: accountNameGlob.array().optional()})+ .refine(+ (data) => {+ // At least one condition type must be provided+ const hasAccountPaths = data.accountPaths && data.accountPaths.length > 0;+ const hasResourceNames = data.resourceNames && data.resourceNames.length > 0;+ const hasAccountNames = data.accountNames && data.accountNames.length > 0;+ return hasAccountPaths || hasResourceNames || hasAccountNames;+ },+ {+ message: "At least one condition type must be provided (resourceNames, accountNames, or accountPaths)"+ }+ ).array();const DurationSchema = z.string().refine(@@ -67,22 +113,41 @@ export const PamAccessPolicyConstraintsSchema = z.object({})});-// Request Data+// Request Data - Base schema for stored data (used by grants, etc.)export const PamAccessPolicyRequestDataSchema = z.object({- accountPath: accountPathGlob,- accessDuration: DurationSchema+ accountPath: accountPathGlob.optional(),+ accessDuration: DurationSchema,+ resourceName: resourceNameGlob.optional(),+ accountName: accountNameGlob.optional()});-const CreatePamAccessPolicyRequestDataSchema = z.object({- accountPath: accountPathGlob- .refine((el) => el.startsWith("/"), {- message: "Path must start with /"- })- .refine((el) => !el.endsWith("/"), {- message: "Path cannot end with /"- }),- accessDuration: DurationSchema-});+// Schema with validation for creating requests+const CreatePamAccessPolicyRequestDataSchema = z+ .object({+ accountPath: accountPathGlob+ .refine((el) => el.startsWith("/"), {+ message: "Path must start with /"+ })+ .refine((el) => !el.endsWith("/"), {+ message: "Path cannot end with /"+ })+ .optional(),+ accessDuration: DurationSchema,+ resourceName: resourceNameGlob.optional(),+ accountName: accountNameGlob.optional()+ })+ .refine(+ (data) => {+ // At least one identifier must be provided+ const hasAccountPath = Boolean(data.accountPath);+ const hasResourceName = Boolean(data.resourceName);+ const hasAccountName = Boolean(data.accountName);+ return hasAccountPath || hasResourceName || hasAccountName;+ },+ {+ message: "At least one identifier must be provided (accountPath, resourceName, or accountName)"+ }+ );// Policyexport const PamAccessPolicySchema = BaseApprovalPolicySchema.extend({diff --git a/frontend/src/hooks/api/approvalGrants/types.ts b/frontend/src/hooks/api/approvalGrants/types.tsindex 7a290916e4..4ddda97199 100644--- a/frontend/src/hooks/api/approvalGrants/types.ts+++ b/frontend/src/hooks/api/approvalGrants/types.ts@@ -8,8 +8,10 @@ export enum ApprovalGrantStatus {// PAM Access Grant Attributesexport type PamAccessGrantAttributes = {- accountPath: string;+ accountPath?: string;accessDuration: string;+ resourceName?: string;+ accountName?: string;};export type TApprovalGrantAttributes = PamAccessGrantAttributes;diff --git a/frontend/src/hooks/api/approvalPolicies/types.ts b/frontend/src/hooks/api/approvalPolicies/types.tsindex d1e07ffcbc..26acc942f5 100644--- a/frontend/src/hooks/api/approvalPolicies/types.ts+++ b/frontend/src/hooks/api/approvalPolicies/types.ts@@ -19,7 +19,11 @@ export type ApprovalPolicyStep = {};export type PamAccessPolicyConditions = {- accountPaths: string[];+ // Deprecated: use resourceNames and accountNames instead+ accountPaths?: string[];+ // New fields for matching+ resourceNames?: string[];+ accountNames?: string[];}[];export type PamAccessPolicyConstraints = {@@ -95,7 +99,9 @@ export type TDeleteApprovalPolicyDTO = {export type TCheckPolicyMatchDTO = {policyType: ApprovalPolicyType;projectId: string;- inputs: { accountPath: string } | { profileName: string };+ inputs:+ | { accountPath?: string; resourceName?: string; accountName?: string }+ | { profileName: string };};export type TCheckPolicyMatchResult = {diff --git a/frontend/src/hooks/api/approvalRequests/types.ts b/frontend/src/hooks/api/approvalRequests/types.tsindex f073934747..a5db1b6feb 100644--- a/frontend/src/hooks/api/approvalRequests/types.ts+++ b/frontend/src/hooks/api/approvalRequests/types.ts@@ -50,8 +50,10 @@ export type ApprovalRequestStep = {};export type PamAccessRequestData = {- accountPath: string;+ accountPath?: string;accessDuration: string;+ resourceName?: string;+ accountName?: string;};export type CertRequestRequestData = {diff --git a/frontend/src/layouts/PamLayout/PamLayout.tsx b/frontend/src/layouts/PamLayout/PamLayout.tsxindex ba74e5312e..25e8c92285 100644--- a/frontend/src/layouts/PamLayout/PamLayout.tsx+++ b/frontend/src/layouts/PamLayout/PamLayout.tsx@@ -26,15 +26,6 @@ export const PamLayout = () => {<nav className="w-full"><Tabs value="selected"><TabList className="border-b-0">- <Link- to="/organizations/$orgId/projects/pam/$projectId/accounts"- params={{- orgId: currentOrg.id,- projectId: currentProject.id- }}- >- {({ isActive }) => <Tab value={isActive ? "selected" : ""}>Accounts</Tab>}- </Link><Linkto="/organizations/$orgId/projects/pam/$projectId/resources"params={{diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsxindex 297a4a3c71..62279a508b 100644--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx+++ b/frontend/src/pages/pam/ApprovalRequestDetailPage/ApprovalRequestDetailPage.tsx@@ -104,7 +104,13 @@ const PageContent = () => {<PageHeaderscope={ProjectType.PAM}title="Approval Request"- description={`Request to access account ${(request.requestData.requestData as PamAccessRequestData).accountPath} for ${(request.requestData.requestData as PamAccessRequestData).accessDuration} by ${request.requesterName || "Unknown"}`}+ description={(() => {+ const data = request.requestData.requestData as PamAccessRequestData;+ const target = data.resourceName+ ? `${data.resourceName}${data.accountName ? ` / ${data.accountName}` : ""}`+ : data.accountPath || "account";+ return `Request to access ${target} for ${data.accessDuration} by ${request.requesterName || "Unknown"}`;+ })()}><div>{request.requesterId === currentUser.id &&diff --git a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsxindex 79bce0ba52..1b73ca9ed4 100644--- a/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx+++ b/frontend/src/pages/pam/ApprovalRequestDetailPage/components/RequestDetailsSection.tsx@@ -28,7 +28,8 @@ const getStatusBadgeColor = (status: ApprovalRequestStatus) => {};export const RequestDetailsSection = ({ request }: Props) => {- const { accountPath, accessDuration } = request.requestData.requestData as PamAccessRequestData;+ const { accountPath, accessDuration, resourceName, accountName } = request.requestData+ .requestData as PamAccessRequestData;return (<div className="flex w-full flex-col gap-3 rounded-lg border border-mineshaft-600 bg-mineshaft-900 px-4 py-3">@@ -46,7 +47,13 @@ export const RequestDetailsSection = ({ request }: Props) => {{request.requesterName || "Unknown"}</GenericFieldLabel><GenericFieldLabel label="Requester Email">{request.requesterEmail}</GenericFieldLabel>- <GenericFieldLabel label="Account Path">{accountPath}</GenericFieldLabel>+ {resourceName && (+ <GenericFieldLabel label="Resource Name">{resourceName}</GenericFieldLabel>+ )}+ {accountName && <GenericFieldLabel label="Account Name">{accountName}</GenericFieldLabel>}+ {accountPath && !resourceName && !accountName && (+ <GenericFieldLabel label="Account Path">{accountPath}</GenericFieldLabel>+ )}<GenericFieldLabel label="Access Duration">{accessDuration}</GenericFieldLabel>{request.justification && (<GenericFieldLabel label="Justification">diff --git a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsxindex abad78bbfc..bbbd656819 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/ApprovalRequestTab/ApprovalRequestTab.tsx@@ -117,15 +117,18 @@ export const ApprovalRequestTab = () => {// Apply search filterif (search) {- filtered = filtered.filter(- (request) =>- request.requesterName?.toLowerCase().includes(search.toLowerCase()) ||- request.requesterEmail?.toLowerCase().includes(search.toLowerCase()) ||- request.justification?.toLowerCase().includes(search.toLowerCase()) ||- (request.requestData.requestData as PamAccessRequestData).accountPath- .toLowerCase()- .includes(search.toLowerCase())- );+ filtered = filtered.filter((request) => {+ const data = request.requestData.requestData as PamAccessRequestData;+ const searchLower = search.toLowerCase();+ return (+ request.requesterName?.toLowerCase().includes(searchLower) ||+ request.requesterEmail?.toLowerCase().includes(searchLower) ||+ request.justification?.toLowerCase().includes(searchLower) ||+ data.accountPath?.toLowerCase().includes(searchLower) ||+ data.resourceName?.toLowerCase().includes(searchLower) ||+ data.accountName?.toLowerCase().includes(searchLower)+ );+ });}return filtered@@ -276,7 +279,7 @@ export const ApprovalRequestTab = () => {<THead><Tr><Th>Requester</Th>- <Th>Account Path</Th>+ <Th>Account</Th><Th>Access Duration</Th><Th>Status</Th><Th>Requested</Th>@@ -287,8 +290,8 @@ export const ApprovalRequestTab = () => {{!isRequestsLoading &&paginatedRequests.map((request) => {const needsApproval = checkIfUserNeedsToApprove(request, userId, userGroups);- const { accountPath, accessDuration } = request.requestData- .requestData as PamAccessRequestData;+ const { accountPath, accessDuration, resourceName, accountName } = request+ .requestData.requestData as PamAccessRequestData;return (<Tr@@ -305,8 +308,22 @@ export const ApprovalRequestTab = () => {</div></Td><Td>- <div>- <div className="text-sm text-mineshaft-200">{accountPath}</div>+ <div className="space-y-0.5">+ {resourceName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Resource:</span> {resourceName}+ </div>+ )}+ {accountName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Account:</span> {accountName}+ </div>+ )}+ {accountPath && !resourceName && !accountName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Path:</span> {accountPath}+ </div>+ )}</div></Td><Td>diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsxindex 6e84a78d43..6d76e7f0e6 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx@@ -210,37 +210,68 @@ export const PoliciesTable = ({ handlePopUpOpen }: Props) => {Approval Conditions</div>{(policy.conditions.conditions as PamAccessPolicyConditions).map(- (step, index) => (- <Fragment key={`${policy.id}--${index + 1}`}>- <div- className={twMerge(- "rounded border border-mineshaft-600 bg-mineshaft-900 p-3"- )}- >- <div className="space-y-2">- <div>- <span className="text-sm font-medium text-mineshaft-300">- Account Paths:- </span>- <p className="text-sm text-mineshaft-100">- {step.accountPaths.join(", ")}- </p>+ (condition, index) => {+ const hasResourceNames =+ condition.resourceNames && condition.resourceNames.length > 0;+ const hasAccountNames =+ condition.accountNames && condition.accountNames.length > 0;+ const hasAccountPaths =+ condition.accountPaths && condition.accountPaths.length > 0;++ return (+ <Fragment key={`${policy.id}--${index + 1}`}>+ <div+ className={twMerge(+ "rounded border border-mineshaft-600 bg-mineshaft-900 p-3"+ )}+ >+ <div className="space-y-2">+ {hasResourceNames && (+ <div>+ <span className="text-sm font-medium text-mineshaft-300">+ Resource Names:+ </span>+ <p className="text-sm text-mineshaft-100">+ {condition.resourceNames!.join(", ")}+ </p>+ </div>+ )}+ {hasAccountNames && (+ <div>+ <span className="text-sm font-medium text-mineshaft-300">+ Account Names:+ </span>+ <p className="text-sm text-mineshaft-100">+ {condition.accountNames!.join(", ")}+ </p>+ </div>+ )}+ {hasAccountPaths && (+ <div>+ <span className="text-sm font-medium text-mineshaft-300">+ Account Paths:+ </span>+ <p className="text-sm text-mineshaft-100">+ {condition.accountPaths!.join(", ")}+ </p>+ </div>+ )}</div></div>- </div>- {index < policy.conditions.conditions.length - 1 && (- <div className="flex items-center">- <div className="flex flex-col items-center">- <div className="h-3 w-px bg-mineshaft-500" />- <span className="px-2 text-xs font-medium text-mineshaft-400">- OR- </span>- <div className="h-3 w-px bg-mineshaft-500" />+ {index < policy.conditions.conditions.length - 1 && (+ <div className="flex items-center">+ <div className="flex flex-col items-center">+ <div className="h-3 w-px bg-mineshaft-500" />+ <span className="px-2 text-xs font-medium text-mineshaft-400">+ OR+ </span>+ <div className="h-3 w-px bg-mineshaft-500" />+ </div></div>- </div>- )}- </Fragment>- )+ )}+ </Fragment>+ );+ })}</div><div className="flex-2">diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsxindex 1df3419975..9cc21c0490 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicyModal.tsx@@ -1,4 +1,4 @@-import { useEffect, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { FormProvider, useForm } from "react-hook-form";import { Tab } from "@headlessui/react";import { zodResolver } from "@hookform/resolvers/zod";@@ -42,12 +42,19 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {const [selectedStepIndex, setSelectedStepIndex] = useState(0);+ // Check if the existing policy has legacy accountPaths defined+ const hasLegacyAccountPaths = useMemo(() => {+ if (!policyData?.policy) return false;+ const conditions = policyData.policy.conditions.conditions as PamAccessPolicyConditions;+ return conditions.some((c) => c.accountPaths && c.accountPaths.length > 0);+ }, [policyData]);+const formMethods = useForm<TPolicyForm>({resolver: zodResolver(PolicyFormSchema),defaultValues: {name: "",maxRequestTtl: null,- conditions: [{ accountPaths: [] }],+ conditions: [{ resourceNames: [], accountNames: [] }],constraints: {accessDuration: {min: "30s",@@ -72,10 +79,15 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {useEffect(() => {if (policyData?.policy) {+ const conditions = policyData.policy.conditions.conditions as PamAccessPolicyConditions;reset({name: policyData.policy.name,maxRequestTtl: policyData.policy.maxRequestTtl,- conditions: policyData.policy.conditions.conditions as PamAccessPolicyConditions,+ conditions: conditions.map((c) => ({+ accountPaths: c.accountPaths || [],+ resourceNames: c.resourceNames || [],+ accountNames: c.accountNames || []+ })),constraints: policyData.policy.constraints.constraints,steps: policyData.policy.steps.map((step) => ({...step,@@ -86,7 +98,7 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {reset({name: "",maxRequestTtl: null,- conditions: [{ accountPaths: [] }],+ conditions: [{ resourceNames: [], accountNames: [] }],constraints: {accessDuration: {min: "30s",@@ -214,13 +226,16 @@ export const PolicyModal = ({ popUp, handlePopUpToggle }: Props) => {</Tab.List><Tab.Panels><Tab.Panel>- <PolicyDetailsStep />+ <PolicyDetailsStep+ isEditing={Boolean(policyData?.policyId)}+ hasLegacyAccountPaths={hasLegacyAccountPaths}+ /></Tab.Panel><Tab.Panel><PolicyApprovalSteps /></Tab.Panel><Tab.Panel>- <PolicyReviewStep />+ <PolicyReviewStep hasLegacyAccountPaths={hasLegacyAccountPaths} /></Tab.Panel></Tab.Panels></Tab.Group>diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsxindex d3c0c2d7c2..2e9e81ab44 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySchema.tsx@@ -28,10 +28,10 @@ export const PolicyFormSchema = z.object({).nullish(),conditions: z.object({+ // Deprecated: use resourceNames and accountNames instead (kept for backwards compatibility during editing)accountPaths: z.string().array()- .min(1, "Must have at least one account path").refine((val) => val.every((path) => path.length > 0), {message: "All account paths must be non-empty"})@@ -41,7 +41,24 @@ export const PolicyFormSchema = z.object({.refine((val) => val.every((path) => !path.endsWith("/")), {message: "All account paths cannot end with /"})+ .optional(),+ // New fields for matching (independent criteria, AND logic when both defined)+ resourceNames: z.string().array().optional(),+ accountNames: z.string().array().optional()})+ .refine(+ (data) => {+ // At least one condition type must be provided+ const hasAccountPaths = data.accountPaths && data.accountPaths.length > 0;+ const hasResourceNames = data.resourceNames && data.resourceNames.length > 0;+ const hasAccountNames = data.accountNames && data.accountNames.length > 0;+ return hasAccountPaths || hasResourceNames || hasAccountNames;+ },+ {+ message:+ "At least one condition type must be provided (Resource Names, Account Names, or Account Paths)"+ }+ ).array().min(1, "At least one condition is required"),constraints: z.object({diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsxindex c6f4a3878f..b58ad32a9e 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx@@ -5,8 +5,16 @@ import { FormControl, Input } from "@app/components/v2";import { TPolicyForm } from "../PolicySchema";-export const PolicyDetailsStep = () => {- const { control } = useFormContext<TPolicyForm>();+type Props = {+ isEditing?: boolean;+ hasLegacyAccountPaths?: boolean;+};++export const PolicyDetailsStep = ({ isEditing, hasLegacyAccountPaths }: Props) => {+ const { control, formState } = useFormContext<TPolicyForm>();++ // Show account paths only if editing an existing policy that already has account paths+ const showAccountPaths = isEditing && hasLegacyAccountPaths;return (<div className="flex flex-col gap-4">@@ -45,25 +53,73 @@ export const PolicyDetailsStep = () => {<Controllercontrol={control}- name="conditions.0.accountPaths"- render={({ field: pathField, fieldState: { error } }) => (+ name="conditions.0.resourceNames"+ render={({ field: resourceField, fieldState: { error } }) => (+ <FormControl+ className="mb-0"+ label="Resource Names"+ isError={Boolean(error)}+ errorText={error?.message ?? formState.errors.conditions?.[0]?.message}+ helperText="Match accounts on resources with these names (supports glob patterns)"+ >+ <Input+ value={resourceField.value?.join(",") ?? ""}+ onChange={(e) => {+ const { value } = e.target;+ resourceField.onChange(value ? value.split(",").map((name) => name.trim()) : []);+ }}+ placeholder="e.g., prod-*, staging-db, *"+ />+ </FormControl>+ )}+ />++ <Controller+ control={control}+ name="conditions.0.accountNames"+ render={({ field: accountField, fieldState: { error } }) => (<FormControl- isRequired- label="Account Paths"+ className="mb-0"+ label="Account Names"isError={Boolean(error)}errorText={error?.message}- helperText="Policy matches any of these comma-separated account paths"+ helperText="Match accounts with these names (supports glob patterns)"><Input- value={pathField.value.join(",")}+ value={accountField.value?.join(",") ?? ""}onChange={(e) => {- pathField.onChange(e.target.value.split(",").map((path) => path.trim()));+ const { value } = e.target;+ accountField.onChange(value ? value.split(",").map((name) => name.trim()) : []);}}- placeholder="e.g., /admin/**, /users/john, /**"+ placeholder="e.g., admin-*, readonly, *"/></FormControl>)}/>+ {showAccountPaths && (+ <Controller+ control={control}+ name="conditions.0.accountPaths"+ render={({ field: pathField, fieldState: { error } }) => (+ <FormControl+ className="mb-0"+ label="Account Paths (Legacy)"+ isError={Boolean(error)}+ errorText={error?.message}+ helperText="Deprecated: This field is kept for backwards compatibility. Consider migrating to Resource Names or Account Names"+ >+ <Input+ value={pathField.value?.join(",") ?? ""}+ onChange={(e) => {+ const { value } = e.target;+ pathField.onChange(value ? value.split(",").map((path) => path.trim()) : []);+ }}+ placeholder="e.g., /admin/**, /users/john, /**"+ />+ </FormControl>+ )}+ />+ )}</div>);};diff --git a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsxindex 8caf65eea6..f9e0bf3206 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyReviewStep.tsx@@ -16,7 +16,11 @@ const ReviewField = ({ label, value }: { label: string; value: string | number }</div>);-export const PolicyReviewStep = () => {+type Props = {+ hasLegacyAccountPaths?: boolean;+};++export const PolicyReviewStep = ({ hasLegacyAccountPaths }: Props) => {const { watch } = useFormContext<TPolicyForm>();const { currentProject } = useProject();const projectId = currentProject?.id || "";@@ -41,6 +45,10 @@ export const PolicyReviewStep = () => {return approverId;};+ const resourceNames = conditions[0]?.resourceNames || [];+ const accountNames = conditions[0]?.accountNames || [];+ const accountPaths = conditions[0]?.accountPaths || [];+return (<div className="space-y-6"><div>@@ -50,12 +58,18 @@ export const PolicyReviewStep = () => {<div className="grid grid-cols-2 gap-2"><ReviewField label="Policy Name" value={name || "Not set"} /><ReviewField label="Max. Access Duration" value={constraints.accessDuration.max} />- <ReviewField- label="Account Paths"- value={- conditions[0].accountPaths.length ? conditions[0].accountPaths.join(",") : "Not set"- }- />+ {resourceNames.length > 0 && (+ <ReviewField label="Resource Names" value={resourceNames.join(", ")} />+ )}+ {accountNames.length > 0 && (+ <ReviewField label="Account Names" value={accountNames.join(", ")} />+ )}+ {resourceNames.length === 0 && accountNames.length === 0 && !hasLegacyAccountPaths && (+ <ReviewField label="Conditions" value="Not set" />+ )}+ {hasLegacyAccountPaths && accountPaths.length > 0 && (+ <ReviewField label="Account Paths (Legacy)" value={accountPaths.join(", ")} />+ )}</div></div>diff --git a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsxindex 656d05d8b1..471fc19797 100644--- a/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx+++ b/frontend/src/pages/pam/ApprovalsPage/components/RequestGrantTab/RequestGrantTab.tsx@@ -119,9 +119,12 @@ export const RequestGrantTab = () => {if (search) {filtered = filtered.filter((grant) => {if (grant.type !== ApprovalPolicyType.PamAccess) return false;+ const searchLower = search.toLowerCase();return (- grant.attributes.accountPath.toLowerCase().includes(search.toLowerCase()) ||- grant.id.toLowerCase().includes(search.toLowerCase())+ grant.attributes.accountPath?.toLowerCase().includes(searchLower) ||+ grant.attributes.resourceName?.toLowerCase().includes(searchLower) ||+ grant.attributes.accountName?.toLowerCase().includes(searchLower) ||+ grant.id.toLowerCase().includes(searchLower));});}@@ -273,7 +276,7 @@ export const RequestGrantTab = () => {<THead><Tr><Th>User</Th>- <Th>Account Path</Th>+ <Th>Account</Th><Th>Access Duration</Th><Th>Status</Th><Th>Granted</Th>@@ -294,7 +297,28 @@ export const RequestGrantTab = () => {{grant.granteeUserId ? getGrantedUser(grant.granteeUserId) : "Unknown"}</Td><Td>- <div>{grant.attributes.accountPath}</div>+ <div className="space-y-0.5">+ {grant.attributes.resourceName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Resource:</span>{" "}+ {grant.attributes.resourceName}+ </div>+ )}+ {grant.attributes.accountName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Account:</span>{" "}+ {grant.attributes.accountName}+ </div>+ )}+ {grant.attributes.accountPath &&+ !grant.attributes.resourceName &&+ !grant.attributes.accountName && (+ <div className="text-sm text-mineshaft-200">+ <span className="text-mineshaft-400">Path:</span>{" "}+ {grant.attributes.accountPath}+ </div>+ )}+ </div></Td><Td><span className="text-sm text-mineshaft-200">diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsxindex 884d064704..c1f177126c 100644--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx+++ b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx@@ -98,12 +98,19 @@ const PageContent = () => {policyType: ApprovalPolicyType.PamAccess,projectId: projectId!,inputs: {- accountPath: fullAccountPath+ accountPath: fullAccountPath,+ resourceName: account.resource.name,+ accountName: account.name}});if (requiresApproval) {- handlePopUpOpen("requestAccount", { accountPath: fullAccountPath, accountAccessed: true });+ handlePopUpOpen("requestAccount", {+ accountPath: fullAccountPath,+ resourceName: account.resource.name,+ accountName: account.name,+ accountAccessed: true+ });return;}@@ -232,6 +239,8 @@ const PageContent = () => {isOpen={popUp.requestAccount.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("requestAccount", isOpen)}accountPath={popUp.requestAccount.data?.accountPath}+ resourceName={popUp.requestAccount.data?.resourceName}+ accountName={popUp.requestAccount.data?.accountName}accountAccessed={popUp.requestAccount.data?.accountAccessed}/>diff --git a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsxdeleted file mode 100644index 70c964c322..0000000000--- a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx+++ /dev/null@@ -1,39 +0,0 @@-import { Helmet } from "react-helmet";-import { useTranslation } from "react-i18next";--import { ProjectPermissionCan } from "@app/components/permissions";-import { PageHeader } from "@app/components/v2";-import { ProjectPermissionSub } from "@app/context";-import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";-import { ProjectType } from "@app/hooks/api/projects/types";--import { PamAccountsSection } from "./components/PamAccountsSection";--export const PamAccountsPage = () => {- const { t } = useTranslation();- return (- <>- <Helmet>- <title>{t("common.head-title", { title: "PAM" })}</title>- </Helmet>- <ProjectPermissionCan- renderGuardBanner- I={ProjectPermissionPamAccountActions.Read}- a={ProjectPermissionSub.PamAccounts}- >- <div className="h-full bg-bunker-800">- <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">- <div className="mx-auto mb-6 w-full max-w-8xl">- <PageHeader- scope={ProjectType.PAM}- title="Accounts"- description="View, access, and manage accounts."- />- <PamAccountsSection />- </div>- </div>- </div>- </ProjectPermissionCan>- </>- );-};diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountsTable.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountsTable.tsxindex 4eb73e8f8e..bcc594b8c5 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountsTable.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountsTable.tsx@@ -245,13 +245,20 @@ export const PamAccountsTable = ({ projectId }: Props) => {policyType: ApprovalPolicyType.PamAccess,projectId,inputs: {- accountPath: fullAccountPath+ accountPath: fullAccountPath,+ resourceName: account.resource.name,+ accountName: account.name}});if (requiresApproval) {- // Open request access modal with pre-populated path- handlePopUpOpen("requestAccount", { accountPath: fullAccountPath, accountAccessed: true });+ // Open request access modal with pre-populated data+ handlePopUpOpen("requestAccount", {+ accountPath: fullAccountPath,+ resourceName: account.resource.name,+ accountName: account.name,+ accountAccessed: true+ });return;}@@ -556,6 +563,8 @@ export const PamAccountsTable = ({ projectId }: Props) => {isOpen={popUp.requestAccount.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("requestAccount", isOpen)}accountPath={popUp.requestAccount.data?.accountPath}+ resourceName={popUp.requestAccount.data?.resourceName}+ accountName={popUp.requestAccount.data?.accountName}accountAccessed={popUp.requestAccount.data?.accountAccessed}/><PamDeleteAccountModaldiff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsxindex 1feafedce8..e3a1b92fdc 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamRequestAccountAccessModal.tsx@@ -22,6 +22,8 @@ import { useCreateApprovalRequest } from "@app/hooks/api/approvalRequests/mutatitype Props = {accountPath?: string;+ resourceName?: string;+ accountName?: string;accountAccessed?: boolean;isOpen: boolean;onOpenChange: (isOpen: boolean) => void;@@ -30,13 +32,13 @@ type Props = {const formSchema = z.object({accountPath: z.string()- .min(1, "Account path is required")- .refine((el) => el.startsWith("/"), {+ .refine((el) => !el || el.startsWith("/"), {message: "Path must start with /"})- .refine((el) => !el.endsWith("/"), {+ .refine((el) => !el || !el.endsWith("/"), {message: "Path cannot end with /"- }),+ })+ .optional(),accessDuration: z.string().min(1, "Access duration is required")@@ -56,7 +58,13 @@ const formSchema = z.object({type FormData = z.infer<typeof formSchema>;-const Content = ({ onOpenChange, accountPath, accountAccessed }: Props) => {+const Content = ({+ onOpenChange,+ accountPath,+ resourceName,+ accountName,+ accountAccessed+}: Props) => {const { projectId } = useProject();const { mutateAsync: createApprovalRequest, isPending: isSubmitting } =useCreateApprovalRequest();@@ -84,8 +92,10 @@ const Content = ({ onOpenChange, accountPath, accountAccessed }: Props) => {projectId,justification: formData.justification || null,requestData: {- accountPath: formData.accountPath,- accessDuration: formData.accessDuration+ accessDuration: formData.accessDuration,+ ...(formData.accountPath && { accountPath: formData.accountPath }),+ ...(resourceName && { resourceName }),+ ...(accountName && { accountName })}});@@ -104,6 +114,8 @@ const Content = ({ onOpenChange, accountPath, accountAccessed }: Props) => {}};+ const showAccountDetails = accountAccessed && resourceName && accountName;+return (<form onSubmit={handleSubmit(onSubmit)}>{accountAccessed && (@@ -115,21 +127,36 @@ const Content = ({ onOpenChange, accountPath, accountAccessed }: Props) => {</UnstableAlertDescription></UnstableAlert>)}- <Controller- name="accountPath"- control={control}- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- helperText="Account path including the account name. Supports glob patterns (e.g., /folder/**, /*/account-name)"- errorText={error?.message}- isError={Boolean(error?.message)}- label="Account Path"- >- <Input autoFocus placeholder="/folder/account-name" {...field} />- </FormControl>- )}- />+ {showAccountDetails ? (+ <div className="mb-4 rounded-md border border-mineshaft-600 bg-mineshaft-700/50 p-3">+ <div className="grid grid-cols-2 gap-4">+ <div>+ <span className="text-xs text-mineshaft-400">Resource</span>+ <p className="text-sm text-mineshaft-100">{resourceName}</p>+ </div>+ <div>+ <span className="text-xs text-mineshaft-400">Account</span>+ <p className="text-sm text-mineshaft-100">{accountName}</p>+ </div>+ </div>+ </div>+ ) : (+ <Controller+ name="accountPath"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ isRequired+ helperText="Account path including the account name. Supports glob patterns (e.g., /folder/**, /*/account-name)"+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Account Path"+ >+ <Input autoFocus placeholder="/folder/account-name" {...field} />+ </FormControl>+ )}+ />+ )}<Controllername="accessDuration"control={control}@@ -179,15 +206,16 @@ const Content = ({ onOpenChange, accountPath, accountAccessed }: Props) => {};export const PamRequestAccountAccessModal = (props: Props) => {- const { isOpen, onOpenChange } = props;+ const { isOpen, onOpenChange, accountAccessed, resourceName, accountName } = props;++ const subTitle =+ accountAccessed && resourceName && accountName+ ? "Request access to a protected account"+ : "Request access to an account path";return (<Modal isOpen={isOpen} onOpenChange={onOpenChange}>- <ModalContent- className="max-w-2xl pb-2"- title="Request Account Access"- subTitle="Request access to an account path"- >+ <ModalContent className="max-w-2xl pb-2" title="Request Account Access" subTitle={subTitle}><Content {...props} /></ModalContent></Modal>diff --git a/frontend/src/pages/pam/PamAccountsPage/route.tsx b/frontend/src/pages/pam/PamAccountsPage/route.tsxdeleted file mode 100644index 2cec10245b..0000000000--- a/frontend/src/pages/pam/PamAccountsPage/route.tsx+++ /dev/null@@ -1,50 +0,0 @@-import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";-import { zodValidator } from "@tanstack/zod-adapter";-import { z } from "zod";--import { PamAccountView } from "@app/hooks/api/pam";--import { PamAccountsPage } from "./PamAccountsPage";--const PamAccountsPageQueryParamsSchema = z.object({- search: z.string().optional(),- accountView: z.nativeEnum(PamAccountView).optional(),- accountPath: z.string().catch("/")-});--export const Route = createFileRoute(- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/"-)({- validateSearch: zodValidator(PamAccountsPageQueryParamsSchema),- search: {- middlewares: [stripSearchParams({ accountPath: "/" })]- },- beforeLoad: ({ context, params, search }) => {- const accountPathSegments = search.accountPath.split("/").filter(Boolean);- return {- breadcrumbs: [- ...context.breadcrumbs,- {- label: "Accounts",- link: linkOptions({- to: "/organizations/$orgId/projects/pam/$projectId/accounts",- params: () => params as never,- search: (prev) => ({ ...prev, accountPath: "/" })- })- },- ...accountPathSegments.map((segment, index) => {- const newPath = `/${accountPathSegments.slice(0, index + 1).join("/")}/`;- return {- label: segment,- link: linkOptions({- to: "/organizations/$orgId/projects/pam/$projectId/accounts",- params: () => params as never,- search: (prev) => ({ ...prev, accountPath: newPath })- })- };- })- ]- };- },- component: PamAccountsPage-});diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsxindex 8550b0b862..d02549c298 100644--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx@@ -110,12 +110,19 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {policyType: ApprovalPolicyType.PamAccess,projectId: projectId!,inputs: {- accountPath: fullAccountPath+ accountPath: fullAccountPath,+ resourceName: resource.name,+ accountName: account.name}});if (requiresApproval) {- handlePopUpOpen("requestAccount", { accountPath: fullAccountPath, accountAccessed: true });+ handlePopUpOpen("requestAccount", {+ accountPath: fullAccountPath,+ resourceName: resource.name,+ accountName: account.name,+ accountAccessed: true+ });return;}@@ -353,6 +360,8 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {isOpen={popUp.requestAccount.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("requestAccount", isOpen)}accountPath={popUp.requestAccount.data?.accountPath}+ resourceName={popUp.requestAccount.data?.resourceName}+ accountName={popUp.requestAccount.data?.accountName}accountAccessed={popUp.requestAccount.data?.accountAccessed}/>diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex 56d27c21bf..f7472f917f 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -174,7 +174,6 @@ import { Route as secretScanningSecretScanningDataSourcesPageRouteImport } fromimport { Route as secretManagerIntegrationsListPageRouteImport } from './pages/secret-manager/IntegrationsListPage/route'import { Route as pamPamSessionsPageRouteImport } from './pages/pam/PamSessionsPage/route'import { Route as pamPamResourcesPageRouteImport } from './pages/pam/PamResourcesPage/route'-import { Route as pamPamAccountsPageRouteImport } from './pages/pam/PamAccountsPage/route'import { Route as certManagerPkiSubscribersPageRouteImport } from './pages/cert-manager/PkiSubscribersPage/route'import { Route as certManagerIntegrationsListPageRouteImport } from './pages/cert-manager/IntegrationsListPage/route'import { Route as certManagerPkiTemplateListPageRouteImport } from './pages/cert-manager/PkiTemplateListPage/route'@@ -1728,13 +1727,6 @@ const pamPamResourcesPageRouteRoute = pamPamResourcesPageRouteImport.update({AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute,} as any)-const pamPamAccountsPageRouteRoute = pamPamAccountsPageRouteImport.update({- id: '/',- path: '/',- getParentRoute: () =>- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsRoute,-} as any)-const certManagerPkiSubscribersPageRouteRoute =certManagerPkiSubscribersPageRouteImport.update({id: '/',@@ -3431,13 +3423,6 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof certManagerPkiSubscribersPageRouteImportparentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdCertManagerLayoutSubscribersImport}- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/': {- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/'- path: '/'- fullPath: '/organizations/$orgId/projects/pam/$projectId/accounts/'- preLoaderRoute: typeof pamPamAccountsPageRouteImport- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsImport- }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'path: '/'@@ -4614,13 +4599,11 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsKmsProjectI)interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsRouteChildren {- pamPamAccountsPageRouteRoute: typeof pamPamAccountsPageRouteRoutepamPamAccountByIDPageRouteRoute: typeof pamPamAccountByIDPageRouteRoute}const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsRouteChildren ={- pamPamAccountsPageRouteRoute: pamPamAccountsPageRouteRoute,pamPamAccountByIDPageRouteRoute: pamPamAccountByIDPageRouteRoute,}@@ -5671,7 +5654,6 @@ export interface FileRoutesByFullPath {'/organizations/$orgId/projects/cert-manager/$projectId/certificate-templates/': typeof certManagerPkiTemplateListPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/integrations/': typeof certManagerIntegrationsListPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute- '/organizations/$orgId/projects/pam/$projectId/accounts/': typeof pamPamAccountsPageRouteRoute'/organizations/$orgId/projects/pam/$projectId/resources/': typeof pamPamResourcesPageRouteRoute'/organizations/$orgId/projects/pam/$projectId/sessions/': typeof pamPamSessionsPageRouteRoute'/organizations/$orgId/projects/secret-management/$projectId/integrations/': typeof secretManagerIntegrationsListPageRouteRoute@@ -5909,6 +5891,7 @@ export interface FileRoutesByTo {'/organizations/$orgId/projects/kms/$projectId/access-management': typeof projectAccessControlPageRouteKmsRoute'/organizations/$orgId/projects/kms/$projectId/audit-logs': typeof projectAuditLogsPageRouteKmsRoute'/organizations/$orgId/projects/pam/$projectId/access-management': typeof projectAccessControlPageRoutePamRoute+ '/organizations/$orgId/projects/pam/$projectId/accounts': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutAccountsRouteWithChildren'/organizations/$orgId/projects/pam/$projectId/audit-logs': typeof projectAuditLogsPageRoutePamRoute'/organizations/$orgId/projects/secret-management/$projectId/access-management': typeof projectAccessControlPageRouteSecretManagerRoute'/organizations/$orgId/projects/secret-management/$projectId/app-connections': typeof projectAppConnectionsPageRouteSecretManagerRoute@@ -5921,7 +5904,6 @@ export interface FileRoutesByTo {'/organizations/$orgId/projects/cert-manager/$projectId/certificate-templates': typeof certManagerPkiTemplateListPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/integrations': typeof certManagerIntegrationsListPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/subscribers': typeof certManagerPkiSubscribersPageRouteRoute- '/organizations/$orgId/projects/pam/$projectId/accounts': typeof pamPamAccountsPageRouteRoute'/organizations/$orgId/projects/pam/$projectId/resources': typeof pamPamResourcesPageRouteRoute'/organizations/$orgId/projects/pam/$projectId/sessions': typeof pamPamSessionsPageRouteRoute'/organizations/$orgId/projects/secret-management/$projectId/integrations': typeof secretManagerIntegrationsListPageRouteRoute@@ -6197,7 +6179,6 @@ export interface FileRoutesById {'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/certificate-templates/': typeof certManagerPkiTemplateListPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/': typeof certManagerIntegrationsListPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/': typeof pamPamAccountsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': typeof pamPamResourcesPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/': typeof pamPamSessionsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/': typeof secretManagerIntegrationsListPageRouteRoute@@ -6464,7 +6445,6 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/cert-manager/$projectId/certificate-templates/'| '/organizations/$orgId/projects/cert-manager/$projectId/integrations/'| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/'- | '/organizations/$orgId/projects/pam/$projectId/accounts/'| '/organizations/$orgId/projects/pam/$projectId/resources/'| '/organizations/$orgId/projects/pam/$projectId/sessions/'| '/organizations/$orgId/projects/secret-management/$projectId/integrations/'@@ -6701,6 +6681,7 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/kms/$projectId/access-management'| '/organizations/$orgId/projects/kms/$projectId/audit-logs'| '/organizations/$orgId/projects/pam/$projectId/access-management'+ | '/organizations/$orgId/projects/pam/$projectId/accounts'| '/organizations/$orgId/projects/pam/$projectId/audit-logs'| '/organizations/$orgId/projects/secret-management/$projectId/access-management'| '/organizations/$orgId/projects/secret-management/$projectId/app-connections'@@ -6713,7 +6694,6 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/cert-manager/$projectId/certificate-templates'| '/organizations/$orgId/projects/cert-manager/$projectId/integrations'| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers'- | '/organizations/$orgId/projects/pam/$projectId/accounts'| '/organizations/$orgId/projects/pam/$projectId/resources'| '/organizations/$orgId/projects/pam/$projectId/sessions'| '/organizations/$orgId/projects/secret-management/$projectId/integrations'@@ -6987,7 +6967,6 @@ export interface FileRouteTypes {| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/certificate-templates/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/'- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/'@@ -7910,7 +7889,6 @@ export const routeTree = rootRoute"filePath": "","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout","children": [- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/$accountId"]},@@ -8070,10 +8048,6 @@ export const routeTree = rootRoute"filePath": "cert-manager/PkiSubscribersPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers"},- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts/": {- "filePath": "pam/PamAccountsPage/route.tsx",- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/accounts"- },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/": {"filePath": "pam/PamResourcesPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources"diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex 0456ab117a..6a257f82d3 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -371,10 +371,7 @@ const secretScanningRoutes = route("/organizations/$orgId/projects/secret-scanniconst pamRoutes = route("/organizations/$orgId/projects/pam/$projectId", [layout("pam-layout", "pam/layout.tsx", [- route("/accounts", [- index("pam/PamAccountsPage/route.tsx"),- route("/$accountId", "pam/PamAccountByIDPage/route.tsx")- ]),+ route("/accounts", [route("/$accountId", "pam/PamAccountByIDPage/route.tsx")]),route("/sessions", [index("pam/PamSessionsPage/route.tsx"),route("/$sessionId", "pam/PamSessionsByIDPage/route.tsx")