Skip to content

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

chore: more feedback

Sheen Capadnganb0d6e9c2cd34
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index 926ba4d8bf..633a201455 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -1314,44 +1314,60 @@ export const pamAccountServiceFactory = ({
};
const triggerManualRotation = async (accountId: string, actor: OrgServiceActor) => {
- const account = await pamAccountDAL.findById(accountId);
- if (!account) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
-
- const resource = await pamResourceDAL.findById(account.resourceId);
- if (!resource) throw new NotFoundError({ message: `Resource not found` });
+ const accountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
+ if (!accountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
const { permission } = await permissionService.getProjectPermission({
actor: actor.type,
actorAuthMethod: actor.authMethod,
actorId: actor.id,
actorOrgId: actor.orgId,
- projectId: account.projectId,
+ projectId: accountWithResource.projectId,
actionProjectType: ActionProjectType.PAM
});
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.TriggerRotation,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: resource.name,
- accountName: account.name
+ resourceName: accountWithResource.resource.name,
+ accountName: accountWithResource.name
})
);
- if (!resource.encryptedRotationAccountCredentials) {
+ if (!accountWithResource.resource.encryptedRotationAccountCredentials) {
throw new BadRequestError({ message: "Rotation credentials are not configured on this resource" });
}
// Immediate check. There's an actual atomic lock in rotateAccount
- if (account.rotationStatus === PamAccountRotationStatus.Rotating) {
+ if (accountWithResource.rotationStatus === PamAccountRotationStatus.Rotating) {
throw new BadRequestError({ message: "Account is already being rotated" });
}
- await rotateAccount(account);
+ await rotateAccount(accountWithResource);
- const updatedAccount = await pamAccountDAL.findById(accountId);
- if (!updatedAccount) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const updatedAccountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
+ if (!updatedAccountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
- return updatedAccount;
+ const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([updatedAccountWithResource.id]);
+ const accountMetadata = metadataByAccountId[updatedAccountWithResource.id] || [];
+
+ const decryptedAccount = await decryptAccount(
+ updatedAccountWithResource,
+ updatedAccountWithResource.projectId,
+ kmsService
+ );
+
+ return {
+ ...decryptedAccount,
+ metadata: accountMetadata,
+ resourceType: updatedAccountWithResource.resource.resourceType,
+ resource: {
+ id: updatedAccountWithResource.resource.id,
+ name: updatedAccountWithResource.resource.name,
+ resourceType: updatedAccountWithResource.resource.resourceType,
+ rotationCredentialsConfigured: !!updatedAccountWithResource.resource.encryptedRotationAccountCredentials
+ }
+ };
};
return {
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx
index 012acfebf5..97b3370549 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/GenericAccountFields.tsx
@@ -43,7 +43,7 @@ export const GenericAccountFields = () => {
{...field}
autoFocus
isError={Boolean(error)}
- placeholder="my-discovery-source"
+ placeholder="my-account-name"
/>
</div>
<FieldError errors={[error]} />
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx
index a920b7db76..65a8d7724e 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/rotation-policy/RotationRuleCard.tsx
@@ -96,19 +96,19 @@ export const RotationRuleCard = ({
<Label className="opacity-50">Do Not Rotate</Label>
)}
</div>
- <div className="flex gap-2">
- <Field className="w-2/5 shrink-0">
- <FieldLabel>Rule Name</FieldLabel>
- <FieldContent>
- <UnstableInput
- value={localName}
- onChange={(e) => setLocalName(e.target.value)}
- onBlur={handleNameBlur}
- placeholder="e.g., Service accounts"
- />
- </FieldContent>
- </Field>
- <Field>
+ <Field>
+ <FieldLabel>Rule Name</FieldLabel>
+ <FieldContent>
+ <UnstableInput
+ value={localName}
+ onChange={(e) => setLocalName(e.target.value)}
+ onBlur={handleNameBlur}
+ placeholder="e.g., Service accounts"
+ />
+ </FieldContent>
+ </Field>
+ <div className="flex gap-4">
+ <Field className="flex-1">
<FieldLabel>Account Name Pattern</FieldLabel>
<FieldContent>
<UnstableInput
@@ -121,7 +121,7 @@ export const RotationRuleCard = ({
</FieldContent>
</Field>
{rule.enabled && (
- <Field>
+ <Field className="w-40">
<FieldLabel>Interval (days)</FieldLabel>
<FieldContent>
<UnstableInput
@@ -135,7 +135,7 @@ export const RotationRuleCard = ({
</div>
</div>
- <div className="flex flex-col gap-1">
+ <div className="flex flex-col items-center justify-center gap-1">
<UnstableIconButton variant="ghost" size="xs" onClick={onDelete}>
<TrashIcon className="text-danger" />
</UnstableIconButton>