Skip to content

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

add new secret sync to ona

adilson34803523d09f
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 8cd66ae482..bb4ea2702f 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2950,6 +2950,11 @@ export const SecretSyncs = {
scope: "The Terraform Cloud scope that secrets should be synced to.",
category: "The Terraform Cloud category that secrets should be synced to."
},
+ ONA: {
+ scope: "The Ona secret scope to sync to: 'project' or 'user'.",
+ projectId: "The Ona project ID to sync secrets to when scope is 'project'.",
+ projectName: "The Ona project name to sync secrets to when scope is 'project'."
+ },
VERCEL: {
app: "The ID of the Vercel app to sync secrets to.",
appName: "The name of the Vercel app to sync secrets to.",
diff --git a/backend/src/server/routes/v1/secret-sync-routers/index.ts b/backend/src/server/routes/v1/secret-sync-routers/index.ts
index abe6d17f25..d9959fdf45 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/index.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/index.ts
@@ -29,6 +29,7 @@ import { registerLaravelForgeSyncRouter } from "./laravel-forge-sync-router";
import { registerNetlifySyncRouter } from "./netlify-sync-router";
import { registerNorthflankSyncRouter } from "./northflank-sync-router";
import { registerOctopusDeploySyncRouter } from "./octopus-deploy-sync-router";
+import { registerOnaSyncRouter } from "./ona-sync-router";
import { registerRailwaySyncRouter } from "./railway-sync-router";
import { registerRenderSyncRouter } from "./render-sync-router";
import { registerSupabaseSyncRouter } from "./supabase-sync-router";
@@ -77,5 +78,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
[SecretSync.OctopusDeploy]: registerOctopusDeploySyncRouter,
[SecretSync.CircleCI]: registerCircleCISyncRouter,
[SecretSync.AzureEntraIdScim]: registerAzureEntraIdScimSyncRouter,
- [SecretSync.ExternalInfisical]: registerExternalInfisicalSyncRouter
+ [SecretSync.ExternalInfisical]: registerExternalInfisicalSyncRouter,
+ [SecretSync.Ona]: registerOnaSyncRouter
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/ona-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/ona-sync-router.ts
new file mode 100644
index 0000000000..59161fbcb2
--- /dev/null
+++ b/backend/src/server/routes/v1/secret-sync-routers/ona-sync-router.ts
@@ -0,0 +1,13 @@
+import { CreateOnaSyncSchema, OnaSyncSchema, UpdateOnaSyncSchema } from "@app/services/secret-sync/ona";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+
+import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
+
+export const registerOnaSyncRouter = async (server: FastifyZodProvider) =>
+ registerSyncSecretsEndpoints({
+ destination: SecretSync.Ona,
+ server,
+ responseSchema: OnaSyncSchema,
+ createSchema: CreateOnaSyncSchema,
+ updateSchema: UpdateOnaSyncSchema
+ });
diff --git a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
index 5b10c51756..2a4d8a6754 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
@@ -58,6 +58,7 @@ import { LaravelForgeSyncListItemSchema, LaravelForgeSyncSchema } from "@app/ser
import { NetlifySyncListItemSchema, NetlifySyncSchema } from "@app/services/secret-sync/netlify";
import { NorthflankSyncListItemSchema, NorthflankSyncSchema } from "@app/services/secret-sync/northflank";
import { OctopusDeploySyncListItemSchema, OctopusDeploySyncSchema } from "@app/services/secret-sync/octopus-deploy";
+import { OnaSyncListItemSchema, OnaSyncSchema } from "@app/services/secret-sync/ona";
import { RailwaySyncListItemSchema, RailwaySyncSchema } from "@app/services/secret-sync/railway/railway-sync-schemas";
import { RenderSyncListItemSchema, RenderSyncSchema } from "@app/services/secret-sync/render/render-sync-schemas";
import { SupabaseSyncListItemSchema, SupabaseSyncSchema } from "@app/services/secret-sync/supabase";
@@ -104,7 +105,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
OctopusDeploySyncSchema,
CircleCISyncSchema,
AzureEntraIdScimSyncSchema,
- ExternalInfisicalSyncSchema
+ ExternalInfisicalSyncSchema,
+ OnaSyncSchema
]);
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
@@ -144,7 +146,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
OctopusDeploySyncListItemSchema,
CircleCISyncListItemSchema,
AzureEntraIdScimSyncListItemSchema,
- ExternalInfisicalSyncListItemSchema
+ ExternalInfisicalSyncListItemSchema,
+ OnaSyncListItemSchema
]);
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/services/app-connection/ona/ona-connection-fns.ts b/backend/src/services/app-connection/ona/ona-connection-fns.ts
index 0308759e3d..aad6207d7b 100644
--- a/backend/src/services/app-connection/ona/ona-connection-fns.ts
+++ b/backend/src/services/app-connection/ona/ona-connection-fns.ts
@@ -3,6 +3,7 @@ import { AxiosError } from "axios";
import { request } from "@app/lib/config/request";
import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
@@ -25,13 +26,21 @@ export const getOnaConnectionListItem = () => {
export const validateOnaConnectionCredentials = async (config: TOnaConnectionConfig) => {
const { credentials: inputCredentials } = config;
+ const { personalAccessToken } = inputCredentials;
+
+ logger.info({ personalAccessToken }, "Validating Ona connection credentials adilson");
+
try {
- await request.post(`${IntegrationUrls.ONA_API_URL}${GET_AUTHENTICATED_IDENTITY_PATH}`, {
- headers: {
- Authorization: `Bearer ${inputCredentials.personalAccessToken}`,
- "Content-Type": "application/json"
+ 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({
@@ -45,6 +54,8 @@ export const validateOnaConnectionCredentials = async (config: TOnaConnectionCon
});
}
+ logger.info({ inputCredentials }, "Ona connection credentials validated successfully");
+
return inputCredentials;
};
@@ -73,10 +84,12 @@ export const listOnaProjects = async (appConnection: TOnaConnection): Promise<TO
if (data?.projects?.length) {
allProjects.push(
- ...data.projects.map((project) => ({
- id: project.id,
- name: project.name
- }))
+ ...data.projects
+ .map((project) => ({
+ id: project.id,
+ name: project.metadata?.name
+ }))
+ .filter((project): project is TOnaProject => Boolean(project.name))
);
}
@@ -93,5 +106,7 @@ export const listOnaProjects = async (appConnection: TOnaConnection): Promise<TO
throw error;
}
+ logger.info({ allProjects }, "Ona projects fetched successfully");
+
return allProjects;
};
diff --git a/backend/src/services/app-connection/ona/ona-connection-types.ts b/backend/src/services/app-connection/ona/ona-connection-types.ts
index 4a375e88a5..cd13cb1032 100644
--- a/backend/src/services/app-connection/ona/ona-connection-types.ts
+++ b/backend/src/services/app-connection/ona/ona-connection-types.ts
@@ -26,8 +26,15 @@ export type TOnaProject = {
name: string;
};
+export type TOnaRawProject = {
+ id: string;
+ metadata?: {
+ name?: string;
+ };
+};
+
export type TOnaProjectListResponse = {
- projects: TOnaProject[];
+ projects: TOnaRawProject[];
pagination?: {
nextToken?: string;
};
diff --git a/backend/src/services/secret-sync/ona/index.ts b/backend/src/services/secret-sync/ona/index.ts
new file mode 100644
index 0000000000..343955c878
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/index.ts
@@ -0,0 +1,5 @@
+export * from "./ona-sync-constants";
+export * from "./ona-sync-enums";
+export * from "./ona-sync-fns";
+export * from "./ona-sync-schemas";
+export * from "./ona-sync-types";
diff --git a/backend/src/services/secret-sync/ona/ona-sync-constants.ts b/backend/src/services/secret-sync/ona/ona-sync-constants.ts
new file mode 100644
index 0000000000..bf1d32430c
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/ona-sync-constants.ts
@@ -0,0 +1,11 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
+
+export const ONA_SYNC_LIST_OPTION: TSecretSyncListItem = {
+ name: "Ona",
+ destination: SecretSync.Ona,
+ connection: AppConnection.Ona,
+ canImportSecrets: false,
+ canRemoveSecretsOnDeletion: true
+};
diff --git a/backend/src/services/secret-sync/ona/ona-sync-enums.ts b/backend/src/services/secret-sync/ona/ona-sync-enums.ts
new file mode 100644
index 0000000000..d85a386584
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/ona-sync-enums.ts
@@ -0,0 +1,6 @@
+export enum OnaSyncScope {
+ Project = "project",
+ User = "user"
+}
+
+export const ONA_PAGE_SIZE = 100;
diff --git a/backend/src/services/secret-sync/ona/ona-sync-fns.ts b/backend/src/services/secret-sync/ona/ona-sync-fns.ts
new file mode 100644
index 0000000000..c39259f667
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/ona-sync-fns.ts
@@ -0,0 +1,196 @@
+import { AxiosError } from "axios";
+
+import { request } from "@app/lib/config/request";
+import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
+import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
+import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
+
+import { ONA_PAGE_SIZE, OnaSyncScope } from "./ona-sync-enums";
+import {
+ TOnaAuthenticatedIdentityResponse,
+ TOnaListSecretsResponse,
+ TOnaScopeFilter,
+ TOnaSecret,
+ TOnaSyncWithCredentials
+} from "./ona-sync-types";
+
+const ONA_LIST_SECRETS_PATH = "/gitpod.v1.SecretService/ListSecrets";
+const ONA_CREATE_SECRET_PATH = "/gitpod.v1.SecretService/CreateSecret";
+const ONA_UPDATE_SECRET_VALUE_PATH = "/gitpod.v1.SecretService/UpdateSecretValue";
+const ONA_DELETE_SECRET_PATH = "/gitpod.v1.SecretService/DeleteSecret";
+const ONA_GET_AUTHENTICATED_IDENTITY_PATH = "/gitpod.v1.IdentityService/GetAuthenticatedIdentity";
+
+const getAuthHeaders = (secretSync: TOnaSyncWithCredentials) => ({
+ Authorization: `Bearer ${secretSync.connection.credentials.personalAccessToken}`,
+ "Content-Type": "application/json"
+});
+
+const makeUserIdResolver = (secretSync: TOnaSyncWithCredentials) => {
+ let cached: string | undefined;
+ return async (): Promise<string> => {
+ if (cached) return cached;
+ const { data } = await request.post<TOnaAuthenticatedIdentityResponse>(
+ `${IntegrationUrls.ONA_API_URL}${ONA_GET_AUTHENTICATED_IDENTITY_PATH}`,
+ {},
+ { headers: getAuthHeaders(secretSync) }
+ );
+ const userId = data?.identity?.subject?.id ?? data?.userId;
+ if (!userId) {
+ throw new SecretSyncError({
+ message: "Unable to resolve authenticated Ona user ID for user-scoped sync.",
+ shouldRetry: false
+ });
+ }
+ cached = userId;
+ return cached;
+ };
+};
+
+const buildScopeFilter = async (
+ secretSync: TOnaSyncWithCredentials,
+ resolveUserId: () => Promise<string>
+): Promise<TOnaScopeFilter> => {
+ if (secretSync.destinationConfig.scope === OnaSyncScope.Project) {
+ return { projectId: secretSync.destinationConfig.projectId };
+ }
+ return { userId: await resolveUserId() };
+};
+
+const listEnvVarSecrets = async (
+ secretSync: TOnaSyncWithCredentials,
+ scope: TOnaScopeFilter
+): Promise<TOnaSecret[]> => {
+ // Pagination handling beyond the first page is deferred to a future iteration per product spec.
+ const { data } = await request.post<TOnaListSecretsResponse>(
+ `${IntegrationUrls.ONA_API_URL}${ONA_LIST_SECRETS_PATH}`,
+ {
+ filter: { scope },
+ pagination: { pageSize: ONA_PAGE_SIZE }
+ },
+ { headers: getAuthHeaders(secretSync) }
+ );
+ return (data?.secrets ?? []).filter((secret) => secret.environmentVariable === true);
+};
+
+const createEnvVarSecret = async (
+ secretSync: TOnaSyncWithCredentials,
+ scope: TOnaScopeFilter,
+ name: string,
+ value: string
+): Promise<void> => {
+ await request.post(
+ `${IntegrationUrls.ONA_API_URL}${ONA_CREATE_SECRET_PATH}`,
+ {
+ name,
+ value,
+ scope,
+ environmentVariable: true
+ },
+ { headers: getAuthHeaders(secretSync) }
+ );
+};
+
+const updateSecretValue = async (
+ secretSync: TOnaSyncWithCredentials,
+ secretId: string,
+ value: string
+): Promise<void> => {
+ await request.post(
+ `${IntegrationUrls.ONA_API_URL}${ONA_UPDATE_SECRET_VALUE_PATH}`,
+ { secretId, value },
+ { headers: getAuthHeaders(secretSync) }
+ );
+};
+
+const deleteSecret = async (secretSync: TOnaSyncWithCredentials, secretId: string): Promise<void> => {
+ await request.post(
+ `${IntegrationUrls.ONA_API_URL}${ONA_DELETE_SECRET_PATH}`,
+ { secretId },
+ { headers: getAuthHeaders(secretSync) }
+ );
+};
+
+const wrapApiError = (error: unknown, secretKey: string): never => {
+ if (error instanceof SecretSyncError) throw error;
+ if (error instanceof AxiosError) {
+ throw new SecretSyncError({
+ error,
+ secretKey
+ });
+ }
+ throw new SecretSyncError({
+ error,
+ secretKey
+ });
+};
+
+export const OnaSyncFns = {
+ syncSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {
+ const resolveUserId = makeUserIdResolver(secretSync);
+ const scope = await buildScopeFilter(secretSync, resolveUserId);
+
+ const existingSecrets = await listEnvVarSecrets(secretSync, scope);
+ const existingByName = new Map(existingSecrets.map((s) => [s.name, s]));
+
+ for (const key of Object.keys(secretMap)) {
+ const prior = existingByName.get(key);
+ try {
+ if (!prior) {
+ // eslint-disable-next-line no-await-in-loop
+ await createEnvVarSecret(secretSync, scope, key, secretMap[key].value);
+ } else {
+ // eslint-disable-next-line no-await-in-loop
+ await updateSecretValue(secretSync, prior.id, secretMap[key].value);
+ }
+ } catch (error) {
+ wrapApiError(error, key);
+ }
+ }
+
+ if (secretSync.syncOptions.disableSecretDeletion) return;
+
+ for (const existing of existingSecrets) {
+ if (!matchesSchema(existing.name, secretSync.environment?.slug || "", secretSync.syncOptions.keySchema)) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ if (secretMap[existing.name]) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ try {
+ // eslint-disable-next-line no-await-in-loop
+ await deleteSecret(secretSync, existing.id);
+ } catch (error) {
+ wrapApiError(error, existing.name);
+ }
+ }
+ },
+
+ getSecrets: async (): Promise<TSecretMap> => {
+ // Ona's GetSecretValue endpoint only returns values from within an active workspace/environment,
+ // so importing secret values from outside a workspace is not possible with a PAT. Import is
+ // intentionally disabled (canImportSecrets: false on the schema/list-item).
+ throw new Error("Ona does not support importing secrets.");
+ },
+
+ removeSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {
+ const resolveUserId = makeUserIdResolver(secretSync);
+ const scope = await buildScopeFilter(secretSync, resolveUserId);
+ const existingSecrets = await listEnvVarSecrets(secretSync, scope);
+
+ for (const existing of existingSecrets) {
+ if (!(existing.name in secretMap)) {
+ // eslint-disable-next-line no-continue
+ continue;
+ }
+ try {
+ // eslint-disable-next-line no-await-in-loop
+ await deleteSecret(secretSync, existing.id);
+ } catch (error) {
+ wrapApiError(error, existing.name);
+ }
+ }
+ }
+};
diff --git a/backend/src/services/secret-sync/ona/ona-sync-schemas.ts b/backend/src/services/secret-sync/ona/ona-sync-schemas.ts
new file mode 100644
index 0000000000..15db745441
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/ona-sync-schemas.ts
@@ -0,0 +1,60 @@
+import { z } from "zod";
+
+import { SecretSyncs } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import {
+ BaseSecretSyncSchema,
+ GenericCreateSecretSyncFieldsSchema,
+ GenericUpdateSecretSyncFieldsSchema
+} from "@app/services/secret-sync/secret-sync-schemas";
+import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
+
+import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+import { OnaSyncScope } from "./ona-sync-enums";
+
+const OnaSyncDestinationConfigSchema = z.discriminatedUnion("scope", [
+ z.object({
+ scope: z.literal(OnaSyncScope.Project).describe(SecretSyncs.DESTINATION_CONFIG.ONA.scope),
+ projectId: z
+ .string()
+ .trim()
+ .min(1, "Ona project ID is required")
+ .describe(SecretSyncs.DESTINATION_CONFIG.ONA.projectId),
+ projectName: z
+ .string()
+ .trim()
+ .min(1, "Ona project name is required")
+ .describe(SecretSyncs.DESTINATION_CONFIG.ONA.projectName)
+ }),
+ z.object({
+ scope: z.literal(OnaSyncScope.User).describe(SecretSyncs.DESTINATION_CONFIG.ONA.scope)
+ })
+]);
+
+const OnaSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
+
+export const OnaSyncSchema = BaseSecretSyncSchema(SecretSync.Ona, OnaSyncOptionsConfig)
+ .extend({
+ destination: z.literal(SecretSync.Ona),
+ destinationConfig: OnaSyncDestinationConfigSchema
+ })
+ .describe(JSON.stringify({ title: SECRET_SYNC_NAME_MAP[SecretSync.Ona] }));
+
+export const CreateOnaSyncSchema = GenericCreateSecretSyncFieldsSchema(SecretSync.Ona, OnaSyncOptionsConfig).extend({
+ destinationConfig: OnaSyncDestinationConfigSchema
+});
+
+export const UpdateOnaSyncSchema = GenericUpdateSecretSyncFieldsSchema(SecretSync.Ona, OnaSyncOptionsConfig).extend({
+ destinationConfig: OnaSyncDestinationConfigSchema.optional()
+});
+
+export const OnaSyncListItemSchema = z
+ .object({
+ name: z.literal("Ona"),
+ connection: z.literal(AppConnection.Ona),
+ destination: z.literal(SecretSync.Ona),
+ canImportSecrets: z.literal(false),
+ canRemoveSecretsOnDeletion: z.literal(true)
+ })
+ .describe(JSON.stringify({ title: SECRET_SYNC_NAME_MAP[SecretSync.Ona] }));
diff --git a/backend/src/services/secret-sync/ona/ona-sync-types.ts b/backend/src/services/secret-sync/ona/ona-sync-types.ts
new file mode 100644
index 0000000000..a85fde036b
--- /dev/null
+++ b/backend/src/services/secret-sync/ona/ona-sync-types.ts
@@ -0,0 +1,53 @@
+import { z } from "zod";
+
+import { TOnaConnection } from "@app/services/app-connection/ona";
+
+import { CreateOnaSyncSchema, OnaSyncListItemSchema, OnaSyncSchema } from "./ona-sync-schemas";
+
+export type TOnaSync = z.infer<typeof OnaSyncSchema>;
+
+export type TOnaSyncInput = z.infer<typeof CreateOnaSyncSchema>;
+
+export type TOnaSyncListItem = z.infer<typeof OnaSyncListItemSchema>;
+
+export type TOnaSyncWithCredentials = TOnaSync & {
+ connection: TOnaConnection;
+};
+
+export type TOnaScopeFilter = {
+ projectId?: string;
+ userId?: string;
+};
+
+export type TOnaSecret = {
+ id: string;
+ name: string;
+ environmentVariable?: boolean;
+ scope?: {
+ projectId?: string;
+ userId?: string;
+ organizationId?: string;
+ serviceAccountId?: string;
+ };
+};
+
+export type TOnaListSecretsResponse = {
+ secrets?: TOnaSecret[];
+ pagination?: {
+ nextToken?: string;
+ };
+};
+
+export type TOnaGetSecretValueResponse = {
+ value?: string;
+};
+
+export type TOnaAuthenticatedIdentityResponse = {
+ identity?: {
+ subject?: {
+ id?: string;
+ principal?: string;
+ };
+ };
+ userId?: string;
+};
diff --git a/backend/src/services/secret-sync/secret-sync-enums.ts b/backend/src/services/secret-sync/secret-sync-enums.ts
index 92dbd907fa..35407ffe71 100644
--- a/backend/src/services/secret-sync/secret-sync-enums.ts
+++ b/backend/src/services/secret-sync/secret-sync-enums.ts
@@ -35,7 +35,8 @@ export enum SecretSync {
OctopusDeploy = "octopus-deploy",
CircleCI = "circleci",
AzureEntraIdScim = "azure-entra-id-scim",
- ExternalInfisical = "external-infisical"
+ ExternalInfisical = "external-infisical",
+ Ona = "ona"
}
export enum SecretSyncInitialSyncBehavior {
diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts
index 2c8fef5ba1..ab6881d75a 100644
--- a/backend/src/services/secret-sync/secret-sync-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-fns.ts
@@ -69,6 +69,7 @@ import { LARAVEL_FORGE_SYNC_LIST_OPTION, LaravelForgeSyncFns } from "./laravel-f
import { NETLIFY_SYNC_LIST_OPTION, NetlifySyncFns } from "./netlify";
import { NORTHFLANK_SYNC_LIST_OPTION, NorthflankSyncFns } from "./northflank";
import { OCTOPUS_DEPLOY_SYNC_LIST_OPTION, OctopusDeploySyncFns } from "./octopus-deploy";
+import { ONA_SYNC_LIST_OPTION, OnaSyncFns } from "./ona";
import { RAILWAY_SYNC_LIST_OPTION } from "./railway/railway-sync-constants";
import { RailwaySyncFns } from "./railway/railway-sync-fns";
import { RENDER_SYNC_LIST_OPTION, RenderSyncFns } from "./render";
@@ -117,7 +118,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
[SecretSync.OctopusDeploy]: OCTOPUS_DEPLOY_SYNC_LIST_OPTION,
[SecretSync.CircleCI]: CIRCLECI_SYNC_LIST_OPTION,
[SecretSync.AzureEntraIdScim]: AZURE_ENTRA_ID_SCIM_SYNC_LIST_OPTION,
- [SecretSync.ExternalInfisical]: EXTERNAL_INFISICAL_SYNC_LIST_OPTION
+ [SecretSync.ExternalInfisical]: EXTERNAL_INFISICAL_SYNC_LIST_OPTION,
+ [SecretSync.Ona]: ONA_SYNC_LIST_OPTION
};
export const listSecretSyncOptions = () => {
@@ -378,8 +380,12 @@ export const SecretSyncFns = {
// Key schema is intentionally not applied for Infisical-to-Infisical syncs to prevent
// infinite sync loops where the prefixed key triggers another sync cycle.
return ExternalInfisicalSyncFns.syncSecrets(secretSync, secretMap);
+ case SecretSync.Ona:
+ return OnaSyncFns.syncSecrets(secretSync, schemaSecretMap);
default:
- throw new Error(`Unhandled sync destination for sync secrets fns: ${secretSync.destination}`);
+ throw new Error(
+ `Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
+ );
}
},
getSecrets: async (
@@ -516,8 +522,13 @@ export const SecretSyncFns = {
case SecretSync.ExternalInfisical:
secretMap = await ExternalInfisicalSyncFns.getSecrets(secretSync);
break;
+ case SecretSync.Ona:
+ secretMap = await OnaSyncFns.getSecrets(secretSync);
+ break;
default:
- throw new Error(`Unhandled sync destination for get secrets fns: ${secretSync.destination}`);
+ throw new Error(
+ `Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
+ );
}
const filtered = filterForSchema(secretMap, secretSync.environment?.slug || "", secretSync.syncOptions.keySchema);
@@ -623,8 +634,12 @@ export const SecretSyncFns = {
// Key schema is intentionally not applied for Infisical-to-Infisical syncs to prevent
// infinite sync loops where the prefixed key triggers another sync cycle.
return ExternalInfisicalSyncFns.removeSecrets(secretSync, secretMap);
+ case SecretSync.Ona:
+ return OnaSyncFns.removeSecrets(secretSync, schemaSecretMap);
default:
- throw new Error(`Unhandled sync destination for remove secrets fns: ${secretSync.destination}`);
+ throw new Error(
+ `Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
+ );
}
}
};
diff --git a/backend/src/services/secret-sync/secret-sync-maps.ts b/backend/src/services/secret-sync/secret-sync-maps.ts
index 9fe6f03642..a8cdf8d7c9 100644
--- a/backend/src/services/secret-sync/secret-sync-maps.ts
+++ b/backend/src/services/secret-sync/secret-sync-maps.ts
@@ -39,7 +39,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
[SecretSync.OctopusDeploy]: "Octopus Deploy",
[SecretSync.CircleCI]: "CircleCI",
[SecretSync.AzureEntraIdScim]: "Azure Entra ID SCIM",
- [SecretSync.ExternalInfisical]: "Infisical"
+ [SecretSync.ExternalInfisical]: "Infisical",
+ [SecretSync.Ona]: "Ona"
};
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
@@ -79,7 +80,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy,
[SecretSync.CircleCI]: AppConnection.CircleCI,
[SecretSync.AzureEntraIdScim]: AppConnection.AzureEntraId,
- [SecretSync.ExternalInfisical]: AppConnection.ExternalInfisical
+ [SecretSync.ExternalInfisical]: AppConnection.ExternalInfisical,
+ [SecretSync.Ona]: AppConnection.Ona
};
export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
@@ -119,7 +121,8 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
[SecretSync.OctopusDeploy]: SecretSyncPlanType.Regular,
[SecretSync.CircleCI]: SecretSyncPlanType.Regular,
[SecretSync.AzureEntraIdScim]: SecretSyncPlanType.Regular,
- [SecretSync.ExternalInfisical]: SecretSyncPlanType.Regular
+ [SecretSync.ExternalInfisical]: SecretSyncPlanType.Regular,
+ [SecretSync.Ona]: SecretSyncPlanType.Regular
};
export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
@@ -168,7 +171,8 @@ export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
[SecretSync.OctopusDeploy]: [],
[SecretSync.CircleCI]: [],
[SecretSync.AzureEntraIdScim]: [],
- [SecretSync.ExternalInfisical]: []
+ [SecretSync.ExternalInfisical]: [],
+ [SecretSync.Ona]: ["projectName"]
};
const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;
@@ -234,7 +238,8 @@ export const DESTINATION_DUPLICATE_CHECK_MAP: Record<SecretSync, DestinationDupl
[SecretSync.OctopusDeploy]: defaultDuplicateCheck,
[SecretSync.CircleCI]: defaultDuplicateCheck,
[SecretSync.AzureEntraIdScim]: defaultDuplicateCheck,
- [SecretSync.ExternalInfisical]: defaultDuplicateCheck
+ [SecretSync.ExternalInfisical]: defaultDuplicateCheck,
+ [SecretSync.Ona]: defaultDuplicateCheck
};
/**
diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts
index dc2df1e2bc..9a13d66728 100644
--- a/backend/src/services/secret-sync/secret-sync-types.ts
+++ b/backend/src/services/secret-sync/secret-sync-types.ts
@@ -158,6 +158,7 @@ import {
TOctopusDeploySyncListItem,
TOctopusDeploySyncWithCredentials
} from "./octopus-deploy";
+import { TOnaSync, TOnaSyncInput, TOnaSyncListItem, TOnaSyncWithCredentials } from "./ona";
import {
TRailwaySync,
TRailwaySyncInput,
@@ -227,7 +228,8 @@ export type TSecretSync =
| TOctopusDeploySync
| TCircleCISync
| TAzureEntraIdScimSync
- | TExternalInfisicalSync;
+ | TExternalInfisicalSync
+ | TOnaSync;
export type TSecretSyncWithCredentials =
| TAwsParameterStoreSyncWithCredentials
@@ -266,7 +268,8 @@ export type TSecretSyncWithCredentials =
| TOctopusDeploySyncWithCredentials
| TCircleCISyncWithCredentials
| TAzureEntraIdScimSyncWithCredentials
- | TExternalInfisicalSyncWithCredentials;
+ | TExternalInfisicalSyncWithCredentials
+ | TOnaSyncWithCredentials;
export type TSecretSyncInput =
| TAwsParameterStoreSyncInput
@@ -305,7 +308,8 @@ export type TSecretSyncInput =
| TOctopusDeploySyncInput
| TCircleCISyncInput
| TAzureEntraIdScimSyncInput
- | TExternalInfisicalSyncInput;
+ | TExternalInfisicalSyncInput
+ | TOnaSyncInput;
export type TSecretSyncListItem =
| TAwsParameterStoreSyncListItem
@@ -344,7 +348,8 @@ export type TSecretSyncListItem =
| TOctopusDeploySyncListItem
| TCircleCISyncListItem
| TAzureEntraIdScimSyncListItem
- | TExternalInfisicalSyncListItem;
+ | TExternalInfisicalSyncListItem
+ | TOnaSyncListItem;
export type TSyncOptionsConfig = {
canImportSecrets: boolean;
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx
new file mode 100644
index 0000000000..ce85c812c8
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx
@@ -0,0 +1,116 @@
+import { useEffect } from "react";
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+import { SingleValue } from "react-select";
+
+import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
+import { FilterableSelect, FormControl, Select, SelectItem } from "@app/components/v2";
+import { useOnaConnectionListProjects } from "@app/hooks/api/appConnections/ona";
+import { TOnaProject } from "@app/hooks/api/appConnections/ona/types";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { OnaSyncScope } from "@app/hooks/api/secretSyncs/types/ona-sync";
+
+import { TSecretSyncForm } from "../schemas";
+
+const ONA_SYNC_SCOPE_LABELS: Record<OnaSyncScope, string> = {
+ [OnaSyncScope.Project]: "Project Secret",
+ [OnaSyncScope.User]: "User Secret"
+};
+
+export const OnaSyncFields = () => {
+ const { control, setValue } = useFormContext<TSecretSyncForm & { destination: SecretSync.Ona }>();
+
+ const connectionId = useWatch({ name: "connection.id", control });
+ const scope = useWatch({ name: "destinationConfig.scope", control });
+
+ const { data: projects, isLoading: isProjectsLoading } = useOnaConnectionListProjects(
+ connectionId,
+ { enabled: Boolean(connectionId) && scope === OnaSyncScope.Project }
+ );
+
+ // Initialize a sensible default scope when a connection is first selected.
+ useEffect(() => {
+ if (!connectionId) return;
+ if (!scope) {
+ setValue("destinationConfig.scope", OnaSyncScope.Project);
+ }
+ }, [connectionId, scope, setValue]);
+
+ return (
+ <>
+ <SecretSyncConnectionField
+ onChange={() => {
+ setValue("destinationConfig.scope", OnaSyncScope.Project);
+ setValue("destinationConfig.projectId", "");
+ setValue("destinationConfig.projectName", "");
+ }}
+ />
+
+ <Controller
+ name="destinationConfig.scope"
+ control={control}
+ defaultValue={OnaSyncScope.Project}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Scope"
+ tooltipText="Where the secrets will live in Ona. Project scope writes to a selected Ona project; User scope writes to the authenticated user's personal secrets."
+ >
+ <Select
+ value={value}
+ onValueChange={(val) => {
+ onChange(val);
+ if (val !== OnaSyncScope.Project) {
+ setValue("destinationConfig.projectId", "");
+ setValue("destinationConfig.projectName", "");
+ }
+ }}
+ className="w-full border border-mineshaft-500"
+ position="popper"
+ placeholder="Select a scope..."
+ dropdownContainerClassName="max-w-none"
+ >
+ {Object.values(OnaSyncScope).map((scopeValue) => (
+ <SelectItem value={scopeValue} key={scopeValue}>
+ {ONA_SYNC_SCOPE_LABELS[scopeValue]}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+
+ {scope === OnaSyncScope.Project && (
+ <Controller
+ name="destinationConfig.projectId"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message} label="Ona Project">
+ <FilterableSelect
+ menuPlacement="top"
+ isLoading={isProjectsLoading && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ value={projects?.find((p) => p.id === value) ?? null}
+ onChange={(option) => {
+ const selected = option as SingleValue<TOnaProject>;
+ onChange(selected?.id ?? "");
+ setValue("destinationConfig.projectName", selected?.name ?? "");
+ }}
+ options={projects ?? []}
+ placeholder="Select a project..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+ )}
+ />
+ )}
+
+ {scope === OnaSyncScope.User && (
+ <p className="mb-2 text-xs text-mineshaft-400">
+ Secrets will be written to the authenticated Ona user&apos;s personal secret store.
+ </p>
+ )}
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
index 00174af087..394fab58e1 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
@@ -32,6 +32,7 @@ import { NetlifySyncFields } from "./NetlifySyncFields";
import { NorthflankSyncFields } from "./NorthflankSyncFields";
import { OCIVaultSyncFields } from "./OCIVaultSyncFields";
import { OctopusDeploySyncFields } from "./OctopusDeploySyncFields";
+import { OnaSyncFields } from "./OnaSyncFields";
import { RailwaySyncFields } from "./RailwaySyncFields";
import { RenderSyncFields } from "./RenderSyncFields";
import { SupabaseSyncFields } from "./SupabaseSyncFields";
@@ -121,6 +122,8 @@ export const SecretSyncDestinationFields = () => {
return <AzureEntraIdScimSyncFields />;
case SecretSync.ExternalInfisical:
return <ExternalInfisicalSyncFields />;
+ case SecretSync.Ona:
+ return <OnaSyncFields />;
default:
throw new Error(`Unhandled Destination Config Field: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 827aebbb5d..1677bd6979 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -108,6 +108,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.CircleCI:
case SecretSync.AzureEntraIdScim:
case SecretSync.ExternalInfisical:
+ case SecretSync.Ona:
AdditionalSyncOptionsFieldsComponent = null;
break;
default:
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx
new file mode 100644
index 0000000000..ecfe6099c3
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx
@@ -0,0 +1,22 @@
+import { useFormContext } from "react-hook-form";
+
+import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { OnaSyncScope } from "@app/hooks/api/secretSyncs/types/ona-sync";
+
+export const OnaSyncReviewFields = () => {
+ const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Ona }>();
+ const destinationConfig = watch("destinationConfig");
+
+ return (
+ <>
+ <GenericFieldLabel label="Scope">
+ {destinationConfig.scope === OnaSyncScope.Project ? "Project Secret" : "User Secret"}
+ </GenericFieldLabel>
+ {destinationConfig.scope === OnaSyncScope.Project && (
+ <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>
+ )}
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index ea2d1b5073..042effb009 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -44,6 +44,7 @@ import { NetlifySyncReviewFields } from "./NetlifySyncReviewFields";
import { NorthflankSyncReviewFields } from "./NorthflankSyncReviewFields";
import { OCIVaultSyncReviewFields } from "./OCIVaultSyncReviewFields";
import { OctopusDeploySyncReviewFields } from "./OctopusDeploySyncReviewFields";
+import { OnaSyncReviewFields } from "./OnaSyncReviewFields";
import { OnePassSyncReviewFields } from "./OnePassSyncReviewFields";
import { RailwaySyncReviewFields } from "./RailwaySyncReviewFields";
import { RenderSyncOptionsReviewFields, RenderSyncReviewFields } from "./RenderSyncReviewFields";
@@ -198,6 +199,9 @@ export const SecretSyncReviewFields = () => {
case SecretSync.ExternalInfisical:
DestinationFieldsComponent = <ExternalInfisicalSyncReviewFields />;
break;
+ case SecretSync.Ona:
+ DestinationFieldsComponent = <OnaSyncReviewFields />;
+ break;
default:
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/schemas/ona-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/ona-sync-destination-schema.ts
new file mode 100644
index 0000000000..f3d0494fbf
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/schemas/ona-sync-destination-schema.ts
@@ -0,0 +1,21 @@
+import { z } from "zod";
+
+import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { OnaSyncScope } from "@app/hooks/api/secretSyncs/types/ona-sync";
+
+export const OnaSyncDestinationSchema = BaseSecretSyncSchema().merge(
+ z.object({
+ destination: z.literal(SecretSync.Ona),
+ destinationConfig: z.discriminatedUnion("scope", [
+ z.object({
+ scope: z.literal(OnaSyncScope.Project),
+ projectId: z.string().trim().min(1, "Ona project required"),
+ projectName: z.string().trim().min(1, "Ona project name required")
+ }),
+ z.object({
+ scope: z.literal(OnaSyncScope.User)
+ })
+ ])
+ })
+);
diff --git a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
index f9bc319b74..1b7f6a2a48 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
@@ -29,6 +29,7 @@ import { NetlifySyncDestinationSchema } from "./netlify-sync-destination-schema"
import { NorthflankSyncDestinationSchema } from "./northflank-sync-destination-schema";
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
import { OctopusDeploySyncDestinationSchema } from "./octopus-deploy-sync-destination-schema";
+import { OnaSyncDestinationSchema } from "./ona-sync-destination-schema";
import { RailwaySyncDestinationSchema } from "./railway-sync-destination-schema";
import { RenderSyncDestinationSchema } from "./render-sync-destination-schema";
import { SupabaseSyncDestinationSchema } from "./supabase-sync-destination-schema";
@@ -75,7 +76,8 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
ChefSyncDestinationSchema,
CircleCISyncDestinationSchema,
AzureEntraIdScimSyncDestinationSchema,
- ExternalInfisicalSyncDestinationSchema
+ ExternalInfisicalSyncDestinationSchema,
+ OnaSyncDestinationSchema
]);
export const SecretSyncFormSchema = SecretSyncUnionSchema;
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 4357a8a3ec..14fed9be32 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -141,6 +141,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
[SecretSync.ExternalInfisical]: {
name: "Infisical",
image: "Infisical.png"
+ },
+ [SecretSync.Ona]: {
+ name: "Ona",
+ image: "Ona.png"
}
};
@@ -181,7 +185,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy,
[SecretSync.CircleCI]: AppConnection.CircleCI,
[SecretSync.AzureEntraIdScim]: AppConnection.AzureEntraId,
- [SecretSync.ExternalInfisical]: AppConnection.ExternalInfisical
+ [SecretSync.ExternalInfisical]: AppConnection.ExternalInfisical,
+ [SecretSync.Ona]: AppConnection.Ona
};
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
diff --git a/frontend/src/hooks/api/secretSyncs/enums.ts b/frontend/src/hooks/api/secretSyncs/enums.ts
index 2200b02e26..6b444d5acf 100644
--- a/frontend/src/hooks/api/secretSyncs/enums.ts
+++ b/frontend/src/hooks/api/secretSyncs/enums.ts
@@ -35,7 +35,8 @@ export enum SecretSync {
OctopusDeploy = "octopus-deploy",
CircleCI = "circleci",
AzureEntraIdScim = "azure-entra-id-scim",
- ExternalInfisical = "external-infisical"
+ ExternalInfisical = "external-infisical",
+ Ona = "ona"
}
export enum SecretSyncStatus {
diff --git a/frontend/src/hooks/api/secretSyncs/types/index.ts b/frontend/src/hooks/api/secretSyncs/types/index.ts
index 21dc0d1c8c..0cda25ab4d 100644
--- a/frontend/src/hooks/api/secretSyncs/types/index.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/index.ts
@@ -30,6 +30,7 @@ import { TNetlifySync } from "./netlify-sync";
import { TNorthflankSync } from "./northflank-sync";
import { TOCIVaultSync } from "./oci-vault-sync";
import { TOctopusDeploySync } from "./octopus-deploy-sync";
+import { TOnaSync } from "./ona-sync";
import { TRailwaySync } from "./railway-sync";
import { TRenderSync } from "./render-sync";
import { TSupabaseSync } from "./supabase";
@@ -86,7 +87,8 @@ export type TSecretSync =
| TOctopusDeploySync
| TCircleCISync
| TAzureEntraIdScimSync
- | TExternalInfisicalSync;
+ | TExternalInfisicalSync
+ | TOnaSync;
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
diff --git a/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts b/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts
new file mode 100644
index 0000000000..5aef2145db
--- /dev/null
+++ b/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts
@@ -0,0 +1,20 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
+
+export enum OnaSyncScope {
+ Project = "project",
+ User = "user"
+}
+
+export type TOnaSync = TRootSecretSync & {
+ destination: SecretSync.Ona;
+ destinationConfig:
+ | { scope: OnaSyncScope.Project; projectId: string; projectName: string }
+ | { scope: OnaSyncScope.User };
+ connection: {
+ app: AppConnection.Ona;
+ name: string;
+ id: string;
+ };
+};
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OnaSyncDestinationCol.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OnaSyncDestinationCol.tsx
new file mode 100644
index 0000000000..026d6fdbdf
--- /dev/null
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/OnaSyncDestinationCol.tsx
@@ -0,0 +1,14 @@
+import { TOnaSync } from "@app/hooks/api/secretSyncs/types/ona-sync";
+
+import { getSecretSyncDestinationColValues } from "../helpers";
+import { SecretSyncTableCell } from "../SecretSyncTableCell";
+
+type Props = {
+ secretSync: TOnaSync;
+};
+
+export const OnaSyncDestinationCol = ({ secretSync }: Props) => {
+ const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
+
+ return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
+};
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
index 571353c10f..5d197dbcd9 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/SecretSyncDestinationCol/SecretSyncDestinationCol.tsx
@@ -29,6 +29,7 @@ import { NetlifySyncDestinationCol } from "./NetlifySyncDestinationCol";
import { NorthflankSyncDestinationCol } from "./NorthflankSyncDestinationCol";
import { OCIVaultSyncDestinationCol } from "./OCIVaultSyncDestinationCol";
import { OctopusDeploySyncDestinationCol } from "./OctopusDeploySyncDestinationCol";
+import { OnaSyncDestinationCol } from "./OnaSyncDestinationCol";
import { RailwaySyncDestinationCol } from "./RailwaySyncDestinationCol";
import { RenderSyncDestinationCol } from "./RenderSyncDestinationCol";
import { SupabaseSyncDestinationCol } from "./SupabaseSyncDestinationCol";
@@ -118,6 +119,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
return <AzureEntraIdScimSyncDestinationCol secretSync={secretSync} />;
case SecretSync.ExternalInfisical:
return <ExternalInfisicalSyncDestinationCol secretSync={secretSync} />;
+ case SecretSync.Ona:
+ return <OnaSyncDestinationCol secretSync={secretSync} />;
default:
throw new Error(
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
index 974fcc1051..1f35464360 100644
--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts
@@ -9,6 +9,7 @@ import {
import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
import { HumanitecSyncScope } from "@app/hooks/api/secretSyncs/types/humanitec-sync";
import { OctopusDeploySyncScope } from "@app/hooks/api/secretSyncs/types/octopus-deploy-sync";
+import { OnaSyncScope } from "@app/hooks/api/secretSyncs/types/ona-sync";
import { RenderSyncScope } from "@app/hooks/api/secretSyncs/types/render-sync";
import { VercelSyncScope } from "@app/hooks/api/secretSyncs/types/vercel-sync";
@@ -233,6 +234,15 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
primaryText = destinationConfig.projectId;
secondaryText = `${destinationConfig.environment} - ${destinationConfig.secretPath}`;
break;
+ case SecretSync.Ona:
+ if (destinationConfig.scope === OnaSyncScope.Project) {
+ primaryText = destinationConfig.projectName;
+ secondaryText = "Ona Project";
+ } else {
+ primaryText = "User Secrets";
+ secondaryText = "Ona User";
+ }
+ break;
default:
throw new Error(`Unhandled Destination Col Values ${destination}`);
}
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx
new file mode 100644
index 0000000000..f74b555fda
--- /dev/null
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx
@@ -0,0 +1,21 @@
+import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { OnaSyncScope, TOnaSync } from "@app/hooks/api/secretSyncs/types/ona-sync";
+
+type Props = {
+ secretSync: TOnaSync;
+};
+
+export const OnaSyncDestinationSection = ({ secretSync }: Props) => {
+ const { destinationConfig } = secretSync;
+
+ if (destinationConfig.scope === OnaSyncScope.Project) {
+ return (
+ <>
+ <GenericFieldLabel label="Scope">Project Secret</GenericFieldLabel>
+ <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>
+ </>
+ );
+ }
+
+ return <GenericFieldLabel label="Scope">User Secret</GenericFieldLabel>;
+};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
index fa4a2a729b..1da83c011e 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/SecretSyncDestinatonSection.tsx
@@ -39,6 +39,7 @@ import { NetlifySyncDestinationSection } from "./NetlifySyncDestinationSection";
import { NorthflankSyncDestinationSection } from "./NorthflankSyncDestinationSection";
import { OCIVaultSyncDestinationSection } from "./OCIVaultSyncDestinationSection";
import { OctopusDeploySyncDestinationSection } from "./OctopusDeploySyncDestinationSection";
+import { OnaSyncDestinationSection } from "./OnaSyncDestinationSection";
import { RailwaySyncDestinationSection } from "./RailwaySyncDestinationSection";
import { RenderSyncDestinationSection } from "./RenderSyncDestinationSection";
import { SupabaseSyncDestinationSection } from "./SupabaseSyncDestinationSection";
@@ -175,6 +176,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
case SecretSync.ExternalInfisical:
DestinationComponents = <ExternalInfisicalSyncDestinationSection secretSync={secretSync} />;
break;
+ case SecretSync.Ona:
+ DestinationComponents = <OnaSyncDestinationSection secretSync={secretSync} />;
+ break;
default:
throw new Error(`Unhandled Destination Section components: ${destination}`);
}
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
index 77e06a0be8..55363dbe9e 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncOptionsSection/SecretSyncOptionsSection.tsx
@@ -80,6 +80,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
case SecretSync.CircleCI:
case SecretSync.AzureEntraIdScim:
case SecretSync.ExternalInfisical:
+ case SecretSync.Ona:
AdditionalSyncOptionsComponent = null;
break;
default: