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
add craete app section to hold git hub
Thiago Araujo da Silva0924ce52ea1a
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.tsindex 1943188ba8..e3fc7592a3 100644--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@ -105,6 +105,7 @@ import { TConvertorServiceFactory } from "@app/services/convertor/convertor-servimport { TExternalGroupOrgRoleMappingServiceFactory } from "@app/services/external-group-org-role-mapping/external-group-org-role-mapping-service";import { TExternalMigrationServiceFactory } from "@app/services/external-migration/external-migration-service";import { TFolderCommitServiceFactory } from "@app/services/folder-commit/folder-commit-service";+import { TGitHubAppServiceFactory } from "@app/services/github-app/github-app-service";import { TGroupProjectServiceFactory } from "@app/services/group-project/group-project-service";import { THsmServiceFactory } from "@app/services/hsm/hsm-service";import { TIdentityServiceFactory } from "@app/services/identity/identity-service";@@ -396,6 +397,7 @@ declare module "fastify" {gatewayPool: TGatewayPoolServiceFactory;resourceAuthMethod: TResourceAuthMethodServiceFactory;githubOrgSync: TGithubOrgSyncServiceFactory;+ gitHubApp: TGitHubAppServiceFactory;honeyTokenConfig: THoneyTokenConfigServiceFactory;honeyToken: THoneyTokenServiceFactory;folderCommit: TFolderCommitServiceFactory;diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.tsindex 840cfed220..ae5a0baf97 100644--- a/backend/src/@types/knex.d.ts+++ b/backend/src/@types/knex.d.ts@@ -182,6 +182,9 @@ import {TGitAppOrg,TGitAppOrgInsert,TGitAppOrgUpdate,+ TGitHubApps,+ TGitHubAppsInsert,+ TGitHubAppsUpdate,TGithubOrgSyncConfigs,TGithubOrgSyncConfigsInsert,TGithubOrgSyncConfigsUpdate,@@ -1561,6 +1564,7 @@ declare module "knex/types/tables" {TSecretReminderRecipientsInsert,TSecretReminderRecipientsUpdate>;+ [TableName.GitHubApp]: KnexOriginal.CompositeTableType<TGitHubApps, TGitHubAppsInsert, TGitHubAppsUpdate>;[TableName.GithubOrgSyncConfig]: KnexOriginal.CompositeTableType<TGithubOrgSyncConfigs,TGithubOrgSyncConfigsInsert,diff --git a/backend/src/db/migrations/20260513120000_create-github-apps.ts b/backend/src/db/migrations/20260513120000_create-github-apps.tsnew file mode 100644index 0000000000..69068be719--- /dev/null+++ b/backend/src/db/migrations/20260513120000_create-github-apps.ts@@ -0,0 +1,29 @@+import { Knex } from "knex";++import { TableName } from "@app/db/schemas";+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "@app/db/utils";++export async function up(knex: Knex): Promise<void> {+ if (!(await knex.schema.hasTable(TableName.GitHubApp))) {+ await knex.schema.createTable(TableName.GitHubApp, (t) => {+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());+ t.uuid("orgId").notNullable();+ t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");+ t.string("name").notNullable();+ t.binary("encryptedAppId").notNullable();+ t.binary("encryptedClientId").notNullable();+ t.binary("encryptedClientSecret").notNullable();+ t.binary("encryptedPrivateKey").notNullable();+ t.binary("encryptedSlug").notNullable();+ t.timestamps(true, true, true);+ t.unique(["orgId", "name"]);+ });++ await createOnUpdateTrigger(knex, TableName.GitHubApp);+ }+}++export async function down(knex: Knex): Promise<void> {+ await knex.schema.dropTableIfExists(TableName.GitHubApp);+ await dropOnUpdateTrigger(knex, TableName.GitHubApp);+}diff --git a/backend/src/db/schemas/github-apps.ts b/backend/src/db/schemas/github-apps.tsnew file mode 100644index 0000000000..3ccab1cd0c--- /dev/null+++ b/backend/src/db/schemas/github-apps.ts@@ -0,0 +1,27 @@+// Code generated by automation script, DO NOT EDIT.+// Automated by pulling database and generating zod schema+// To update. Just run npm run generate:schema+// Written by akhilmhdh.++import { z } from "zod";++import { zodBuffer } from "@app/lib/zod";++import { TImmutableDBKeys } from "./models";++export const GitHubAppsSchema = z.object({+ id: z.string().uuid(),+ orgId: z.string().uuid(),+ name: z.string(),+ encryptedAppId: zodBuffer,+ encryptedClientId: zodBuffer,+ encryptedClientSecret: zodBuffer,+ encryptedPrivateKey: zodBuffer,+ encryptedSlug: zodBuffer,+ createdAt: z.date(),+ updatedAt: z.date()+});++export type TGitHubApps = z.infer<typeof GitHubAppsSchema>;+export type TGitHubAppsInsert = Omit<z.input<typeof GitHubAppsSchema>, TImmutableDBKeys>;+export type TGitHubAppsUpdate = Partial<Omit<z.input<typeof GitHubAppsSchema>, TImmutableDBKeys>>;diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.tsindex 9617cc1308..3e372ba919 100644--- a/backend/src/db/schemas/index.ts+++ b/backend/src/db/schemas/index.ts@@ -60,6 +60,7 @@ export * from "./gateways";export * from "./gateways-v2";export * from "./git-app-install-sessions";export * from "./git-app-org";+export * from "./github-apps";export * from "./github-org-sync-configs";export * from "./group-project-membership-roles";export * from "./group-project-memberships";diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 22f9bc6b98..2db0b1f6a5 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -192,6 +192,7 @@ export enum TableName {ProjectMicrosoftTeamsConfigs = "project_microsoft_teams_configs",SecretReminderRecipients = "secret_reminder_recipients", // TODO(Carlos): Remove this in the future after migrating to the new reminder recipients tableGithubOrgSyncConfig = "github_org_sync_configs",+ GitHubApp = "github_apps",FolderCommit = "folder_commits",FolderCommitChanges = "folder_commit_changes",FolderCheckpoint = "folder_checkpoints",diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex b9efeeb9e9..30bd09fab4 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -320,6 +320,8 @@ import { folderCommitServiceFactory } from "@app/services/folder-commit/folder-cimport { folderCommitChangesDALFactory } from "@app/services/folder-commit-changes/folder-commit-changes-dal";import { folderTreeCheckpointDALFactory } from "@app/services/folder-tree-checkpoint/folder-tree-checkpoint-dal";import { folderTreeCheckpointResourcesDALFactory } from "@app/services/folder-tree-checkpoint-resources/folder-tree-checkpoint-resources-dal";+import { gitHubAppDALFactory } from "@app/services/github-app/github-app-dal";+import { gitHubAppServiceFactory } from "@app/services/github-app/github-app-service";import { groupProjectDALFactory } from "@app/services/group-project/group-project-dal";import { groupProjectServiceFactory } from "@app/services/group-project/group-project-service";import { healthAlertServiceFactory } from "@app/services/health-alert/health-alert-queue";@@ -717,6 +719,7 @@ export const registerRoutes = async (const gatewayDAL = gatewayDALFactory(db);const secretReminderRecipientsDAL = secretReminderRecipientsDALFactory(db);const githubOrgSyncDAL = githubOrgSyncDALFactory(db);+ const gitHubAppDAL = gitHubAppDALFactory(db);const honeyTokenConfigDAL = honeyTokenConfigDALFactory(db);const honeyTokenDAL = honeyTokenDALFactory(db);const honeyTokenEventDAL = honeyTokenEventDALFactory(db);@@ -1027,6 +1030,12 @@ export const registerRoutes = async (membershipGroupDAL});+ const gitHubAppService = gitHubAppServiceFactory({+ gitHubAppDAL,+ permissionService,+ kmsService+ });+// ldapService is created after loginService (below) due to dependency on processProviderCallbackconst invalidateCacheQueue = invalidateCacheQueueFactory({@@ -3685,6 +3694,7 @@ export const registerRoutes = async (insights: insightsService,pamInsights: pamInsightsService,githubOrgSync: githubOrgSyncConfigService,+ gitHubApp: gitHubAppService,honeyTokenConfig: honeyTokenConfigService,honeyToken: honeyTokenService,folderCommit: folderCommitService,diff --git a/backend/src/server/routes/v1/github-app-router.ts b/backend/src/server/routes/v1/github-app-router.tsnew file mode 100644index 0000000000..324d88a28b--- /dev/null+++ b/backend/src/server/routes/v1/github-app-router.ts@@ -0,0 +1,133 @@+import { z } from "zod";++import { readLimit, writeLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AuthMode } from "@app/services/auth/auth-type";++const SanitizedGitHubAppSchema = z.object({+ id: z.string().uuid(),+ orgId: z.string().uuid(),+ name: z.string(),+ appId: z.string(),+ slug: z.string(),+ createdAt: z.date(),+ updatedAt: z.date()+});++export const registerGitHubAppRouter = async (server: FastifyZodProvider) => {+ server.route({+ method: "POST",+ url: "/manifest/exchange",+ config: {+ rateLimit: writeLimit+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ schema: {+ body: z.object({+ name: z.string().trim().min(1).max(64),+ code: z.string().trim().min(1)+ }),+ response: {+ 200: z.object({+ gitHubApp: SanitizedGitHubAppSchema+ })+ }+ },+ handler: async (req) => {+ const gitHubApp = await server.services.gitHubApp.exchangeManifestCode({+ orgPermission: req.permission,+ name: req.body.name,+ code: req.body.code+ });++ return { gitHubApp };+ }+ });++ server.route({+ method: "POST",+ url: "/register",+ config: {+ rateLimit: writeLimit+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ schema: {+ body: z.object({+ name: z.string().trim().min(1).max(64),+ appId: z.string().trim().min(1),+ slug: z.string().trim().min(1),+ clientId: z.string().trim().min(1),+ clientSecret: z.string().trim().min(1),+ privateKey: z.string().trim().min(1)+ }),+ response: {+ 200: z.object({+ gitHubApp: SanitizedGitHubAppSchema+ })+ }+ },+ handler: async (req) => {+ const gitHubApp = await server.services.gitHubApp.registerGitHubApp({+ orgPermission: req.permission,+ name: req.body.name,+ appId: req.body.appId,+ slug: req.body.slug,+ clientId: req.body.clientId,+ clientSecret: req.body.clientSecret,+ privateKey: req.body.privateKey+ });++ return { gitHubApp };+ }+ });++ server.route({+ method: "GET",+ url: "/",+ config: {+ rateLimit: readLimit+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ schema: {+ response: {+ 200: z.object({+ gitHubApps: SanitizedGitHubAppSchema.array()+ })+ }+ },+ handler: async (req) => {+ const gitHubApps = await server.services.gitHubApp.listGitHubApps({+ orgPermission: req.permission+ });++ return { gitHubApps };+ }+ });++ server.route({+ method: "DELETE",+ url: "/:id",+ config: {+ rateLimit: writeLimit+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ schema: {+ params: z.object({+ id: z.string().uuid()+ }),+ response: {+ 200: z.object({+ gitHubApp: SanitizedGitHubAppSchema+ })+ }+ },+ handler: async (req) => {+ const gitHubApp = await server.services.gitHubApp.deleteGitHubApp({+ orgPermission: req.permission,+ id: req.params.id+ });++ return { gitHubApp };+ }+ });+};diff --git a/backend/src/server/routes/v1/index.ts b/backend/src/server/routes/v1/index.tsindex 6a3b24ae29..812c0adf5e 100644--- a/backend/src/server/routes/v1/index.ts+++ b/backend/src/server/routes/v1/index.ts@@ -38,6 +38,7 @@ import { registerDeprecatedSecretImportRouter } from "./deprecated-secret-importimport { registerDeprecatedSecretTagRouter } from "./deprecated-secret-tag-router";import { registerEventRouter } from "./event-router";import { registerExternalGroupOrgRoleMappingRouter } from "./external-group-org-role-mapping-router";+import { registerGitHubAppRouter } from "./github-app-router";import { registerGroupOrgMembershipRouter } from "./group-org-membership-router";import { registerGroupProjectRouter } from "./group-project-router";import { registerIdentityAccessTokenRouter } from "./identity-access-token-router";@@ -146,6 +147,8 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {{ prefix: "/workflow-integrations" });+ await server.register(registerGitHubAppRouter, { prefix: "/github-apps" });+await server.register(async (projectRouter) => {await projectRouter.register(registerDeprecatedProjectRouter);diff --git a/backend/src/services/github-app/github-app-dal.ts b/backend/src/services/github-app/github-app-dal.tsnew file mode 100644index 0000000000..c7435b3808--- /dev/null+++ b/backend/src/services/github-app/github-app-dal.ts@@ -0,0 +1,10 @@+import { TDbClient } from "@app/db";+import { TableName } from "@app/db/schemas";+import { ormify } from "@app/lib/knex";++export type TGitHubAppDALFactory = ReturnType<typeof gitHubAppDALFactory>;++export const gitHubAppDALFactory = (db: TDbClient) => {+ const orm = ormify(db, TableName.GitHubApp);+ return orm;+};diff --git a/backend/src/services/github-app/github-app-service.ts b/backend/src/services/github-app/github-app-service.tsnew file mode 100644index 0000000000..59f5b8ac50--- /dev/null+++ b/backend/src/services/github-app/github-app-service.ts@@ -0,0 +1,229 @@+import { ForbiddenError } from "@casl/ability";++import { OrganizationActionScope } from "@app/db/schemas";+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";+import { request } from "@app/lib/config/request";+import { BadRequestError, NotFoundError } from "@app/lib/errors";+import { TKmsServiceFactory } from "@app/services/kms/kms-service";+import { KmsDataKey } from "@app/services/kms/kms-types";++import { TGitHubAppDALFactory } from "./github-app-dal";+import {+ TDeleteGitHubAppDTO,+ TExchangeGitHubManifestCodeDTO,+ TGitHubAppManifestResponse,+ TListGitHubAppsDTO,+ TRegisterGitHubAppDTO,+ TSanitizedGitHubApp+} from "./github-app-types";++type TGitHubAppServiceFactoryDep = {+ gitHubAppDAL: TGitHubAppDALFactory;+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;+};++export type TGitHubAppServiceFactory = ReturnType<typeof gitHubAppServiceFactory>;++export const gitHubAppServiceFactory = ({+ gitHubAppDAL,+ permissionService,+ kmsService+}: TGitHubAppServiceFactoryDep) => {+ const exchangeManifestCode = async ({+ name,+ code,+ orgPermission+ }: TExchangeGitHubManifestCodeDTO): Promise<TSanitizedGitHubApp> => {+ const { permission } = await permissionService.getOrgPermission({+ actor: orgPermission.type,+ actorId: orgPermission.id,+ orgId: orgPermission.orgId,+ actorAuthMethod: orgPermission.authMethod,+ actorOrgId: orgPermission.orgId,+ scope: OrganizationActionScope.ParentOrganization+ });++ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.Settings);++ const existing = await gitHubAppDAL.findOne({ orgId: orgPermission.orgId, name });+ if (existing) {+ throw new BadRequestError({+ message: `A GitHub App with name "${name}" already exists in this organization.`+ });+ }++ let manifestResponse: TGitHubAppManifestResponse;+ try {+ const { data } = await request.post<TGitHubAppManifestResponse>(+ `https://api.github.com/app-manifests/${encodeURIComponent(code)}/conversions`,+ {},+ {+ headers: {+ Accept: "application/vnd.github+json",+ "X-GitHub-Api-Version": "2022-11-28"+ }+ }+ );+ manifestResponse = data;+ } catch (err) {+ throw new BadRequestError({+ message:+ "Failed to exchange GitHub App manifest code. The code may be expired or invalid. Please try registering the GitHub App again."+ });+ }++ const { encryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.Organization,+ orgId: orgPermission.orgId+ });++ const created = await gitHubAppDAL.create({+ orgId: orgPermission.orgId,+ name,+ encryptedAppId: encryptor({ plainText: Buffer.from(String(manifestResponse.id)) }).cipherTextBlob,+ encryptedClientId: encryptor({ plainText: Buffer.from(manifestResponse.client_id) }).cipherTextBlob,+ encryptedClientSecret: encryptor({ plainText: Buffer.from(manifestResponse.client_secret) }).cipherTextBlob,+ encryptedPrivateKey: encryptor({ plainText: Buffer.from(manifestResponse.pem) }).cipherTextBlob,+ encryptedSlug: encryptor({ plainText: Buffer.from(manifestResponse.slug) }).cipherTextBlob+ });++ return {+ id: created.id,+ orgId: created.orgId,+ name: created.name,+ appId: String(manifestResponse.id),+ slug: manifestResponse.slug,+ createdAt: created.createdAt,+ updatedAt: created.updatedAt+ };+ };++ const listGitHubApps = async ({ orgPermission }: TListGitHubAppsDTO): Promise<TSanitizedGitHubApp[]> => {+ const { permission } = await permissionService.getOrgPermission({+ actor: orgPermission.type,+ actorId: orgPermission.id,+ orgId: orgPermission.orgId,+ actorAuthMethod: orgPermission.authMethod,+ actorOrgId: orgPermission.orgId,+ scope: OrganizationActionScope.Any+ });++ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Settings);++ const apps = await gitHubAppDAL.find({ orgId: orgPermission.orgId });++ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.Organization,+ orgId: orgPermission.orgId+ });++ return apps.map((app) => ({+ id: app.id,+ orgId: app.orgId,+ name: app.name,+ appId: decryptor({ cipherTextBlob: app.encryptedAppId }).toString(),+ slug: decryptor({ cipherTextBlob: app.encryptedSlug }).toString(),+ createdAt: app.createdAt,+ updatedAt: app.updatedAt+ }));+ };++ const deleteGitHubApp = async ({ id, orgPermission }: TDeleteGitHubAppDTO): Promise<TSanitizedGitHubApp> => {+ const { permission } = await permissionService.getOrgPermission({+ actor: orgPermission.type,+ actorId: orgPermission.id,+ orgId: orgPermission.orgId,+ actorAuthMethod: orgPermission.authMethod,+ actorOrgId: orgPermission.orgId,+ scope: OrganizationActionScope.ParentOrganization+ });++ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Delete, OrgPermissionSubjects.Settings);++ const existing = await gitHubAppDAL.findOne({ id, orgId: orgPermission.orgId });+ if (!existing) {+ throw new NotFoundError({ message: `GitHub App with id ${id} not found in this organization.` });+ }++ const { decryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.Organization,+ orgId: orgPermission.orgId+ });++ const sanitized: TSanitizedGitHubApp = {+ id: existing.id,+ orgId: existing.orgId,+ name: existing.name,+ appId: decryptor({ cipherTextBlob: existing.encryptedAppId }).toString(),+ slug: decryptor({ cipherTextBlob: existing.encryptedSlug }).toString(),+ createdAt: existing.createdAt,+ updatedAt: existing.updatedAt+ };++ await gitHubAppDAL.deleteById(existing.id);++ return sanitized;+ };++ const registerGitHubApp = async ({+ name,+ appId,+ slug,+ clientId,+ clientSecret,+ privateKey,+ orgPermission+ }: TRegisterGitHubAppDTO): Promise<TSanitizedGitHubApp> => {+ const { permission } = await permissionService.getOrgPermission({+ actor: orgPermission.type,+ actorId: orgPermission.id,+ orgId: orgPermission.orgId,+ actorAuthMethod: orgPermission.authMethod,+ actorOrgId: orgPermission.orgId,+ scope: OrganizationActionScope.ParentOrganization+ });++ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.Settings);++ const existing = await gitHubAppDAL.findOne({ orgId: orgPermission.orgId, name });+ if (existing) {+ throw new BadRequestError({+ message: `A GitHub App with name "${name}" already exists in this organization.`+ });+ }++ const { encryptor } = await kmsService.createCipherPairWithDataKey({+ type: KmsDataKey.Organization,+ orgId: orgPermission.orgId+ });++ const created = await gitHubAppDAL.create({+ orgId: orgPermission.orgId,+ name,+ encryptedAppId: encryptor({ plainText: Buffer.from(appId) }).cipherTextBlob,+ encryptedClientId: encryptor({ plainText: Buffer.from(clientId) }).cipherTextBlob,+ encryptedClientSecret: encryptor({ plainText: Buffer.from(clientSecret) }).cipherTextBlob,+ encryptedPrivateKey: encryptor({ plainText: Buffer.from(privateKey) }).cipherTextBlob,+ encryptedSlug: encryptor({ plainText: Buffer.from(slug) }).cipherTextBlob+ });++ return {+ id: created.id,+ orgId: created.orgId,+ name: created.name,+ appId,+ slug,+ createdAt: created.createdAt,+ updatedAt: created.updatedAt+ };+ };++ return {+ exchangeManifestCode,+ listGitHubApps,+ deleteGitHubApp,+ registerGitHubApp+ };+};diff --git a/backend/src/services/github-app/github-app-types.ts b/backend/src/services/github-app/github-app-types.tsnew file mode 100644index 0000000000..d3e574f927--- /dev/null+++ b/backend/src/services/github-app/github-app-types.ts@@ -0,0 +1,45 @@+import { OrgServiceActor } from "@app/lib/types";++export type TExchangeGitHubManifestCodeDTO = {+ name: string;+ code: string;+ orgPermission: OrgServiceActor;+};++export type TListGitHubAppsDTO = {+ orgPermission: OrgServiceActor;+};++export type TDeleteGitHubAppDTO = {+ id: string;+ orgPermission: OrgServiceActor;+};++export type TRegisterGitHubAppDTO = {+ name: string;+ appId: string;+ slug: string;+ clientId: string;+ clientSecret: string;+ privateKey: string;+ orgPermission: OrgServiceActor;+};++export type TGitHubAppManifestResponse = {+ id: number;+ slug: string;+ client_id: string;+ client_secret: string;+ pem: string;+ html_url: string;+};++export type TSanitizedGitHubApp = {+ id: string;+ orgId: string;+ name: string;+ appId: string;+ slug: string;+ createdAt: Date;+ updatedAt: Date;+};diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.tsindex 0668f50c1a..a465e7cd5a 100644--- a/frontend/src/const/routes.ts+++ b/frontend/src/const/routes.ts@@ -43,6 +43,10 @@ export const ROUTE_PATHS = Object.freeze({"/organizations/$orgId/settings","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/"),+ GitHubAppCallbackPage: setRoute(+ "/organizations/$orgId/settings/github-app/callback",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback"+ ),GroupDetailsByIDPage: setRoute("/organizations/$orgId/groups/$groupId","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/groups/$groupId"diff --git a/frontend/src/hooks/api/gitHubApps/index.ts b/frontend/src/hooks/api/gitHubApps/index.tsnew file mode 100644index 0000000000..f6377e42f6--- /dev/null+++ b/frontend/src/hooks/api/gitHubApps/index.ts@@ -0,0 +1,3 @@+export * from "./mutations";+export * from "./queries";+export type { TDeleteGitHubAppDTO, TExchangeGitHubManifestCodeDTO, TGitHubApp, TRegisterGitHubAppDTO } from "./types";diff --git a/frontend/src/hooks/api/gitHubApps/mutations.tsx b/frontend/src/hooks/api/gitHubApps/mutations.tsxnew file mode 100644index 0000000000..ee08fd4230--- /dev/null+++ b/frontend/src/hooks/api/gitHubApps/mutations.tsx@@ -0,0 +1,58 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { TDeleteGitHubAppDTO, TExchangeGitHubManifestCodeDTO, TGitHubApp, TRegisterGitHubAppDTO } from "./types";++export const useExchangeGitHubManifestCode = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async (dto: TExchangeGitHubManifestCodeDTO) => {+ const { data } = await apiRequest.post<{ gitHubApp: TGitHubApp }>(+ "/api/v1/github-apps/manifest/exchange",+ dto+ );++ return data.gitHubApp;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["github-apps"], exact: false });+ }+ });+};++export const useRegisterGitHubApp = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async (dto: TRegisterGitHubAppDTO) => {+ const { data } = await apiRequest.post<{ gitHubApp: TGitHubApp }>(+ "/api/v1/github-apps/register",+ dto+ );++ return data.gitHubApp;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["github-apps"], exact: false });+ }+ });+};++export const useDeleteGitHubApp = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async ({ id }: TDeleteGitHubAppDTO) => {+ const { data } = await apiRequest.delete<{ gitHubApp: TGitHubApp }>(+ `/api/v1/github-apps/${id}`+ );++ return data.gitHubApp;+ },+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["github-apps"], exact: false });+ }+ });+};diff --git a/frontend/src/hooks/api/gitHubApps/queries.tsx b/frontend/src/hooks/api/gitHubApps/queries.tsxnew file mode 100644index 0000000000..8362e08d62--- /dev/null+++ b/frontend/src/hooks/api/gitHubApps/queries.tsx@@ -0,0 +1,22 @@+import { useQuery } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { TGitHubApp } from "./types";++export const gitHubAppKeys = {+ list: (orgId?: string) => [{ orgId }, "github-apps"] as const+};++export const fetchGitHubApps = async () => {+ const { data } = await apiRequest.get<{ gitHubApps: TGitHubApp[] }>("/api/v1/github-apps");++ return data.gitHubApps;+};++export const useListGitHubApps = (orgId?: string) =>+ useQuery({+ queryKey: gitHubAppKeys.list(orgId),+ queryFn: fetchGitHubApps,+ enabled: Boolean(orgId)+ });diff --git a/frontend/src/hooks/api/gitHubApps/types.ts b/frontend/src/hooks/api/gitHubApps/types.tsnew file mode 100644index 0000000000..97fb7197d9--- /dev/null+++ b/frontend/src/hooks/api/gitHubApps/types.ts@@ -0,0 +1,27 @@+export type TGitHubApp = {+ id: string;+ orgId: string;+ name: string;+ appId: string;+ slug: string;+ createdAt: string;+ updatedAt: string;+};++export type TExchangeGitHubManifestCodeDTO = {+ name: string;+ code: string;+};++export type TDeleteGitHubAppDTO = {+ id: string;+};++export type TRegisterGitHubAppDTO = {+ name: string;+ appId: string;+ slug: string;+ clientId: string;+ clientSecret: string;+ privateKey: string;+};diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.tsindex 48ab071b70..00aa4f55f1 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts@@ -150,7 +150,7 @@ export const getOrgSettingsSubmenu = ({]: []),{ label: "Encryption", icon: Lock, tab: "tab-org-encryption" },- { label: "Workflow Integrations", icon: Plug, tab: "workflow-integrations" },+ { label: "Integrations", icon: Plug, tab: "integrations" },{ label: "Audit Log Streams", icon: FileText, tab: "tag-audit-log-streams" },{ label: "External Migrations", icon: Database, tab: "tab-external-migrations" },{ label: "Project Templates", icon: FolderCog, tab: "project-templates" },diff --git a/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/GitHubAppCallbackPage.tsx b/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/GitHubAppCallbackPage.tsxnew file mode 100644index 0000000000..c2cfe00728--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/GitHubAppCallbackPage.tsx@@ -0,0 +1,87 @@+import { useEffect } from "react";+import { useNavigate, useSearch } from "@tanstack/react-router";++import { createNotification } from "@app/components/notifications";+import { ContentLoader } from "@app/components/v2";+import { ROUTE_PATHS } from "@app/const/routes";+import { useOrganization } from "@app/context";+import { useExchangeGitHubManifestCode } from "@app/hooks/api/gitHubApps";++const GITHUB_MANIFEST_STATE_KEY = "githubManifestState";+const GITHUB_MANIFEST_FORM_KEY = "githubManifestFormData";++export const GitHubAppCallbackPage = () => {+ const navigate = useNavigate();+ const { currentOrg } = useOrganization();+ const search = useSearch({ from: ROUTE_PATHS.Organization.GitHubAppCallbackPage.id });+ const { mutateAsync: exchangeManifestCode } = useExchangeGitHubManifestCode();++ useEffect(() => {+ if (!currentOrg) return;++ const { code, state } = search;++ const redirect = () =>+ navigate({+ to: ROUTE_PATHS.Organization.SettingsPage.path,+ params: { orgId: currentOrg.id },+ search: { selectedTab: "integrations" }+ });++ if (!code || !state) {+ redirect();+ return;+ }++ const storedState = localStorage.getItem(GITHUB_MANIFEST_STATE_KEY);+ const storedFormDataRaw = localStorage.getItem(GITHUB_MANIFEST_FORM_KEY);++ localStorage.removeItem(GITHUB_MANIFEST_STATE_KEY);+ localStorage.removeItem(GITHUB_MANIFEST_FORM_KEY);++ if (!storedState || storedState !== state || !storedFormDataRaw) {+ redirect();+ return;+ }++ let parsedFormData: { name?: string; orgId?: string } = {};+ try {+ parsedFormData = JSON.parse(storedFormDataRaw) as { name?: string; orgId?: string };+ } catch {+ redirect();+ return;+ }++ if (!parsedFormData.name || parsedFormData.orgId !== currentOrg.id) {+ redirect();+ return;+ }++ exchangeManifestCode({ name: parsedFormData.name, code })+ .then(() => {+ createNotification({+ text: `GitHub App "${parsedFormData.name}" registered successfully.`,+ type: "success"+ });+ })+ .catch((err: { response?: { data?: { message?: string } }; message?: string }) => {+ createNotification({+ text:+ err?.response?.data?.message ||+ err?.message ||+ "Failed to register GitHub App. Please try again.",+ type: "error"+ });+ })+ .finally(() => {+ redirect();+ });+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [currentOrg?.id]);++ return (+ <div className="flex h-full w-full items-center justify-center">+ <ContentLoader text="Registering GitHub App, please wait..." />+ </div>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/route.tsx b/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/route.tsxnew file mode 100644index 0000000000..5a2c0e35da--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/GitHubAppCallbackPage/route.tsx@@ -0,0 +1,17 @@+import { createFileRoute } from "@tanstack/react-router";+import { zodValidator } from "@tanstack/zod-adapter";+import { z } from "zod";++import { GitHubAppCallbackPage } from "./GitHubAppCallbackPage";++const GitHubAppCallbackPageQueryParams = z.object({+ code: z.string().optional(),+ state: z.string().optional()+});++export const Route = createFileRoute(+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback"+)({+ component: GitHubAppCallbackPage,+ validateSearch: zodValidator(GitHubAppCallbackPageQueryParams)+});diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/AddGitHubAppModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/AddGitHubAppModal.tsxnew file mode 100644index 0000000000..94adf7972f--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/AddGitHubAppModal.tsx@@ -0,0 +1,459 @@+import crypto from "crypto";++import { useState } from "react";+import { Controller, useForm } from "react-hook-form";+import { faGithub } from "@fortawesome/free-brands-svg-icons";+import { faArrowRight, faFileImport, faPlusCircle } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { zodResolver } from "@hookform/resolvers/zod";+import { AnimatePresence, motion } from "framer-motion";+import { z } from "zod";++import { createNotification } from "@app/components/notifications";+import { Button, FormControl, Input, Modal, ModalContent, TextArea } from "@app/components/v2";+import { useOrganization } from "@app/context";+import { useRegisterGitHubApp } from "@app/hooks/api/gitHubApps";++type Props = {+ isOpen?: boolean;+ onToggle: (isOpen: boolean) => void;+};++enum WizardSteps {+ SelectPlatform = "select-platform",+ SelectMethod = "select-method",+ GitHubManifest = "github-manifest",+ GitHubManual = "github-manual"+}++const PLATFORM_LIST = [+ {+ icon: <FontAwesomeIcon icon={faGithub} size="lg" />,+ platform: "github",+ title: "GitHub"+ }+];++const manifestFormSchema = z.object({+ name: z.string().trim().min(1, "Name is required").max(64),+ organization: z.string().trim().optional()+});++const manualFormSchema = z.object({+ name: z.string().trim().min(1, "Name is required").max(64),+ appId: z.string().trim().min(1, "App ID is required"),+ slug: z.string().trim().min(1, "Slug is required"),+ clientId: z.string().trim().min(1, "Client ID is required"),+ clientSecret: z.string().trim().min(1, "Client secret is required"),+ privateKey: z.string().trim().min(1, "Private key is required")+});++type TManifestFormData = z.infer<typeof manifestFormSchema>;+type TManualFormData = z.infer<typeof manualFormSchema>;++const buildGitHubManifest = ({ orgId, name }: { orgId: string; name: string }) => {+ const redirectUrl = `${window.location.origin}/organizations/${orgId}/settings/github-app/callback`;++ return {+ name,+ url: window.location.origin,+ redirect_url: redirectUrl,+ callback_urls: [`${window.location.origin}/organization/app-connections/github/oauth/callback`],+ description: `Infisical GitHub App for organization ${orgId}`,+ public: false,+ request_oauth_on_install: true,+ default_permissions: {+ metadata: "read",+ secrets: "write",+ environments: "write",+ actions: "read",+ organization_secrets: "write"+ },+ default_events: [] as string[]+ };+};++const submitManifestForm = ({+ orgId,+ name,+ organization+}: {+ orgId: string;+ name: string;+ organization?: string;+}) => {+ const csrfToken = crypto.randomBytes(32).toString("hex");+ localStorage.setItem("githubManifestState", csrfToken);+ localStorage.setItem("githubManifestFormData", JSON.stringify({ name, orgId }));++ const manifest = buildGitHubManifest({ orgId, name });++ const form = document.createElement("form");+ form.method = "post";+ const baseUrl = organization+ ? `https://github.com/organizations/${organization}/settings/apps/new`+ : "https://github.com/settings/apps/new";+ form.action = `${baseUrl}?state=${encodeURIComponent(csrfToken)}`;++ const input = document.createElement("input");+ input.type = "hidden";+ input.name = "manifest";+ input.value = JSON.stringify(manifest);+ form.appendChild(input);++ document.body.appendChild(form);+ form.submit();+};++export const AddGitHubAppModal = ({ isOpen, onToggle }: Props) => {+ const [wizardStep, setWizardStep] = useState(WizardSteps.SelectPlatform);+ const [selectedPlatform, setSelectedPlatform] = useState<string | null>(null);+ const { currentOrg } = useOrganization();++ const registerGitHubApp = useRegisterGitHubApp();++ const manifestForm = useForm<TManifestFormData>({+ resolver: zodResolver(manifestFormSchema)+ });++ const manualForm = useForm<TManualFormData>({+ resolver: zodResolver(manualFormSchema)+ });++ const handleFormReset = (state: boolean = false) => {+ onToggle(state);+ setWizardStep(WizardSteps.SelectPlatform);+ setSelectedPlatform(null);+ manifestForm.reset();+ manualForm.reset();+ };++ const handleSubmitManifest = ({ name, organization }: TManifestFormData) => {+ if (!currentOrg) return;+ submitManifestForm({ orgId: currentOrg.id, name, organization });+ };++ const handleSubmitManual = async (data: TManualFormData) => {+ if (!currentOrg) return;++ await registerGitHubApp.mutateAsync(data, {+ onSuccess: () => {+ createNotification({ type: "success", text: "GitHub App registered successfully." });+ handleFormReset(false);+ },+ onError: (err: unknown) => {+ const message =+ err instanceof Error ? err.message : "Failed to register GitHub App. Please try again.";+ createNotification({ type: "error", text: message });+ }+ });+ };++ const getModalTitle = () => {+ if (wizardStep === WizardSteps.GitHubManifest) return "Create a new GitHub App";+ if (wizardStep === WizardSteps.GitHubManual) return "Register an existing GitHub App";+ if (selectedPlatform === "github") return "Add a GitHub App";+ return "Add an app integration";+ };++ return (+ <Modal isOpen={isOpen} onOpenChange={(state) => handleFormReset(state)}>+ <ModalContent title={getModalTitle()} className="my-4">+ <AnimatePresence mode="wait">+ {wizardStep === WizardSteps.SelectPlatform && (+ <motion.div+ key="select-platform"+ transition={{ duration: 0.1 }}+ initial={{ opacity: 0, translateX: 30 }}+ animate={{ opacity: 1, translateX: 0 }}+ exit={{ opacity: 0, translateX: -30 }}+ >+ <div className="mb-4 text-mineshaft-300">Select a platform</div>+ <div className="flex items-center space-x-4">+ {PLATFORM_LIST.map(({ icon, platform, title }) => (+ <div+ key={platform}+ className="flex h-28 w-32 cursor-pointer flex-col items-center space-y-4 rounded-sm border border-mineshaft-500 bg-bunker-600 p-6 transition-all hover:border-primary/70 hover:bg-primary/10 hover:text-white"+ role="button"+ tabIndex={0}+ onClick={() => {+ setSelectedPlatform(platform);+ setWizardStep(WizardSteps.SelectMethod);+ }}+ onKeyDown={(evt) => {+ if (evt.key === "Enter") {+ setSelectedPlatform(platform);+ setWizardStep(WizardSteps.SelectMethod);+ }+ }}+ >+ <div>{icon}</div>+ <div className="text-center text-sm whitespace-pre-wrap">{title}</div>+ </div>+ ))}+ </div>+ </motion.div>+ )}+ {wizardStep === WizardSteps.SelectMethod && selectedPlatform === "github" && (+ <motion.div+ key="select-method"+ transition={{ duration: 0.1 }}+ initial={{ opacity: 0, translateX: 30 }}+ animate={{ opacity: 1, translateX: 0 }}+ exit={{ opacity: 0, translateX: -30 }}+ >+ <div className="mb-4 text-mineshaft-300">How would you like to add a GitHub App?</div>+ <div className="flex flex-col space-y-3">+ <div+ className="flex cursor-pointer items-start space-x-4 rounded-md border border-mineshaft-500 bg-bunker-600 p-4 transition-all hover:border-primary/70 hover:bg-primary/10"+ role="button"+ tabIndex={0}+ onClick={() => setWizardStep(WizardSteps.GitHubManifest)}+ onKeyDown={(evt) => {+ if (evt.key === "Enter") setWizardStep(WizardSteps.GitHubManifest);+ }}+ >+ <div className="mt-0.5 text-primary">+ <FontAwesomeIcon icon={faPlusCircle} size="lg" />+ </div>+ <div>+ <div className="font-medium text-mineshaft-100">Create via GitHub Manifest</div>+ <div className="mt-1 text-sm text-mineshaft-400">+ Let Infisical guide you through creating a new GitHub App directly on GitHub.+ Recommended for new setups.+ </div>+ </div>+ <div className="ml-auto self-center text-mineshaft-400">+ <FontAwesomeIcon icon={faArrowRight} />+ </div>+ </div>+ <div+ className="flex cursor-pointer items-start space-x-4 rounded-md border border-mineshaft-500 bg-bunker-600 p-4 transition-all hover:border-primary/70 hover:bg-primary/10"+ role="button"+ tabIndex={0}+ onClick={() => setWizardStep(WizardSteps.GitHubManual)}+ onKeyDown={(evt) => {+ if (evt.key === "Enter") setWizardStep(WizardSteps.GitHubManual);+ }}+ >+ <div className="mt-0.5 text-primary">+ <FontAwesomeIcon icon={faFileImport} size="lg" />+ </div>+ <div>+ <div className="font-medium text-mineshaft-100">Register Existing App</div>+ <div className="mt-1 text-sm text-mineshaft-400">+ Already have a GitHub App? Provide its credentials to register it with+ Infisical.+ </div>+ </div>+ <div className="ml-auto self-center text-mineshaft-400">+ <FontAwesomeIcon icon={faArrowRight} />+ </div>+ </div>+ </div>+ <div className="mt-4">+ <Button variant="outline_bg" onClick={() => setWizardStep(WizardSteps.SelectPlatform)}>+ Back+ </Button>+ </div>+ </motion.div>+ )}+ {wizardStep === WizardSteps.GitHubManifest && selectedPlatform === "github" && (+ <motion.div+ key="github-manifest"+ transition={{ duration: 0.1 }}+ initial={{ opacity: 0, translateX: 30 }}+ animate={{ opacity: 1, translateX: 0 }}+ exit={{ opacity: 0, translateX: -30 }}+ >+ <div className="mb-4 text-xs text-mineshaft-200">+ The GitHub App Manifest flow lets you create a new GitHub App without manually+ configuring its settings. Infisical will redirect you to GitHub, where you can+ review and approve the app configuration. Once created, you can install the app on+ any of your GitHub organizations and use it as the basis for GitHub App connections+ in Infisical.+ </div>+ <form+ onSubmit={manifestForm.handleSubmit(handleSubmitManifest)}+ autoComplete="off"+ >+ <Controller+ control={manifestForm.control}+ name="name"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="GitHub App name"+ helperText="Used as the GitHub App's display name. Must be unique within this organization."+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="My Company GitHub App" {...field} />+ </FormControl>+ )}+ />+ <Controller+ control={manifestForm.control}+ name="organization"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="GitHub Organization"+ helperText="Optional. If set, the app will be registered under this GitHub organization."+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="my-github-org" {...field} />+ </FormControl>+ )}+ />+ <div className="mt-6 flex items-center space-x-4">+ <Button+ type="submit"+ isLoading={manifestForm.formState.isSubmitting}+ isDisabled={manifestForm.formState.isSubmitting}+ >+ Create GitHub App on GitHub →+ </Button>+ <Button+ variant="outline_bg"+ onClick={() => setWizardStep(WizardSteps.SelectMethod)}+ >+ Back+ </Button>+ </div>+ </form>+ </motion.div>+ )}+ {wizardStep === WizardSteps.GitHubManual && selectedPlatform === "github" && (+ <motion.div+ key="github-manual"+ transition={{ duration: 0.1 }}+ initial={{ opacity: 0, translateX: 30 }}+ animate={{ opacity: 1, translateX: 0 }}+ exit={{ opacity: 0, translateX: -30 }}+ >+ <div className="mb-4 text-xs text-mineshaft-200">+ Provide your existing GitHub App credentials. These will be securely encrypted and+ stored in Infisical.+ </div>+ <form+ onSubmit={manualForm.handleSubmit(handleSubmitManual)}+ autoComplete="off"+ >+ <Controller+ control={manualForm.control}+ name="name"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Display name"+ helperText="A name to identify this app in Infisical. Must be unique within this organization."+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="My Company GitHub App" {...field} />+ </FormControl>+ )}+ />+ <div className="flex space-x-3">+ <Controller+ control={manualForm.control}+ name="appId"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ className="flex-1"+ label="App ID"+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="123456" {...field} />+ </FormControl>+ )}+ />+ <Controller+ control={manualForm.control}+ name="slug"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ className="flex-1"+ label="App slug"+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="my-company-github-app" {...field} />+ </FormControl>+ )}+ />+ </div>+ <Controller+ control={manualForm.control}+ name="clientId"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Client ID"+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input placeholder="Iv1.a1b2c3d4e5f6g7h8" {...field} />+ </FormControl>+ )}+ />+ <Controller+ control={manualForm.control}+ name="clientSecret"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Client secret"+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <Input type="password" placeholder="••••••••••••••••" {...field} />+ </FormControl>+ )}+ />+ <Controller+ control={manualForm.control}+ name="privateKey"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Private key"+ helperText="The PEM-encoded private key generated for your GitHub App."+ isRequired+ errorText={error?.message}+ isError={Boolean(error)}+ >+ <TextArea+ placeholder="-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----"+ className="h-28 font-mono text-xs"+ {...field}+ />+ </FormControl>+ )}+ />+ <div className="mt-6 flex items-center space-x-4">+ <Button+ type="submit"+ isLoading={manualForm.formState.isSubmitting || registerGitHubApp.isPending}+ isDisabled={manualForm.formState.isSubmitting || registerGitHubApp.isPending}+ >+ Register GitHub App+ </Button>+ <Button+ variant="outline_bg"+ onClick={() => setWizardStep(WizardSteps.SelectMethod)}+ >+ Back+ </Button>+ </div>+ </form>+ </motion.div>+ )}+ </AnimatePresence>+ </ModalContent>+ </Modal>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/AddWorkflowIntegrationForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/AddWorkflowIntegrationForm.tsxsimilarity index 100%rename from frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/AddWorkflowIntegrationForm.tsxrename to frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/AddWorkflowIntegrationForm.tsxdiff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/IntegrationFormDetails.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/IntegrationFormDetails.tsxsimilarity index 100%rename from frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/IntegrationFormDetails.tsxrename to frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/IntegrationFormDetails.tsxdiff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/MicrosoftTeamsIntegrationForm.tsxsimilarity index 100%rename from frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsxrename to frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/MicrosoftTeamsIntegrationForm.tsxdiff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgAppsSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgAppsSection.tsxnew file mode 100644index 0000000000..22f9455ff8--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgAppsSection.tsx@@ -0,0 +1,165 @@+import { faGithub } from "@fortawesome/free-brands-svg-icons";+import { faEllipsis, faPlug, faPlus } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { format } from "date-fns";+import { twMerge } from "tailwind-merge";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import {+ Button,+ DeleteActionModal,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ EmptyState,+ Table,+ TableContainer,+ TableSkeleton,+ TBody,+ Td,+ THead,+ Tr+} from "@app/components/v2";+import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";+import { usePopUp } from "@app/hooks";+import { useDeleteGitHubApp, useListGitHubApps } from "@app/hooks/api/gitHubApps";++import { AddGitHubAppModal } from "./AddGitHubAppModal";++export const OrgAppsSection = () => {+ const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([+ "addAppConnection",+ "removeAppConnection"+ ] as const);++ const { currentOrg } = useOrganization();++ const { data: gitHubApps, isPending } = useListGitHubApps(currentOrg?.id);+ const { mutateAsync: deleteGitHubApp } = useDeleteGitHubApp();++ const handleRemove = async () => {+ if (!popUp.removeAppConnection?.data?.id) return;+ try {+ await deleteGitHubApp({ id: popUp.removeAppConnection.data.id as string });+ createNotification({ text: "Successfully removed GitHub App.", type: "success" });+ } catch (err) {+ createNotification({+ text: (err as Error).message || "Failed to delete GitHub App.",+ type: "error"+ });+ } finally {+ handlePopUpClose("removeAppConnection");+ }+ };++ return (+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="flex justify-between">+ <p className="text-xl font-medium text-mineshaft-100">Apps</p>+ <OrgPermissionCan I={OrgPermissionActions.Create} an={OrgPermissionSubjects.Settings}>+ {(isAllowed) => (+ <Button+ onClick={() => handlePopUpOpen("addAppConnection")}+ isDisabled={!isAllowed}+ leftIcon={<FontAwesomeIcon icon={faPlus} />}+ >+ Add+ </Button>+ )}+ </OrgPermissionCan>+ </div>+ <p className="mb-4 text-gray-400">Connect Infisical to other apps for app connections integrations.</p>+ <TableContainer>+ <Table>+ <THead>+ <Tr>+ <Td>Platform</Td>+ <Td>Name</Td>+ <Td>App ID</Td>+ <Td>Slug</Td>+ <Td>Created</Td>+ <Td />+ </Tr>+ </THead>+ <TBody>+ {isPending && <TableSkeleton columns={6} innerKey="github-apps-loading" />}+ {!isPending && gitHubApps && gitHubApps.length === 0 && (+ <Tr>+ <Td colSpan={6}>+ <EmptyState title="No app integrations found" icon={faPlug} />+ </Td>+ </Tr>+ )}+ {gitHubApps?.map((app) => (+ <Tr key={app.id}>+ <Td className="flex items-center gap-2">+ <FontAwesomeIcon icon={faGithub} />+ GitHub+ </Td>+ <Td>{app.name}</Td>+ <Td>{app.appId}</Td>+ <Td>+ <a+ href={`https://github.com/apps/${app.slug}`}+ target="_blank"+ rel="noopener noreferrer"+ className="text-primary-400 hover:underline"+ >+ {app.slug}+ </a>+ </Td>+ <Td>{format(new Date(app.createdAt), "yyyy-MM-dd")}</Td>+ <Td>+ <DropdownMenu>+ <DropdownMenuTrigger asChild className="rounded-lg">+ <div className="flex justify-end hover:text-primary-400 data-[state=open]:text-primary-400">+ <FontAwesomeIcon size="sm" icon={faEllipsis} />+ </div>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="p-1">+ <OrgPermissionCan+ I={OrgPermissionActions.Delete}+ an={OrgPermissionSubjects.Settings}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ disabled={!isAllowed}+ className={twMerge(+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={(e) => {+ e.stopPropagation();+ handlePopUpOpen("removeAppConnection", {+ id: app.id,+ name: app.name+ });+ }}+ >+ Delete+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </Td>+ </Tr>+ ))}+ </TBody>+ </Table>+ </TableContainer>+ <AddGitHubAppModal+ isOpen={popUp.addAppConnection.isOpen}+ onToggle={(state) => handlePopUpToggle("addAppConnection", state)}+ />+ <DeleteActionModal+ isOpen={popUp.removeAppConnection.isOpen}+ title={`Are you sure you want to remove ${popUp?.removeAppConnection?.data?.name as string}?`}+ onChange={(isOpen) => handlePopUpToggle("removeAppConnection", isOpen)}+ deleteKey="confirm"+ onDeleteApproved={handleRemove}+ />+ </div>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgIntegrationTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgIntegrationTab.tsxnew file mode 100644index 0000000000..0c97321be9--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgIntegrationTab.tsx@@ -0,0 +1,15 @@+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";+import { withPermission } from "@app/hoc";++import { OrgAppsSection } from "./OrgAppsSection";+import { OrgWorkflowIntegrationSection } from "./OrgWorkflowIntegrationSection";++export const OrgIntegrationTab = withPermission(+ () => (+ <>+ <OrgWorkflowIntegrationSection />+ <OrgAppsSection />+ </>+ ),+ { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Settings }+);diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgWorkflowIntegrationSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgWorkflowIntegrationSection.tsxnew file mode 100644index 0000000000..92cca0734f--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/OrgWorkflowIntegrationSection.tsx@@ -0,0 +1,313 @@+import { BsMicrosoftTeams, BsSlack } from "react-icons/bs";+import { faEllipsis, faGear, faInfoCircle, faPlus } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import axios from "axios";+import { twMerge } from "tailwind-merge";++import { createNotification } from "@app/components/notifications";+import { OrgPermissionCan } from "@app/components/permissions";+import {+ Button,+ DeleteActionModal,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ EmptyState,+ Table,+ TableContainer,+ TableSkeleton,+ TBody,+ Td,+ THead,+ Tooltip,+ Tr+} from "@app/components/v2";+import { Badge } from "@app/components/v3";+import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";+import { usePopUp } from "@app/hooks";+import {+ fetchSlackReinstallUrl,+ useCheckMicrosoftTeamsIntegrationInstallationStatus,+ useDeleteMicrosoftTeamsIntegration,+ useDeleteSlackIntegration,+ useGetWorkflowIntegrations+} from "@app/hooks/api";+import {+ WorkflowIntegrationPlatform,+ WorkflowIntegrationStatus+} from "@app/hooks/api/workflowIntegrations/types";++import { AddWorkflowIntegrationForm } from "./AddWorkflowIntegrationForm";+import { IntegrationFormDetails } from "./IntegrationFormDetails";++const renderStatus = (status: WorkflowIntegrationStatus) => {+ if (status === WorkflowIntegrationStatus.Installed) {+ return <Badge variant="success">Installed</Badge>;+ }++ if (status === WorkflowIntegrationStatus.Pending) {+ return <Badge variant="warning">Pending</Badge>;+ }++ return <Badge variant="danger">Failed</Badge>;+};++export const OrgWorkflowIntegrationSection = () => {+ const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([+ "addWorkflowIntegration",+ "integrationDetails",+ "removeIntegration"+ ] as const);++ const { currentOrg } = useOrganization();+ const { data: workflowIntegrations, isPending: isWorkflowIntegrationsLoading } =+ useGetWorkflowIntegrations(currentOrg?.id);++ const { mutateAsync: deleteSlackIntegration } = useDeleteSlackIntegration();+ const { mutateAsync: deleteMicrosoftTeamsIntegration } = useDeleteMicrosoftTeamsIntegration();+ const { mutateAsync: checkMicrosoftTeamsInstallationStatus } =+ useCheckMicrosoftTeamsIntegrationInstallationStatus();++ const handleRemoveIntegration = async () => {+ if (!currentOrg) {+ return;+ }++ const { platform, id } = popUp.removeIntegration.data;+ if (platform === WorkflowIntegrationPlatform.SLACK) {+ await deleteSlackIntegration({+ id,+ orgId: currentOrg?.id+ });+ }++ if (platform === WorkflowIntegrationPlatform.MICROSOFT_TEAMS) {+ await deleteMicrosoftTeamsIntegration({+ id,+ orgId: currentOrg?.id+ });+ }++ handlePopUpClose("removeIntegration");+ createNotification({+ text: "Successfully deleted integration",+ type: "success"+ });+ };++ const triggerSlackReinstall = async (id: string) => {+ try {+ const slackReinstallUrl = await fetchSlackReinstallUrl({+ id+ });++ if (slackReinstallUrl) {+ window.location.href = slackReinstallUrl;+ }+ } catch (err) {+ if (axios.isAxiosError(err)) {+ createNotification({+ text: (err.response?.data as { message: string })?.message,+ type: "error"+ });+ }+ }+ };++ const triggerMicrosoftTeamsInstallationStatusCheck = async (id: string) => {+ await checkMicrosoftTeamsInstallationStatus({+ workflowIntegrationId: id,+ orgId: currentOrg?.id+ });++ createNotification({+ text: "The Microsoft Teams bot is successfully installed in your Microsoft Teams tenant",+ type: "success"+ });+ };++ return (+ <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">+ <div className="flex justify-between">+ <p className="text-xl font-medium text-mineshaft-100">Workflows</p>+ <OrgPermissionCan I={OrgPermissionActions.Create} an={OrgPermissionSubjects.Settings}>+ {(isAllowed) => (+ <Button+ onClick={() => {+ handlePopUpOpen("addWorkflowIntegration");+ }}+ isDisabled={!isAllowed}+ leftIcon={<FontAwesomeIcon icon={faPlus} />}+ >+ Add+ </Button>+ )}+ </OrgPermissionCan>+ </div>+ <p className="mb-4 text-gray-400">+ Connect Infisical to other platforms for notification and workflow integrations.+ </p>+ <TableContainer>+ <Table>+ <THead>+ <Tr>+ <Td>Provider</Td>+ <Td>Alias</Td>+ <Td>Status</Td>+ </Tr>+ </THead>+ <TBody>+ {isWorkflowIntegrationsLoading && (+ <TableSkeleton columns={2} innerKey="integrations-loading" />+ )}+ {!isWorkflowIntegrationsLoading &&+ workflowIntegrations &&+ workflowIntegrations.length === 0 && (+ <Tr>+ <Td colSpan={5}>+ <EmptyState title="No workflow integrations found" icon={faGear} />+ </Td>+ </Tr>+ )}+ {workflowIntegrations?.map((workflowIntegration) => (+ <Tr key={workflowIntegration.id}>+ <Td className="flex max-w-xs items-center gap-2 overflow-hidden text-ellipsis hover:overflow-auto hover:break-all">+ {workflowIntegration.integration === WorkflowIntegrationPlatform.SLACK ? (+ <BsSlack />+ ) : (+ <BsMicrosoftTeams />+ )}+ <div className="capitalize">+ {workflowIntegration.integration.replaceAll("-", " ")}+ </div>+ {workflowIntegration.description && (+ <Tooltip content={workflowIntegration.description}>+ <FontAwesomeIcon icon={faInfoCircle} className="text-gray-400" size="sm" />+ </Tooltip>+ )}+ </Td>+ <Td>{workflowIntegration.slug}</Td>+ <Td>{renderStatus(workflowIntegration.status)}</Td>+ <Td>+ <DropdownMenu>+ <DropdownMenuTrigger asChild className="rounded-lg">+ <div className="flex justify-end hover:text-primary-400 data-[state=open]:text-primary-400">+ <FontAwesomeIcon size="sm" icon={faEllipsis} />+ </div>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="p-1">+ <DropdownMenuItem+ onClick={(e) => {+ e.stopPropagation();++ handlePopUpOpen("integrationDetails", {+ id: workflowIntegration.id,+ platform: workflowIntegration.integration+ });+ }}+ >+ More details+ </DropdownMenuItem>++ {workflowIntegration.integration === WorkflowIntegrationPlatform.SLACK && (+ <OrgPermissionCan+ I={OrgPermissionActions.Create}+ an={OrgPermissionSubjects.Settings}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ disabled={!isAllowed}+ className={twMerge(+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={async (e) => {+ e.stopPropagation();++ await triggerSlackReinstall(workflowIntegration.id);+ }}+ >+ Reinstall+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ )}++ {workflowIntegration.integration ===+ WorkflowIntegrationPlatform.MICROSOFT_TEAMS && (+ <OrgPermissionCan+ I={OrgPermissionActions.Edit}+ an={OrgPermissionSubjects.Settings}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ disabled={!isAllowed}+ className={twMerge(+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={async (e) => {+ e.stopPropagation();++ await triggerMicrosoftTeamsInstallationStatusCheck(+ workflowIntegration.id+ );+ }}+ >+ Check Installation Status+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ )}++ <OrgPermissionCan+ I={OrgPermissionActions.Delete}+ an={OrgPermissionSubjects.Settings}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ disabled={!isAllowed}+ className={twMerge(+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"+ )}+ onClick={(e) => {+ e.stopPropagation();++ handlePopUpOpen("removeIntegration", {+ id: workflowIntegration.id,+ slug: workflowIntegration.slug,+ platform: workflowIntegration.integration+ });+ }}+ >+ Delete+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </Td>+ </Tr>+ ))}+ </TBody>+ </Table>+ </TableContainer>+ <AddWorkflowIntegrationForm+ isOpen={popUp.addWorkflowIntegration.isOpen}+ onToggle={(state) => handlePopUpToggle("addWorkflowIntegration", state)}+ />+ <IntegrationFormDetails+ isOpen={popUp.integrationDetails?.isOpen}+ workflowPlatform={popUp.integrationDetails?.data?.platform}+ id={popUp.integrationDetails?.data?.id}+ onOpenChange={(state) => handlePopUpToggle("integrationDetails", state)}+ />+ <DeleteActionModal+ isOpen={popUp.removeIntegration.isOpen}+ title={`Are you sure you want to remove ${popUp?.removeIntegration?.data?.slug}?`}+ onChange={(isOpen) => handlePopUpToggle("removeIntegration", isOpen)}+ deleteKey="confirm"+ onDeleteApproved={handleRemoveIntegration}+ />+ </div>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/SlackIntegrationForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/SlackIntegrationForm.tsxsimilarity index 100%rename from frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/SlackIntegrationForm.tsxrename to frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/SlackIntegrationForm.tsxdiff --git a/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/index.ts b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/index.tsnew file mode 100644index 0000000000..5b08ec28f3--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/OrgIntegrationTab/index.ts@@ -0,0 +1 @@+export * from "./OrgIntegrationTab";diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsxindex bdf79ee996..c27a00afa8 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx@@ -10,12 +10,12 @@ import { AuditLogStreamsTab } from "../AuditLogStreamTab";import { ExternalMigrationsTab } from "../ExternalMigrationsTab";import { OrgEncryptionTab } from "../OrgEncryptionTab";import { OrgGeneralTab } from "../OrgGeneralTab";+import { OrgIntegrationTab } from "../OrgIntegrationTab";import { OrgProductSettingsTab } from "../OrgProductSettingsTab";import { OrgProvisioningTab } from "../OrgProvisioningTab";import { OrgSecurityTab } from "../OrgSecurityTab";import { OrgSsoTab } from "../OrgSsoTab";import { OrgSubOrgsTab } from "../OrgSubOrgsTab";-import { OrgWorkflowIntegrationTab } from "../OrgWorkflowIntegrationTab";import { ProjectTemplatesTab } from "../ProjectTemplatesTab";export const OrgTabGroup = () => {@@ -53,9 +53,9 @@ export const OrgTabGroup = () => {component: OrgEncryptionTab},{- name: "Workflow Integrations",- key: "workflow-integrations",- component: OrgWorkflowIntegrationTab+ name: "Integrations",+ key: "integrations",+ component: OrgIntegrationTab},{ name: "Audit Log Streams", key: "tag-audit-log-streams", component: AuditLogStreamsTab },{diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/OrgWorkflowIntegrationTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/OrgWorkflowIntegrationTab.tsxdeleted file mode 100644index 2bf8fd5d30..0000000000--- a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/OrgWorkflowIntegrationTab.tsx+++ /dev/null@@ -1,317 +0,0 @@-import { BsMicrosoftTeams, BsSlack } from "react-icons/bs";-import { faEllipsis, faGear, faInfoCircle, faPlus } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import axios from "axios";-import { twMerge } from "tailwind-merge";--import { createNotification } from "@app/components/notifications";-import { OrgPermissionCan } from "@app/components/permissions";-import {- Button,- DeleteActionModal,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- EmptyState,- Table,- TableContainer,- TableSkeleton,- TBody,- Td,- THead,- Tooltip,- Tr-} from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";-import { withPermission } from "@app/hoc";-import { usePopUp } from "@app/hooks";-import {- fetchSlackReinstallUrl,- useCheckMicrosoftTeamsIntegrationInstallationStatus,- useDeleteMicrosoftTeamsIntegration,- useDeleteSlackIntegration,- useGetWorkflowIntegrations-} from "@app/hooks/api";-import {- WorkflowIntegrationPlatform,- WorkflowIntegrationStatus-} from "@app/hooks/api/workflowIntegrations/types";--import { AddWorkflowIntegrationForm } from "./AddWorkflowIntegrationForm";-import { IntegrationFormDetails } from "./IntegrationFormDetails";--const renderStatus = (status: WorkflowIntegrationStatus) => {- if (status === WorkflowIntegrationStatus.Installed) {- return <Badge variant="success">Installed</Badge>;- }-- if (status === WorkflowIntegrationStatus.Pending) {- return <Badge variant="warning">Pending</Badge>;- }-- return <Badge variant="danger">Failed</Badge>;-};--export const OrgWorkflowIntegrationTab = withPermission(- () => {- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([- "addWorkflowIntegration",- "integrationDetails",- "removeIntegration"- ] as const);-- const { currentOrg } = useOrganization();- const { data: workflowIntegrations, isPending: isWorkflowIntegrationsLoading } =- useGetWorkflowIntegrations(currentOrg?.id);-- const { mutateAsync: deleteSlackIntegration } = useDeleteSlackIntegration();- const { mutateAsync: deleteMicrosoftTeamsIntegration } = useDeleteMicrosoftTeamsIntegration();- const { mutateAsync: checkMicrosoftTeamsInstallationStatus } =- useCheckMicrosoftTeamsIntegrationInstallationStatus();-- const handleRemoveIntegration = async () => {- if (!currentOrg) {- return;- }-- const { platform, id } = popUp.removeIntegration.data;- if (platform === WorkflowIntegrationPlatform.SLACK) {- await deleteSlackIntegration({- id,- orgId: currentOrg?.id- });- }-- if (platform === WorkflowIntegrationPlatform.MICROSOFT_TEAMS) {- await deleteMicrosoftTeamsIntegration({- id,- orgId: currentOrg?.id- });- }-- handlePopUpClose("removeIntegration");- createNotification({- text: "Successfully deleted integration",- type: "success"- });- };-- const triggerSlackReinstall = async (id: string) => {- try {- const slackReinstallUrl = await fetchSlackReinstallUrl({- id- });-- if (slackReinstallUrl) {- window.location.href = slackReinstallUrl;- }- } catch (err) {- if (axios.isAxiosError(err)) {- createNotification({- text: (err.response?.data as { message: string })?.message,- type: "error"- });- }- }- };-- const triggerMicrosoftTeamsInstallationStatusCheck = async (id: string) => {- await checkMicrosoftTeamsInstallationStatus({- workflowIntegrationId: id,- orgId: currentOrg?.id- });-- createNotification({- text: "The Microsoft Teams bot is successfully installed in your Microsoft Teams tenant",- type: "success"- });- };-- return (- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <div className="flex justify-between">- <p className="text-xl font-medium text-mineshaft-100">Workflow Integrations</p>- <OrgPermissionCan I={OrgPermissionActions.Create} an={OrgPermissionSubjects.Settings}>- {(isAllowed) => (- <Button- onClick={() => {- handlePopUpOpen("addWorkflowIntegration");- }}- isDisabled={!isAllowed}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- >- Add- </Button>- )}- </OrgPermissionCan>- </div>- <p className="mb-4 text-gray-400">- Connect Infisical to other platforms for notification and workflow integrations.- </p>- <TableContainer>- <Table>- <THead>- <Tr>- <Td>Provider</Td>- <Td>Alias</Td>- <Td>Status</Td>- </Tr>- </THead>- <TBody>- {isWorkflowIntegrationsLoading && (- <TableSkeleton columns={2} innerKey="integrations-loading" />- )}- {!isWorkflowIntegrationsLoading &&- workflowIntegrations &&- workflowIntegrations.length === 0 && (- <Tr>- <Td colSpan={5}>- <EmptyState title="No workflow integrations found" icon={faGear} />- </Td>- </Tr>- )}- {workflowIntegrations?.map((workflowIntegration) => (- <Tr key={workflowIntegration.id}>- <Td className="flex max-w-xs items-center gap-2 overflow-hidden text-ellipsis hover:overflow-auto hover:break-all">- {workflowIntegration.integration === WorkflowIntegrationPlatform.SLACK ? (- <BsSlack />- ) : (- <BsMicrosoftTeams />- )}- <div className="capitalize">- {workflowIntegration.integration.replaceAll("-", " ")}- </div>- {workflowIntegration.description && (- <Tooltip content={workflowIntegration.description}>- <FontAwesomeIcon icon={faInfoCircle} className="text-gray-400" size="sm" />- </Tooltip>- )}- </Td>- <Td>{workflowIntegration.slug}</Td>- <Td>{renderStatus(workflowIntegration.status)}</Td>- <Td>- <DropdownMenu>- <DropdownMenuTrigger asChild className="rounded-lg">- <div className="flex justify-end hover:text-primary-400 data-[state=open]:text-primary-400">- <FontAwesomeIcon size="sm" icon={faEllipsis} />- </div>- </DropdownMenuTrigger>- <DropdownMenuContent align="start" className="p-1">- <DropdownMenuItem- onClick={(e) => {- e.stopPropagation();-- handlePopUpOpen("integrationDetails", {- id: workflowIntegration.id,- platform: workflowIntegration.integration- });- }}- >- More details- </DropdownMenuItem>-- {workflowIntegration.integration === WorkflowIntegrationPlatform.SLACK && (- <OrgPermissionCan- I={OrgPermissionActions.Create}- an={OrgPermissionSubjects.Settings}- >- {(isAllowed) => (- <DropdownMenuItem- disabled={!isAllowed}- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={async (e) => {- e.stopPropagation();-- await triggerSlackReinstall(workflowIntegration.id);- }}- >- Reinstall- </DropdownMenuItem>- )}- </OrgPermissionCan>- )}-- {workflowIntegration.integration ===- WorkflowIntegrationPlatform.MICROSOFT_TEAMS && (- <OrgPermissionCan- I={OrgPermissionActions.Edit}- an={OrgPermissionSubjects.Settings}- >- {(isAllowed) => (- <DropdownMenuItem- disabled={!isAllowed}- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={async (e) => {- e.stopPropagation();-- await triggerMicrosoftTeamsInstallationStatusCheck(- workflowIntegration.id- );- }}- >- Check Installation Status- </DropdownMenuItem>- )}- </OrgPermissionCan>- )}-- <OrgPermissionCan- I={OrgPermissionActions.Delete}- an={OrgPermissionSubjects.Settings}- >- {(isAllowed) => (- <DropdownMenuItem- disabled={!isAllowed}- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={(e) => {- e.stopPropagation();-- handlePopUpOpen("removeIntegration", {- id: workflowIntegration.id,- slug: workflowIntegration.slug,- platform: workflowIntegration.integration- });- }}- >- Delete- </DropdownMenuItem>- )}- </OrgPermissionCan>- </DropdownMenuContent>- </DropdownMenu>- </Td>- </Tr>- ))}- </TBody>- </Table>- </TableContainer>- <AddWorkflowIntegrationForm- isOpen={popUp.addWorkflowIntegration.isOpen}- onToggle={(state) => handlePopUpToggle("addWorkflowIntegration", state)}- />- <IntegrationFormDetails- isOpen={popUp.integrationDetails?.isOpen}- workflowPlatform={popUp.integrationDetails?.data?.platform}- id={popUp.integrationDetails?.data?.id}- onOpenChange={(state) => handlePopUpToggle("integrationDetails", state)}- />- <DeleteActionModal- isOpen={popUp.removeIntegration.isOpen}- title={`Are you sure you want to remove ${popUp?.removeIntegration?.data?.slug}?`}- onChange={(isOpen) => handlePopUpToggle("removeIntegration", isOpen)}- deleteKey="confirm"- onDeleteApproved={handleRemoveIntegration}- />- </div>- );- },- { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Settings }-);diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/index.ts b/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/index.tsdeleted file mode 100644index 5b63fc1b8c..0000000000--- a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./OrgWorkflowIntegrationTab";diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex 43fcb88b64..fead125e24 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -77,6 +77,7 @@ import { Route as organizationAppConnectionsAppConnectionsPageRouteImport } fromimport { Route as secretManagerRedirectsRedirectApprovalPageImport } from './pages/secret-manager/redirects/redirect-approval-page'import { Route as organizationSettingsPageOauthCallbackPageRouteImport } from './pages/organization/SettingsPage/OauthCallbackPage/route'import { Route as organizationNetworkingPageRelayDetailsByIDPageRouteImport } from './pages/organization/NetworkingPage/RelayDetailsByIDPage/route'+import { Route as organizationSettingsPageGitHubAppCallbackPageRouteImport } from './pages/organization/SettingsPage/GitHubAppCallbackPage/route'import { Route as organizationNetworkingPageGatewayDetailsByIDPageRouteImport } from './pages/organization/NetworkingPage/GatewayDetailsByIDPage/route'import { Route as sshLayoutImport } from './pages/ssh/layout'import { Route as secretScanningLayoutImport } from './pages/secret-scanning/layout'@@ -1036,6 +1037,14 @@ const organizationNetworkingPageRelayDetailsByIDPageRouteRoute =AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute,} as any)+const organizationSettingsPageGitHubAppCallbackPageRouteRoute =+ organizationSettingsPageGitHubAppCallbackPageRouteImport.update({+ id: '/github-app/callback',+ path: '/github-app/callback',+ getParentRoute: () =>+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRoute,+ } as any)+const organizationNetworkingPageGatewayDetailsByIDPageRouteRoute =organizationNetworkingPageGatewayDetailsByIDPageRouteImport.update({id: '/gateways/$gatewayId',@@ -3246,6 +3255,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof organizationNetworkingPageRelayDetailsByIDPageRouteImportparentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback'+ path: '/github-app/callback'+ fullPath: '/organizations/$orgId/settings/github-app/callback'+ preLoaderRoute: typeof organizationSettingsPageGitHubAppCallbackPageRouteImport+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback'path: '/oauth/callback'@@ -5975,12 +5991,15 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteWinterface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteChildren {organizationSettingsPageRouteRoute: typeof organizationSettingsPageRouteRoute+ organizationSettingsPageGitHubAppCallbackPageRouteRoute: typeof organizationSettingsPageGitHubAppCallbackPageRouteRouteorganizationSettingsPageOauthCallbackPageRouteRoute: typeof organizationSettingsPageOauthCallbackPageRouteRoute}const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteChildren ={organizationSettingsPageRouteRoute: organizationSettingsPageRouteRoute,+ organizationSettingsPageGitHubAppCallbackPageRouteRoute:+ organizationSettingsPageGitHubAppCallbackPageRouteRoute,organizationSettingsPageOauthCallbackPageRouteRoute:organizationSettingsPageOauthCallbackPageRouteRoute,}@@ -6323,6 +6342,7 @@ export interface FileRoutesByFullPath {'/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute'/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute'/organizations/$orgId/networking/relays/$relayId': typeof organizationNetworkingPageRelayDetailsByIDPageRouteRoute+ '/organizations/$orgId/settings/github-app/callback': typeof organizationSettingsPageGitHubAppCallbackPageRouteRoute'/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren'/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren@@ -6609,6 +6629,7 @@ export interface FileRoutesByTo {'/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute'/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute'/organizations/$orgId/networking/relays/$relayId': typeof organizationNetworkingPageRelayDetailsByIDPageRouteRoute+ '/organizations/$orgId/settings/github-app/callback': typeof organizationSettingsPageGitHubAppCallbackPageRouteRoute'/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren'/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerDashboardPageRouteIndexRoute@@ -6888,6 +6909,7 @@ export interface FileRoutesById {'/_authenticate/_inject-org-details/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/relays/$relayId': typeof organizationNetworkingPageRelayDetailsByIDPageRouteRoute+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback': typeof organizationSettingsPageGitHubAppCallbackPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRouteWithChildren'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRouteWithChildren@@ -7191,6 +7213,7 @@ export interface FileRouteTypes {| '/organization/app-connections/$appConnection/oauth/callback'| '/organizations/$orgId/networking/gateways/$gatewayId'| '/organizations/$orgId/networking/relays/$relayId'+ | '/organizations/$orgId/settings/github-app/callback'| '/organizations/$orgId/settings/oauth/callback'| '/organizations/$orgId/projects/ai/$projectId'| '/organizations/$orgId/projects/cert-manager/$projectId'@@ -7476,6 +7499,7 @@ export interface FileRouteTypes {| '/organization/app-connections/$appConnection/oauth/callback'| '/organizations/$orgId/networking/gateways/$gatewayId'| '/organizations/$orgId/networking/relays/$relayId'+ | '/organizations/$orgId/settings/github-app/callback'| '/organizations/$orgId/settings/oauth/callback'| '/organizations/$orgId/projects/ai/$projectId'| '/organizations/$orgId/projects/cert-manager/$projectId'@@ -7753,6 +7777,7 @@ export interface FileRouteTypes {| '/_authenticate/_inject-org-details/organization/app-connections/$appConnection/oauth/callback'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/relays/$relayId'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId'@@ -8332,6 +8357,7 @@ export const routeTree = rootRoute"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId","children": ["/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback"]},@@ -8430,6 +8456,10 @@ export const routeTree = rootRoute"filePath": "organization/NetworkingPage/RelayDetailsByIDPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/github-app/callback": {+ "filePath": "organization/SettingsPage/GitHubAppCallbackPage/route.tsx",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings"+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback": {"filePath": "organization/SettingsPage/OauthCallbackPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings"diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex 32d32d6c37..3cf8fff59f 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -449,7 +449,8 @@ const organizationRoutes = route("/organizations/$orgId", [route("/secret-sharing", [index("organization/SecretSharingPage/route.tsx")]),route("/settings", [index("organization/SettingsPage/route.tsx"),- route("/oauth/callback", "organization/SettingsPage/OauthCallbackPage/route.tsx")+ route("/oauth/callback", "organization/SettingsPage/OauthCallbackPage/route.tsx"),+ route("/github-app/callback", "organization/SettingsPage/GitHubAppCallbackPage/route.tsx")]),route("/groups/$groupId", "organization/GroupDetailsByIDPage/route.tsx"),route("/members/$membershipId", "organization/UserDetailsByIDPage/route.tsx"),