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 app connection for ona/gitpod
adilson7788d15f5c38
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 7cc06bd9fa..8cd66ae482 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2640,6 +2640,9 @@ export const AppConnections = {VERCEL: {apiToken: "The API token used to authenticate with Vercel."},+ ONA: {+ personalAccessToken: "The Personal Access Token used to authenticate with Ona."+ },CAMUNDA: {clientId: "The client ID used to authenticate with Camunda.",clientSecret: "The client secret used to authenticate with Camunda."diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 66de308e1b..e430dd092f 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -135,6 +135,7 @@ import {SanitizedOctopusDeployConnectionSchema} from "@app/services/app-connection/octopus-deploy";import { OktaConnectionListItemSchema, SanitizedOktaConnectionSchema } from "@app/services/app-connection/okta";+import { OnaConnectionListItemSchema, SanitizedOnaConnectionSchema } from "@app/services/app-connection/ona";import {OpenRouterConnectionListItemSchema,SanitizedOpenRouterConnectionSchema@@ -233,7 +234,8 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedVenafiConnectionSchema.options,...SanitizedExternalInfisicalConnectionSchema.options,...SanitizedDopplerConnectionSchema.options,- ...SanitizedNetScalerConnectionSchema.options+ ...SanitizedNetScalerConnectionSchema.options,+ ...SanitizedOnaConnectionSchema.options]);const AppConnectionOptionsSchema = z.discriminatedUnion("app", [@@ -293,7 +295,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [ExternalInfisicalConnectionListItemSchema,DopplerConnectionListItemSchema,NetScalerConnectionListItemSchema,- AnthropicConnectionListItemSchema+ AnthropicConnectionListItemSchema,+ OnaConnectionListItemSchema]);export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 8a9fc98591..170522d3f6 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -43,6 +43,7 @@ import { registerNetScalerConnectionRouter } from "./netscaler-connection-routerimport { registerNorthflankConnectionRouter } from "./northflank-connection-router";import { registerOctopusDeployConnectionRouter } from "./octopus-deploy-connection-router";import { registerOktaConnectionRouter } from "./okta-connection-router";+import { registerOnaConnectionRouter } from "./ona-connection-router";import { registerOpenRouterConnectionRouter } from "./open-router-connection-router";import { registerPostgresConnectionRouter } from "./postgres-connection-router";import { registerRailwayConnectionRouter } from "./railway-connection-router";@@ -118,5 +119,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.ExternalInfisical]: registerExternalInfisicalConnectionRouter,[AppConnection.Doppler]: registerDopplerConnectionRouter,[AppConnection.NetScaler]: registerNetScalerConnectionRouter,- [AppConnection.Anthropic]: registerAnthropicConnectionRouter+ [AppConnection.Anthropic]: registerAnthropicConnectionRouter,+ [AppConnection.Ona]: registerOnaConnectionRouter};diff --git a/backend/src/server/routes/v1/app-connection-routers/ona-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/ona-connection-router.tsnew file mode 100644index 0000000000..10192fd14c--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/ona-connection-router.ts@@ -0,0 +1,54 @@+import z from "zod";++import { readLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreateOnaConnectionSchema,+ SanitizedOnaConnectionSchema,+ UpdateOnaConnectionSchema+} from "@app/services/app-connection/ona";+import { AuthMode } from "@app/services/auth/auth-type";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerOnaConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.Ona,+ server,+ sanitizedResponseSchema: SanitizedOnaConnectionSchema,+ createSchema: CreateOnaConnectionSchema,+ updateSchema: UpdateOnaConnectionSchema+ });++ // The below endpoints are not exposed and for Infisical App use+ server.route({+ method: "GET",+ url: `/:connectionId/projects`,+ config: {+ rateLimit: readLimit+ },+ schema: {+ operationId: "listOnaProjects",+ params: z.object({+ connectionId: z.string().uuid()+ }),+ response: {+ 200: z+ .object({+ id: z.string(),+ name: z.string()+ })+ .array()+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const { connectionId } = req.params;++ const projects = await server.services.appConnection.ona.listProjects(connectionId, req.permission);++ return projects;+ }+ });+};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex 53ea4f312e..507afc156a 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -55,7 +55,8 @@ export enum AppConnection {ExternalInfisical = "external-infisical",Doppler = "doppler",NetScaler = "netscaler",- Anthropic = "anthropic"+ Anthropic = "anthropic",+ Ona = "ona"}export enum AWSRegion {diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex ea24b7e4c0..edd780c85d 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -174,6 +174,7 @@ import {validateOctopusDeployConnectionCredentials} from "./octopus-deploy";import { getOktaConnectionListItem, OktaConnectionMethod, validateOktaConnectionCredentials } from "./okta";+import { getOnaConnectionListItem, OnaConnectionMethod, validateOnaConnectionCredentials } from "./ona";import {getOpenRouterConnectionListItem,OpenRouterConnectionMethod,@@ -294,7 +295,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getVenafiConnectionListItem(),getExternalInfisicalConnectionListItem(),getDopplerConnectionListItem(),- getNetScalerConnectionListItem()+ getNetScalerConnectionListItem(),+ getOnaConnectionListItem()].filter((option) => {switch (projectType) {@@ -441,6 +443,7 @@ export const validateAppConnectionCredentials = async ([AppConnection.AzureEntraId]: validateAzureEntraIdConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Venafi]: validateVenafiConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.NetScaler]: validateNetScalerConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.Ona]: validateOnaConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.ExternalInfisical]: ((config: TAppConnectionConfig) =>validateExternalInfisicalConnectionCredentials(config as TExternalInfisicalConnectionConfig,@@ -458,6 +461,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case GitHubRadarConnectionMethod.App:return "GitHub App";case GitHubConnectionMethod.Pat:+ case OnaConnectionMethod.PersonalAccessToken:return "Personal Access Token";case AzureKeyVaultConnectionMethod.OAuth:case AzureAppConfigurationConnectionMethod.OAuth:@@ -653,7 +657,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.Venafi]: platformManagedCredentialsNotSupported,[AppConnection.ExternalInfisical]: platformManagedCredentialsNotSupported,[AppConnection.Doppler]: platformManagedCredentialsNotSupported,- [AppConnection.NetScaler]: platformManagedCredentialsNotSupported+ [AppConnection.NetScaler]: platformManagedCredentialsNotSupported,+ [AppConnection.Ona]: platformManagedCredentialsNotSupported};export const enterpriseAppCheck = async (diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex f564dcffae..b6c7857f02 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -57,7 +57,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.ExternalInfisical]: "Infisical",[AppConnection.Doppler]: "Doppler",[AppConnection.NetScaler]: "NetScaler",- [AppConnection.Anthropic]: "Anthropic"+ [AppConnection.Anthropic]: "Anthropic",+ [AppConnection.Ona]: "Ona"};export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {@@ -117,5 +118,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.ExternalInfisical]: AppConnectionPlanType.Regular,[AppConnection.Doppler]: AppConnectionPlanType.Regular,[AppConnection.NetScaler]: AppConnectionPlanType.Regular,- [AppConnection.Anthropic]: AppConnectionPlanType.Regular+ [AppConnection.Anthropic]: AppConnectionPlanType.Regular,+ [AppConnection.Ona]: AppConnectionPlanType.Regular};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex d7b426bcf9..c03cd5e2bf 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -125,6 +125,8 @@ import { ValidateOctopusDeployConnectionCredentialsSchema } from "./octopus-deplimport { octopusDeployConnectionService } from "./octopus-deploy/octopus-deploy-connection-service";import { ValidateOktaConnectionCredentialsSchema } from "./okta";import { oktaConnectionService } from "./okta/okta-connection-service";+import { ValidateOnaConnectionCredentialsSchema } from "./ona";+import { onaConnectionService } from "./ona/ona-connection-service";import { ValidateOpenRouterConnectionCredentialsSchema } from "./open-router";import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";import { ValidateRailwayConnectionCredentialsSchema } from "./railway";@@ -222,7 +224,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.ExternalInfisical]: ValidateExternalInfisicalConnectionCredentialsSchema,[AppConnection.Doppler]: ValidateDopplerConnectionCredentialsSchema,[AppConnection.NetScaler]: ValidateNetScalerConnectionCredentialsSchema,- [AppConnection.Anthropic]: ValidateAnthropicConnectionCredentialsSchema+ [AppConnection.Anthropic]: ValidateAnthropicConnectionCredentialsSchema,+ [AppConnection.Ona]: ValidateOnaConnectionCredentialsSchema};export const appConnectionServiceFactory = ({@@ -1068,6 +1071,7 @@ export const appConnectionServiceFactory = ({terraformCloud: terraformCloudConnectionService(connectAppConnectionById),camunda: camundaConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),vercel: vercelConnectionService(connectAppConnectionById),+ ona: onaConnectionService(connectAppConnectionById),azureClientSecrets: azureClientSecretsConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),azureDevOps: azureDevOpsConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),auth0: auth0ConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 23070947ad..d2ba1cbd16 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -252,6 +252,12 @@ import {TOktaConnectionInput,TValidateOktaConnectionCredentialsSchema} from "./okta";+import {+ TOnaConnection,+ TOnaConnectionConfig,+ TOnaConnectionInput,+ TValidateOnaConnectionCredentialsSchema+} from "./ona";import {TOpenRouterConnection,TOpenRouterConnectionConfig,@@ -394,6 +400,7 @@ export type TAppConnection = { id: string } & (| TDopplerConnection| TNetScalerConnection| TAnthropicConnection+ | TOnaConnection);export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;@@ -462,6 +469,7 @@ export type TAppConnectionInput = { id: string } & (| TDopplerConnectionInput| TNetScalerConnectionInput| TAnthropicConnectionInput+ | TOnaConnectionInput);export type TSqlConnectionInput =@@ -558,7 +566,8 @@ export type TAppConnectionConfig =| TExternalInfisicalConnectionConfig| TDopplerConnectionConfig| TNetScalerConnectionConfig- | TAnthropicConnectionConfig;+ | TAnthropicConnectionConfig+ | TOnaConnectionConfig;export type TValidateAppConnectionCredentialsSchema =| TValidateAwsConnectionCredentialsSchema@@ -617,7 +626,8 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateExternalInfisicalConnectionCredentialsSchema| TValidateDopplerConnectionCredentialsSchema| TValidateNetScalerConnectionCredentialsSchema- | TValidateAnthropicConnectionCredentialsSchema;+ | TValidateAnthropicConnectionCredentialsSchema+ | TValidateOnaConnectionCredentialsSchema;export type TListAwsConnectionKmsKeys = {connectionId: string;diff --git a/backend/src/services/app-connection/ona/index.ts b/backend/src/services/app-connection/ona/index.tsnew file mode 100644index 0000000000..88ebcf97f4--- /dev/null+++ b/backend/src/services/app-connection/ona/index.ts@@ -0,0 +1,4 @@+export * from "./ona-connection-enums";+export * from "./ona-connection-fns";+export * from "./ona-connection-schemas";+export * from "./ona-connection-types";diff --git a/backend/src/services/app-connection/ona/ona-connection-enums.ts b/backend/src/services/app-connection/ona/ona-connection-enums.tsnew file mode 100644index 0000000000..41cf8b3856--- /dev/null+++ b/backend/src/services/app-connection/ona/ona-connection-enums.ts@@ -0,0 +1,3 @@+export enum OnaConnectionMethod {+ PersonalAccessToken = "personal-access-token"+}diff --git a/backend/src/services/app-connection/ona/ona-connection-fns.ts b/backend/src/services/app-connection/ona/ona-connection-fns.tsnew file mode 100644index 0000000000..0308759e3d--- /dev/null+++ b/backend/src/services/app-connection/ona/ona-connection-fns.ts@@ -0,0 +1,97 @@+/* eslint-disable no-await-in-loop */+import { AxiosError } from "axios";++import { request } from "@app/lib/config/request";+import { BadRequestError } from "@app/lib/errors";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import { IntegrationUrls } from "@app/services/integration-auth/integration-list";++import { OnaConnectionMethod } from "./ona-connection-enums";+import { TOnaConnection, TOnaConnectionConfig, TOnaProject, TOnaProjectListResponse } from "./ona-connection-types";++const GET_AUTHENTICATED_IDENTITY_PATH = "/gitpod.v1.IdentityService/GetAuthenticatedIdentity";+const ONA_LIST_PROJECTS_PATH = "/gitpod.v1.ProjectService/ListProjects";+const ONA_PAGE_SIZE = 100;+const ONA_MAX_PROJECTS = 1000;++export const getOnaConnectionListItem = () => {+ return {+ name: "Ona" as const,+ app: AppConnection.Ona as const,+ methods: Object.values(OnaConnectionMethod) as [OnaConnectionMethod.PersonalAccessToken]+ };+};++export const validateOnaConnectionCredentials = async (config: TOnaConnectionConfig) => {+ const { credentials: inputCredentials } = config;++ try {+ await request.post(`${IntegrationUrls.ONA_API_URL}${GET_AUTHENTICATED_IDENTITY_PATH}`, {+ headers: {+ Authorization: `Bearer ${inputCredentials.personalAccessToken}`,+ "Content-Type": "application/json"+ }+ });+ } catch (error: unknown) {+ if (error instanceof AxiosError) {+ throw new BadRequestError({+ message: `Failed to validate credentials: ${+ error.response?.data ? JSON.stringify(error.response?.data) : error.message || "Unknown error"+ }`+ });+ }+ throw new BadRequestError({+ message: `Unable to validate connection: ${(error as Error).message || "Verify credentials"}`+ });+ }++ return inputCredentials;+};++export const listOnaProjects = async (appConnection: TOnaConnection): Promise<TOnaProject[]> => {+ const { personalAccessToken } = appConnection.credentials;++ const allProjects: TOnaProject[] = [];+ let token: string | undefined;++ try {+ do {+ const body: { pagination: { pageSize: number; token?: string } } = {+ pagination: { pageSize: ONA_PAGE_SIZE, ...(token ? { token } : {}) }+ };++ const { data } = await request.post<TOnaProjectListResponse>(+ `${IntegrationUrls.ONA_API_URL}${ONA_LIST_PROJECTS_PATH}`,+ body,+ {+ headers: {+ Authorization: `Bearer ${personalAccessToken}`,+ "Content-Type": "application/json"+ }+ }+ );++ if (data?.projects?.length) {+ allProjects.push(+ ...data.projects.map((project) => ({+ id: project.id,+ name: project.name+ }))+ );+ }++ token = data?.pagination?.nextToken || undefined;+ } while (token && allProjects.length < ONA_MAX_PROJECTS);+ } catch (error) {+ if (error instanceof AxiosError) {+ throw new BadRequestError({+ message: `Failed to fetch Ona projects: ${+ error.response?.data ? JSON.stringify(error.response?.data) : error.message || "Unknown error"+ }`+ });+ }+ throw error;+ }++ return allProjects;+};diff --git a/backend/src/services/app-connection/ona/ona-connection-schemas.ts b/backend/src/services/app-connection/ona/ona-connection-schemas.tsnew file mode 100644index 0000000000..5f6d76c8ac--- /dev/null+++ b/backend/src/services/app-connection/ona/ona-connection-schemas.ts@@ -0,0 +1,67 @@+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { OnaConnectionMethod } from "./ona-connection-enums";++export const OnaConnectionPersonalAccessTokenCredentialsSchema = z.object({+ personalAccessToken: z+ .string()+ .trim()+ .min(1, "Personal Access Token required")+ .describe(AppConnections.CREDENTIALS.ONA.personalAccessToken)+});++const BaseOnaConnectionSchema = BaseAppConnectionSchema.extend({+ app: z.literal(AppConnection.Ona)+});++export const OnaConnectionSchema = BaseOnaConnectionSchema.extend({+ method: z.literal(OnaConnectionMethod.PersonalAccessToken),+ credentials: OnaConnectionPersonalAccessTokenCredentialsSchema+});++export const SanitizedOnaConnectionSchema = z.discriminatedUnion("method", [+ BaseOnaConnectionSchema.extend({+ method: z.literal(OnaConnectionMethod.PersonalAccessToken),+ credentials: OnaConnectionPersonalAccessTokenCredentialsSchema.pick({})+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.Ona]} (Personal Access Token)` }))+]);++export const ValidateOnaConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z+ .literal(OnaConnectionMethod.PersonalAccessToken)+ .describe(AppConnections.CREATE(AppConnection.Ona).method),+ credentials: OnaConnectionPersonalAccessTokenCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.Ona).credentials+ )+ })+]);++export const CreateOnaConnectionSchema = ValidateOnaConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.Ona)+);++export const UpdateOnaConnectionSchema = z+ .object({+ credentials: OnaConnectionPersonalAccessTokenCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.Ona).credentials+ )+ })+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Ona));++export const OnaConnectionListItemSchema = z+ .object({+ name: z.literal("Ona"),+ app: z.literal(AppConnection.Ona),+ methods: z.nativeEnum(OnaConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.Ona] }));diff --git a/backend/src/services/app-connection/ona/ona-connection-service.ts b/backend/src/services/app-connection/ona/ona-connection-service.tsnew file mode 100644index 0000000000..bc2927dc22--- /dev/null+++ b/backend/src/services/app-connection/ona/ona-connection-service.ts@@ -0,0 +1,28 @@+import { logger } from "@app/lib/logger";+import { OrgServiceActor } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import { listOnaProjects } from "./ona-connection-fns";+import { TOnaConnection } from "./ona-connection-types";++type TGetAppConnectionFunc = (+ app: AppConnection,+ connectionId: string,+ actor: OrgServiceActor+) => Promise<TOnaConnection>;++export const onaConnectionService = (getAppConnection: TGetAppConnectionFunc) => {+ const listProjects = async (connectionId: string, actor: OrgServiceActor) => {+ const appConnection = await getAppConnection(AppConnection.Ona, connectionId, actor);+ try {+ return await listOnaProjects(appConnection);+ } catch (error) {+ logger.error(error, "Failed to establish connection with Ona");+ return [];+ }+ };++ return {+ listProjects+ };+};diff --git a/backend/src/services/app-connection/ona/ona-connection-types.ts b/backend/src/services/app-connection/ona/ona-connection-types.tsnew file mode 100644index 0000000000..4a375e88a5--- /dev/null+++ b/backend/src/services/app-connection/ona/ona-connection-types.ts@@ -0,0 +1,34 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreateOnaConnectionSchema,+ OnaConnectionSchema,+ ValidateOnaConnectionCredentialsSchema+} from "./ona-connection-schemas";++export type TOnaConnection = z.infer<typeof OnaConnectionSchema>;++export type TOnaConnectionInput = z.infer<typeof CreateOnaConnectionSchema> & {+ app: AppConnection.Ona;+};++export type TValidateOnaConnectionCredentialsSchema = typeof ValidateOnaConnectionCredentialsSchema;++export type TOnaConnectionConfig = DiscriminativePick<TOnaConnectionInput, "method" | "app" | "credentials"> & {+ orgId: string;+};++export type TOnaProject = {+ id: string;+ name: string;+};++export type TOnaProjectListResponse = {+ projects: TOnaProject[];+ pagination?: {+ nextToken?: string;+ };+};diff --git a/backend/src/services/integration-auth/integration-list.ts b/backend/src/services/integration-auth/integration-list.tsindex e2581d26c8..4ba84ee89f 100644--- a/backend/src/services/integration-auth/integration-list.ts+++ b/backend/src/services/integration-auth/integration-list.ts@@ -72,6 +72,7 @@ export enum IntegrationUrls {GITLAB_API_URL = `${GITLAB_URL}/api`,GITHUB_API_URL = "https://api.github.com",VERCEL_API_URL = "https://api.vercel.com",+ ONA_API_URL = "https://app.gitpod.io/api",NETLIFY_API_URL = "https://api.netlify.com",RENDER_API_URL = "https://api.render.com",RAILWAY_API_URL = "https://backboard.railway.app/graphql/v2",@@ -432,6 +433,15 @@ export const getIntegrationOptions = async () => {type: "sat",clientId: "",docsLink: ""+ },+ {+ name: "Ona GitPod",+ slug: "ona-gitpod",+ image: "Ona.png",+ isAvailable: true,+ type: "pat",+ clientId: "",+ docsLink: ""}];diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.tsindex cfd34bf4ca..2c8fef5ba1 100644--- a/backend/src/services/secret-sync/secret-sync-fns.ts+++ b/backend/src/services/secret-sync/secret-sync-fns.ts@@ -379,9 +379,7 @@ export const SecretSyncFns = {// infinite sync loops where the prefixed key triggers another sync cycle.return ExternalInfisicalSyncFns.syncSecrets(secretSync, secretMap);default:- throw new Error(- `Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`- );+ throw new Error(`Unhandled sync destination for sync secrets fns: ${secretSync.destination}`);}},getSecrets: async (@@ -519,9 +517,7 @@ export const SecretSyncFns = {secretMap = await ExternalInfisicalSyncFns.getSecrets(secretSync);break;default:- throw new Error(- `Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`- );+ throw new Error(`Unhandled sync destination for get secrets fns: ${secretSync.destination}`);}const filtered = filterForSchema(secretMap, secretSync.environment?.slug || "", secretSync.syncOptions.keySchema);@@ -628,9 +624,7 @@ export const SecretSyncFns = {// infinite sync loops where the prefixed key triggers another sync cycle.return ExternalInfisicalSyncFns.removeSecrets(secretSync, secretMap);default:- throw new Error(- `Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`- );+ throw new Error(`Unhandled sync destination for remove secrets fns: ${secretSync.destination}`);}}};diff --git a/frontend/public/images/integrations/Ona.png b/frontend/public/images/integrations/Ona.pngnew file mode 100644index 0000000000..925095e091Binary files /dev/null and b/frontend/public/images/integrations/Ona.png differdiff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex 3ddd68127a..d4f02e2d25 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -65,6 +65,7 @@ import { NetlifyConnectionMethod } from "@app/hooks/api/appConnections/types/netimport { NetScalerConnectionMethod } from "@app/hooks/api/appConnections/types/netscaler-connection";import { NorthflankConnectionMethod } from "@app/hooks/api/appConnections/types/northflank-connection";import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";+import { OnaConnectionMethod } from "@app/hooks/api/appConnections/types/ona-connection";import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/open-router-connection";import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";@@ -162,7 +163,8 @@ export const APP_CONNECTION_MAP: Record<[AppConnection.ExternalInfisical]: { name: "Infisical", image: "Infisical.png" },[AppConnection.Doppler]: { name: "Doppler", image: "Doppler.png" },[AppConnection.NetScaler]: { name: "NetScaler", image: "NetScaler.png" },- [AppConnection.Anthropic]: { name: "Anthropic", image: "Anthropic.png" }+ [AppConnection.Anthropic]: { name: "Anthropic", image: "Anthropic.png" },+ [AppConnection.Ona]: { name: "Ona", image: "Ona.png" }};export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {@@ -171,6 +173,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case GitHubRadarConnectionMethod.App:return { name: "GitHub App", icon: faGithub };case GitHubConnectionMethod.Pat:+ case OnaConnectionMethod.PersonalAccessToken:return { name: "Personal Access Token", icon: faKey };case AzureKeyVaultConnectionMethod.OAuth:case AzureAppConfigurationConnectionMethod.OAuth:diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 77d7a365ac..c4119f6e91 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -55,5 +55,6 @@ export enum AppConnection {ExternalInfisical = "external-infisical",Doppler = "doppler",NetScaler = "netscaler",- Anthropic = "anthropic"+ Anthropic = "anthropic",+ Ona = "ona"}diff --git a/frontend/src/hooks/api/appConnections/ona/index.ts b/frontend/src/hooks/api/appConnections/ona/index.tsnew file mode 100644index 0000000000..2c1906d369--- /dev/null+++ b/frontend/src/hooks/api/appConnections/ona/index.ts@@ -0,0 +1,2 @@+export * from "./queries";+export * from "./types";diff --git a/frontend/src/hooks/api/appConnections/ona/queries.tsx b/frontend/src/hooks/api/appConnections/ona/queries.tsxnew file mode 100644index 0000000000..44e27550fd--- /dev/null+++ b/frontend/src/hooks/api/appConnections/ona/queries.tsx@@ -0,0 +1,37 @@+import { useQuery, UseQueryOptions } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { appConnectionKeys } from "../queries";+import { TOnaProject } from "./types";++const onaConnectionKeys = {+ all: [...appConnectionKeys.all, "ona"] as const,+ listProjects: (connectionId: string) =>+ [...onaConnectionKeys.all, "projects", connectionId] as const+};++export const useOnaConnectionListProjects = (+ connectionId: string,+ options?: Omit<+ UseQueryOptions<+ TOnaProject[],+ unknown,+ TOnaProject[],+ ReturnType<typeof onaConnectionKeys.listProjects>+ >,+ "queryKey" | "queryFn"+ >+) => {+ return useQuery({+ queryKey: onaConnectionKeys.listProjects(connectionId),+ queryFn: async () => {+ const { data } = await apiRequest.get<TOnaProject[]>(+ `/api/v1/app-connections/ona/${connectionId}/projects`+ );++ return data;+ },+ ...options+ });+};diff --git a/frontend/src/hooks/api/appConnections/ona/types.ts b/frontend/src/hooks/api/appConnections/ona/types.tsnew file mode 100644index 0000000000..c9cacd254a--- /dev/null+++ b/frontend/src/hooks/api/appConnections/ona/types.ts@@ -0,0 +1,4 @@+export type TOnaProject = {+ id: string;+ name: string;+};diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.tsindex 2a0daae112..ade5c803f5 100644--- a/frontend/src/hooks/api/appConnections/types/app-options.ts+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts@@ -243,6 +243,10 @@ export type TAnthropicConnectionOption = TAppConnectionOptionBase & {app: AppConnection.Anthropic;};+export type TOnaConnectionOption = TAppConnectionOptionBase & {+ app: AppConnection.Ona;+};+export type TAppConnectionOption =| TAwsConnectionOption| TGitHubConnectionOption@@ -300,7 +304,8 @@ export type TAppConnectionOption =| TExternalInfisicalConnectionOption| TDopplerConnectionOption| TNetScalerConnectionOption- | TAnthropicConnectionOption;+ | TAnthropicConnectionOption+ | TOnaConnectionOption;export type TAppConnectionOptionMap = {[AppConnection.AWS]: TAwsConnectionOption;@@ -360,4 +365,5 @@ export type TAppConnectionOptionMap = {[AppConnection.Doppler]: TDopplerConnectionOption;[AppConnection.NetScaler]: TNetScalerConnectionOption;[AppConnection.Anthropic]: TAnthropicConnectionOption;+ [AppConnection.Ona]: TOnaConnectionOption;};diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex 2594dec898..9f08a14968 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -42,6 +42,7 @@ import { TNorthflankConnection } from "./northflank-connection";import { TOCIConnection } from "./oci-connection";import { TOctopusDeployConnection } from "./octopus-deploy-connection";import { TOktaConnection } from "./okta-connection";+import { TOnaConnection } from "./ona-connection";import { TOpenRouterConnection } from "./open-router-connection";import { TOracleDBConnection } from "./oracledb-connection";import { TPostgresConnection } from "./postgres-connection";@@ -98,6 +99,7 @@ export * from "./northflank-connection";export * from "./oci-connection";export * from "./octopus-deploy-connection";export * from "./okta-connection";+export * from "./ona-connection";export * from "./open-router-connection";export * from "./oracledb-connection";export * from "./postgres-connection";@@ -171,7 +173,8 @@ export type TAppConnection =| TVenafiConnection| TExternalInfisicalConnection| TDopplerConnection- | TNetScalerConnection;+ | TNetScalerConnection+ | TOnaConnection;export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;diff --git a/frontend/src/hooks/api/appConnections/types/ona-connection.ts b/frontend/src/hooks/api/appConnections/types/ona-connection.tsnew file mode 100644index 0000000000..eabc66e0c6--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/ona-connection.ts@@ -0,0 +1,13 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum OnaConnectionMethod {+ PersonalAccessToken = "personal-access-token"+}++export type TOnaConnection = TRootAppConnection & { app: AppConnection.Ona } & {+ method: OnaConnectionMethod.PersonalAccessToken;+ credentials: {+ personalAccessToken: string;+ };+};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex 408a252ebf..a246b294dd 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -56,6 +56,7 @@ import { NorthflankConnectionForm } from "./NorthflankConnectionForm";import { OCIConnectionForm } from "./OCIConnectionForm";import { OctopusDeployConnectionForm } from "./OctopusDeployConnectionForm";import { OktaConnectionForm } from "./OktaConnectionForm";+import { OnaConnectionForm } from "./OnaConnectionForm";import { OpenRouterConnectionForm } from "./OpenRouterConnectionForm";import { OracleDBConnectionForm } from "./OracleDBConnectionForm";import { PostgresConnectionForm } from "./PostgresConnectionForm";@@ -279,6 +280,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <DopplerConnectionForm onSubmit={onSubmit} />;case AppConnection.NetScaler:return <NetScalerConnectionForm onSubmit={onSubmit} />;+ case AppConnection.Ona:+ return <OnaConnectionForm onSubmit={onSubmit} />;default:throw new Error(`Unhandled App ${app}`);}@@ -492,6 +495,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {return <DopplerConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.NetScaler:return <NetScalerConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;+ case AppConnection.Ona:+ return <OnaConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;default:throw new Error(`Unhandled App ${(appConnection as TAppConnection).app}`);}diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OnaConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OnaConnectionForm.tsxnew file mode 100644index 0000000000..8e19d33829--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OnaConnectionForm.tsx@@ -0,0 +1,135 @@+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";++import {+ Button,+ FormControl,+ ModalClose,+ SecretInput,+ Select,+ SelectItem+} from "@app/components/v2";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import {+ OnaConnectionMethod,+ TOnaConnection+} from "@app/hooks/api/appConnections/types/ona-connection";++import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TOnaConnection;+ onSubmit: (formData: FormData) => void;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.Ona)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(OnaConnectionMethod.PersonalAccessToken),+ credentials: z.object({+ personalAccessToken: z.string().trim().min(1, "Personal Access Token required")+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const OnaConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.Ona,+ method: OnaConnectionMethod.PersonalAccessToken+ }+ });++ const {+ handleSubmit,+ control,+ formState: { isSubmitting, isDirty }+ } = form;++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ tooltipText={`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.Ona].name+ }. This field cannot be changed after creation.`}+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Method"+ >+ <Select+ isDisabled={isUpdate}+ value={value}+ onValueChange={(val) => onChange(val)}+ className="w-full border border-mineshaft-500"+ position="popper"+ dropdownContainerClassName="max-w-none"+ >+ {Object.values(OnaConnectionMethod).map((method) => {+ return (+ <SelectItem value={method} key={method}>+ {getAppConnectionMethodDetails(method).name}{" "}+ </SelectItem>+ );+ })}+ </Select>+ </FormControl>+ )}+ />+ <Controller+ name="credentials.personalAccessToken"+ control={control}+ shouldUnregister+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Personal Access Token"+ >+ <SecretInput+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ />+ </FormControl>+ )}+ />+ <div className="mt-8 flex items-center">+ <Button+ className="mr-4"+ size="sm"+ type="submit"+ colorSchema="secondary"+ isLoading={isSubmitting}+ isDisabled={isSubmitting || !isDirty}+ >+ {isUpdate ? "Update Credentials" : "Connect to Ona"}+ </Button>+ <ModalClose asChild>+ <Button colorSchema="secondary" variant="plain">+ Cancel+ </Button>+ </ModalClose>+ </div>+ </form>+ </FormProvider>+ );+};