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
Merge branch 'main' into feat/point-in-time-revamp
carlosmonastyrski034a8112b7ea
diff --cc backend/src/ee/services/audit-log/audit-log-types.tsindex 2c97bd2c0d,e4874619be..c1c046101f--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@@ -377,13 -377,11 +377,19 @@@ export enum EventTypePROJECT_ASSUME_PRIVILEGE_SESSION_START = "project-assume-privileges-session-start",PROJECT_ASSUME_PRIVILEGE_SESSION_END = "project-assume-privileges-session-end",+ GET_PROJECT_PIT_COMMITS = "get-project-pit-commits",+ GET_PROJECT_PIT_COMMIT_CHANGES = "get-project-pit-commit-changes",+ GET_PROJECT_PIT_COMMIT_COUNT = "get-project-pit-commit-count",+ PIT_ROLLBACK_COMMIT = "pit-rollback-commit",+ PIT_REVERT_COMMIT = "pit-revert-commit",+ PIT_GET_FOLDER_STATE = "pit-get-folder-state",- PIT_COMPARE_FOLDER_STATES = "pit-compare-folder-states"++ PIT_COMPARE_FOLDER_STATES = "pit-compare-folder-states",+++ UPDATE_ORG = "update-org",++ CREATE_PROJECT = "create-project",+ UPDATE_PROJECT = "update-project",+ DELETE_PROJECT = "delete-project"}export const filterableSecretEvents: EventType[] = [@@@ -2921,75 -2911,56 +2919,128 @@@ interface MicrosoftTeamsWorkflowIntegra};}+interface GetProjectPitCommitsEvent {+ type: EventType.GET_PROJECT_PIT_COMMITS;+ metadata: {+ commitCount: string;+ environment: string;+ path: string;+ offset: string;+ limit: string;+ search?: string;+ sort: string;+ };+}++interface GetProjectPitCommitChangesEvent {+ type: EventType.GET_PROJECT_PIT_COMMIT_CHANGES;+ metadata: {+ changesCount: string;+ commitId: string;+ };+}++interface GetProjectPitCommitCountEvent {+ type: EventType.GET_PROJECT_PIT_COMMIT_COUNT;+ metadata: {+ environment: string;+ path: string;+ commitCount: string;+ };+}++interface PitRollbackCommitEvent {+ type: EventType.PIT_ROLLBACK_COMMIT;+ metadata: {+ targetCommitId: string;+ folderId: string;+ deepRollback: boolean;+ message: string;+ totalChanges: string;+ environment: string;+ };+}++interface PitRevertCommitEvent {+ type: EventType.PIT_REVERT_COMMIT;+ metadata: {+ commitId: string;+ revertCommitId?: string;+ changesReverted?: string;+ };+}++interface PitGetFolderStateEvent {+ type: EventType.PIT_GET_FOLDER_STATE;+ metadata: {+ commitId: string;+ folderId: string;+ resourceCount: string;+ };+}++interface PitCompareFolderStatesEvent {+ type: EventType.PIT_COMPARE_FOLDER_STATES;+ metadata: {+ targetCommitId: string;+ folderId: string;+ deepRollback: boolean;+ diffsCount: string;+ environment: string;+ folderPath: string;++ }++}+++ interface OrgUpdateEvent {+ type: EventType.UPDATE_ORG;+ metadata: {+ name?: string;+ slug?: string;+ authEnforced?: boolean;+ scimEnabled?: boolean;+ defaultMembershipRoleSlug?: string;+ enforceMfa?: boolean;+ selectedMfaMethod?: string;+ allowSecretSharingOutsideOrganization?: boolean;+ bypassOrgAuthEnabled?: boolean;+ userTokenExpiration?: string;+ secretsProductEnabled?: boolean;+ pkiProductEnabled?: boolean;+ kmsProductEnabled?: boolean;+ sshProductEnabled?: boolean;+ scannerProductEnabled?: boolean;+ shareSecretsProductEnabled?: boolean;+ };+ }++ interface ProjectCreateEvent {+ type: EventType.CREATE_PROJECT;+ metadata: {+ name: string;+ slug?: string;+ type: ProjectType;+ };+ }++ interface ProjectUpdateEvent {+ type: EventType.UPDATE_PROJECT;+ metadata: {+ name?: string;+ description?: string;+ autoCapitalization?: boolean;+ hasDeleteProtection?: boolean;+ slug?: string;+ secretSharing?: boolean;+ pitVersionLimit?: number;+ auditLogsRetentionDays?: number;+ };+ }++ interface ProjectDeleteEvent {+ type: EventType.DELETE_PROJECT;+ metadata: {+ id: string;+ name: string;};}@@@ -3260,10 -3230,7 +3310,14 @@@ export type Event| MicrosoftTeamsWorkflowIntegrationGetEvent| MicrosoftTeamsWorkflowIntegrationListEvent| MicrosoftTeamsWorkflowIntegrationUpdateEvent+ | GetProjectPitCommitsEvent+ | GetProjectPitCommitChangesEvent+ | PitRollbackCommitEvent+ | GetProjectPitCommitCountEvent+ | PitRevertCommitEvent+ | PitCompareFolderStatesEvent- | PitGetFolderStateEvent;++ | PitGetFolderStateEvent+ | OrgUpdateEvent+ | ProjectCreateEvent+ | ProjectUpdateEvent+ | ProjectDeleteEvent;diff --cc backend/src/ee/services/permission/default-roles.tsindex aceeec3dd3,2a422d55fc..f7ca2abcf0--- a/backend/src/ee/services/permission/default-roles.ts+++ b/backend/src/ee/services/permission/default-roles.ts@@@ -2,9 -2,9 +2,10 @@@ import { AbilityBuilder, createMongoAbiimport {ProjectPermissionActions,+ ProjectPermissionApprovalActions,ProjectPermissionCertificateActions,ProjectPermissionCmekActions,+ ProjectPermissionCommitsActions,ProjectPermissionDynamicSecretActions,ProjectPermissionGroupActions,ProjectPermissionIdentityActions,@@@ -249,12 -255,7 +261,12 @@@ const buildMemberPermissionRules = () =ProjectPermissionSub.SecretImports);+ can(+ [ProjectPermissionCommitsActions.Read, ProjectPermissionCommitsActions.PerformRollback],+ ProjectPermissionSub.Commits+ );+- can([ProjectPermissionActions.Read], ProjectPermissionSub.SecretApproval);+ can([ProjectPermissionApprovalActions.Read], ProjectPermissionSub.SecretApproval);can([ProjectPermissionSecretRotationActions.Read], ProjectPermissionSub.SecretRotation);can([ProjectPermissionActions.Read, ProjectPermissionActions.Create], ProjectPermissionSub.SecretRollback);diff --cc backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.tsindex 0a7a5c12c7,352c99b2c0..4e66a70230--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts@@@ -903,77 -893,77 +909,81 @@@ export const secretRotationV2ServiceFackmsService);- const updatedRotation = await rotationFactory.rotateCredentials(inactiveCredentials, async (newCredentials) => {- const updatedCredentials = [...generatedCredentials];- updatedCredentials[inactiveIndex] = newCredentials;-- const encryptedUpdatedCredentials = await encryptSecretRotationCredentials({- projectId,- generatedCredentials: updatedCredentials as TSecretRotationV2GeneratedCredentials,- kmsService- });+ const updatedRotation = await rotationFactory.rotateCredentials(+ inactiveCredentials,+ async (newCredentials) => {+ const updatedCredentials = [...generatedCredentials];+ updatedCredentials[inactiveIndex] = newCredentials;- return secretRotationV2DAL.transaction(async (tx) => {- const secretsPayload = rotationFactory.getSecretsPayload(newCredentials);-- const { encryptor } = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.SecretManager,- projectId+ const encryptedUpdatedCredentials = await encryptSecretRotationCredentials({+ projectId,+ generatedCredentials: updatedCredentials as TSecretRotationV2GeneratedCredentials,+ kmsService});- // update mapped secrets with new credential values- await fnSecretBulkUpdate({- folderId,- orgId: connection.orgId,- tx,- inputSecrets: secretsPayload.map(({ key, value }) => ({- filter: {- key,- folderId,- type: SecretType.Shared+ return secretRotationV2DAL.transaction(async (tx) => {+ const secretsPayload = rotationFactory.getSecretsPayload(newCredentials);++ const { encryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.SecretManager,+ projectId+ });++ // update mapped secrets with new credential values+ await fnSecretBulkUpdate({+ folderId,+ orgId: connection.orgId,+ tx,+ inputSecrets: secretsPayload.map(({ key, value }) => ({+ filter: {+ key,+ folderId,+ type: SecretType.Shared+ },+ data: {+ encryptedValue: encryptor({+ plainText: Buffer.from(value)+ }).cipherTextBlob,+ references: []+ }+ })),+ secretDAL: secretV2BridgeDAL,+ secretVersionDAL: secretVersionV2BridgeDAL,+ secretVersionTagDAL: secretVersionTagV2BridgeDAL,++ folderCommitService,++ actor: {++ type: ActorType.PLATFORM+ },- data: {- encryptedValue: encryptor({- plainText: Buffer.from(value)- }).cipherTextBlob,- references: []- }- })),- secretDAL: secretV2BridgeDAL,- secretVersionDAL: secretVersionV2BridgeDAL,- secretVersionTagDAL: secretVersionTagV2BridgeDAL,- folderCommitService,- actor: {- type: ActorType.PLATFORM- },- secretTagDAL,- resourceMetadataDAL- });-- const currentTime = new Date();-- return secretRotationV2DAL.updateById(- secretRotation.id,- {- encryptedGeneratedCredentials: encryptedUpdatedCredentials,- activeIndex: inactiveIndex,- isLastRotationManual: isManualRotation,- lastRotatedAt: currentTime,- lastRotationAttemptedAt: currentTime,- nextRotationAt: calculateNextRotationAt({- ...(secretRotation as TSecretRotationV2),- rotationStatus: SecretRotationStatus.Success,+ secretTagDAL,+ resourceMetadataDAL+ });++ const currentTime = new Date();++ return secretRotationV2DAL.updateById(+ secretRotation.id,+ {+ encryptedGeneratedCredentials: encryptedUpdatedCredentials,+ activeIndex: inactiveIndex,+ isLastRotationManual: isManualRotation,lastRotatedAt: currentTime,- isManualRotation- }),- rotationStatus: SecretRotationStatus.Success,- lastRotationJobId: jobId,- encryptedLastRotationMessage: null- },- tx- );- });- });+ lastRotationAttemptedAt: currentTime,+ nextRotationAt: calculateNextRotationAt({+ ...(secretRotation as TSecretRotationV2),+ rotationStatus: SecretRotationStatus.Success,+ lastRotatedAt: currentTime,+ isManualRotation+ }),+ rotationStatus: SecretRotationStatus.Success,+ lastRotationJobId: jobId,+ encryptedLastRotationMessage: null+ },+ tx+ );+ });+ },+ activeCredentials+ );await auditLogService.createAuditLog({...(auditLogInfo ?? {diff --cc backend/src/services/project/project-dal.tsindex 4796bcdcaa,bdcee1e615..8f4298450f--- a/backend/src/services/project/project-dal.ts+++ b/backend/src/services/project/project-dal.ts@@@ -425,14 -425,19 +425,29 @@@ export const projectDALFactory = (db: Treturn { docs, totalCount: Number(docs?.[0]?.count ?? 0) };};+ const findProjectByEnvId = async (envId: string, tx?: Knex) => {+ const project = await (tx || db.replicaNode())(TableName.Project)+ .leftJoin(TableName.Environment, `${TableName.Environment}.projectId`, `${TableName.Project}.id`)+ // eslint-disable-next-line @typescript-eslint/no-misused-promises+ .where(buildFindFilter({ id: envId }, TableName.Environment))+ .select(selectAllTableCols(TableName.Project))+ .first();+ return project;++ }+++ const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {+ try {+ const doc = await (tx || db.replicaNode())(TableName.Project)+ .andWhere((bd) => {+ if (orgId) {+ void bd.where({ orgId });+ }+ })+ .count();+ return Number(doc?.[0]?.count ?? 0);+ } catch (error) {+ throw new DatabaseError({ error, name: "Count of Org Projects" });+ }};return {@@@ -448,6 -453,6 +463,7 @@@checkProjectUpgradeStatus,getProjectFromSplitId,searchProjects,- findProjectByEnvId++ findProjectByEnvId,+ countOfOrgProjects};};diff --cc backend/src/services/secret-sync/secret-sync-queue.tsindex 9951a79aa8,6f627c24e3..66e83661f4--- a/backend/src/services/secret-sync/secret-sync-queue.ts+++ b/backend/src/services/secret-sync/secret-sync-queue.ts@@@ -94,7 -94,7 +95,8 @@@ type TSecretSyncQueueFactoryDep =secretVersionV2BridgeDAL: Pick<TSecretVersionV2DALFactory, "insertMany" | "findLatestVersionMany">;secretVersionTagV2BridgeDAL: Pick<TSecretVersionV2TagDALFactory, "insertMany">;resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "insertMany" | "delete">;+ folderCommitService: Pick<TFolderCommitServiceFactory, "createCommit">;+ licenseService: Pick<TLicenseServiceFactory, "getPlan">;};type SecretSyncActionJob = Job<@@@ -136,7 -136,7 +138,8 @@@ export const secretSyncQueueFactory = (secretVersionV2BridgeDAL,secretVersionTagV2BridgeDAL,resourceMetadataDAL,- folderCommitService++ folderCommitService,+ licenseService}: TSecretSyncQueueFactoryDep) => {const appCfg = getConfig();diff --cc docs/internals/permissions/project-permissions.mdxindex 0f55026888,8a12532a4c..96604f717b--- a/docs/internals/permissions/project-permissions.mdx+++ b/docs/internals/permissions/project-permissions.mdx@@@ -176,21 -176,16 +176,23 @@@ Supports conditions and permission inve| `read` | View secret versions and snapshots || `create` | Roll back secrets to snapshots |+#### Subject: `commits`++| Action | Description |+| -------- | ---------------------------------- |+| `read` | View commits and changes across folders |+| `perform-rollback` | Roll back commits changes and restore folders to previous state|+#### Subject: `secret-approval`- | Action | Description |- | -------- | ----------------------------------- |- | `read` | View approval policies and requests |- | `create` | Create new approval policies |- | `edit` | Modify approval policies |- | `delete` | Remove approval policies |+ | Action | Description |+ | --------------------- | ----------------------------------------------------------------------------------- |+ | `read` | View approval policies and requests |+ | `create` | Create new approval policies |+ | `edit` | Modify approval policies |+ | `delete` | Remove approval policies |+ | `allow-change-bypass` | Allow request creators to merge changes without approval in break-glass situations |+ | `allow-access-bypass` | Allow request creators to access secrets without approval in break-glass situations |#### Subject: `secret-rotation`diff --cc frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsxindex 427b37ef98,b2429fdfc0..2ee383b2c1--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx@@@ -12,7 -12,7 +12,8 @@@ import} from "@app/context";import {PermissionConditionOperators,+ ProjectPermissionCommitsActions,+ ProjectPermissionApprovalActions,ProjectPermissionDynamicSecretActions,ProjectPermissionGroupActions,ProjectPermissionIdentityActions,