Skip to content

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

address review comments

adilson38e7c4199d83
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index bb4ea2702f..4a08247db1 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2951,9 +2951,8 @@ export const SecretSyncs = {
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'."
+ projectId: "The Ona project ID to sync secrets to.",
+ projectName: "The Ona project name to sync secrets to."
},
VERCEL: {
app: "The ID of the Vercel app to sync secrets to.",
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 cd2c32458d..1b02884de6 100644
--- a/backend/src/services/app-connection/ona/ona-connection-fns.ts
+++ b/backend/src/services/app-connection/ona/ona-connection-fns.ts
@@ -5,13 +5,13 @@ 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";
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_URL = "https://app.gitpod.io/api";
const ONA_PAGE_SIZE = 100;
export const getOnaConnectionListItem = () => {
@@ -27,7 +27,7 @@ export const validateOnaConnectionCredentials = async (config: TOnaConnectionCon
try {
await request.post(
- `${IntegrationUrls.ONA_API_URL}${GET_AUTHENTICATED_IDENTITY_PATH}`,
+ `${ONA_URL}${GET_AUTHENTICATED_IDENTITY_PATH}`,
{},
{
headers: {
@@ -65,25 +65,19 @@ export const listOnaProjects = async (appConnection: TOnaConnection): Promise<TO
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"
- }
+ const { data } = await request.post<TOnaProjectListResponse>(`${ONA_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.metadata?.name
- }))
- .filter((project): project is TOnaProject => Boolean(project.name))
+ ...data.projects.map((project) => ({
+ id: project.id,
+ name: project.metadata?.name || ""
+ }))
);
}
diff --git a/backend/src/services/integration-auth/integration-list.ts b/backend/src/services/integration-auth/integration-list.ts
index 4ba84ee89f..e2581d26c8 100644
--- a/backend/src/services/integration-auth/integration-list.ts
+++ b/backend/src/services/integration-auth/integration-list.ts
@@ -72,7 +72,6 @@ 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",
@@ -433,15 +432,6 @@ 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/ona/ona-sync-enums.ts b/backend/src/services/secret-sync/ona/ona-sync-enums.ts
index d85a386584..511d91d2c5 100644
--- a/backend/src/services/secret-sync/ona/ona-sync-enums.ts
+++ b/backend/src/services/secret-sync/ona/ona-sync-enums.ts
@@ -1,6 +1 @@
-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
index 5e7dca5cbd..3215a16e71 100644
--- a/backend/src/services/secret-sync/ona/ona-sync-fns.ts
+++ b/backend/src/services/secret-sync/ona/ona-sync-fns.ts
@@ -1,29 +1,23 @@
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";
+import { ONA_PAGE_SIZE } from "./ona-sync-enums";
+import { 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 ONA_MAX_RETRIES = 3;
const ONA_BASE_RETRY_DELAY_MS = 500;
+const ONA_URL = "https://app.gitpod.io/api";
+
const sleep = (ms: number) =>
new Promise<void>((resolve) => {
setTimeout(resolve, ms);
@@ -54,31 +48,6 @@ const getAuthHeaders = (secretSync: TOnaSyncWithCredentials) => ({
"Content-Type": "application/json"
});
-const resolveUserId = async (secretSync: TOnaSyncWithCredentials): Promise<string> => {
- const { data } = await withOnaRetry(() =>
- request.post<TOnaAuthenticatedIdentityResponse>(
- `${IntegrationUrls.ONA_API_URL}${ONA_GET_AUTHENTICATED_IDENTITY_PATH}`,
- {},
- { headers: getAuthHeaders(secretSync) }
- )
- );
- const userId = data?.subject?.id;
- if (!userId) {
- throw new SecretSyncError({
- message: "Unable to resolve authenticated Ona user ID for user-scoped sync.",
- shouldRetry: false
- });
- }
- return userId;
-};
-
-const buildScopeFilter = async (secretSync: TOnaSyncWithCredentials): Promise<TOnaScopeFilter> => {
- if (secretSync.destinationConfig.scope === OnaSyncScope.Project) {
- return { projectId: secretSync.destinationConfig.projectId };
- }
- return { userId: await resolveUserId(secretSync) };
-};
-
const listEnvVarSecrets = async (
secretSync: TOnaSyncWithCredentials,
scope: TOnaScopeFilter
@@ -89,16 +58,18 @@ const listEnvVarSecrets = async (
while (hasMore) {
// eslint-disable-next-line no-await-in-loop, @typescript-eslint/no-loop-func
- const { data } = await withOnaRetry(() =>
- request.post<TOnaListSecretsResponse>(
- `${IntegrationUrls.ONA_API_URL}${ONA_LIST_SECRETS_PATH}`,
+ const { data } = await withOnaRetry(async () => {
+ const res = await request.post<TOnaListSecretsResponse>(
+ `${ONA_URL}${ONA_LIST_SECRETS_PATH}`,
{
filter: { scope },
pagination: { pageSize: ONA_PAGE_SIZE, ...(token ? { token } : {}) }
},
{ headers: getAuthHeaders(secretSync) }
- )
- );
+ );
+
+ return res;
+ });
if (data?.secrets?.length) all.push(...data.secrets);
@@ -115,9 +86,9 @@ const createEnvVarSecret = async (
name: string,
value: string
): Promise<void> => {
- await withOnaRetry(() =>
- request.post(
- `${IntegrationUrls.ONA_API_URL}${ONA_CREATE_SECRET_PATH}`,
+ await withOnaRetry(async () => {
+ const res = await request.post(
+ `${ONA_URL}${ONA_CREATE_SECRET_PATH}`,
{
name,
value,
@@ -125,8 +96,9 @@ const createEnvVarSecret = async (
environmentVariable: true
},
{ headers: getAuthHeaders(secretSync) }
- )
- );
+ );
+ return res;
+ });
};
const updateSecretValue = async (
@@ -134,42 +106,30 @@ const updateSecretValue = async (
secretId: string,
value: string
): Promise<void> => {
- await withOnaRetry(() =>
- request.post(
- `${IntegrationUrls.ONA_API_URL}${ONA_UPDATE_SECRET_VALUE_PATH}`,
+ await withOnaRetry(async () => {
+ const res = await request.post(
+ `${ONA_URL}${ONA_UPDATE_SECRET_VALUE_PATH}`,
{ secretId, value },
{ headers: getAuthHeaders(secretSync) }
- )
- );
+ );
+ return res;
+ });
};
const deleteSecret = async (secretSync: TOnaSyncWithCredentials, secretId: string): Promise<void> => {
- await withOnaRetry(() =>
- request.post(
- `${IntegrationUrls.ONA_API_URL}${ONA_DELETE_SECRET_PATH}`,
+ await withOnaRetry(async () => {
+ const res = await request.post(
+ `${ONA_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
+ );
+ return res;
});
};
export const OnaSyncFns = {
syncSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {
- const scope = await buildScopeFilter(secretSync);
+ const scope: TOnaScopeFilter = { projectId: secretSync.destinationConfig.projectId };
const existingSecrets = await listEnvVarSecrets(secretSync, scope);
const existingByName = new Map(existingSecrets.map((s) => [s.name, s]));
@@ -185,7 +145,8 @@ export const OnaSyncFns = {
await updateSecretValue(secretSync, prior.id, secretMap[key].value);
}
} catch (error) {
- wrapApiError(error, key);
+ if (error instanceof SecretSyncError) throw error;
+ throw new SecretSyncError({ error, secretKey: key });
}
}
@@ -204,7 +165,8 @@ export const OnaSyncFns = {
// eslint-disable-next-line no-await-in-loop
await deleteSecret(secretSync, existing.id);
} catch (error) {
- wrapApiError(error, existing.name);
+ if (error instanceof SecretSyncError) throw error;
+ throw new SecretSyncError({ error, secretKey: existing.name });
}
}
},
@@ -217,7 +179,7 @@ export const OnaSyncFns = {
},
removeSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {
- const scope = await buildScopeFilter(secretSync);
+ const scope: TOnaScopeFilter = { projectId: secretSync.destinationConfig.projectId };
const existingSecrets = await listEnvVarSecrets(secretSync, scope);
for (const existing of existingSecrets) {
@@ -229,7 +191,8 @@ export const OnaSyncFns = {
// eslint-disable-next-line no-await-in-loop
await deleteSecret(secretSync, existing.id);
} catch (error) {
- wrapApiError(error, existing.name);
+ if (error instanceof SecretSyncError) throw error;
+ throw new SecretSyncError({ error, secretKey: 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
index 15db745441..c0fef07c30 100644
--- a/backend/src/services/secret-sync/ona/ona-sync-schemas.ts
+++ b/backend/src/services/secret-sync/ona/ona-sync-schemas.ts
@@ -11,26 +11,19 @@ import {
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 OnaSyncDestinationConfigSchema = z.object({
+ 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)
+});
const OnaSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
diff --git a/backend/src/services/secret-sync/ona/ona-sync-types.ts b/backend/src/services/secret-sync/ona/ona-sync-types.ts
index 740148da65..ff230ef074 100644
--- a/backend/src/services/secret-sync/ona/ona-sync-types.ts
+++ b/backend/src/services/secret-sync/ona/ona-sync-types.ts
@@ -16,7 +16,6 @@ export type TOnaSyncWithCredentials = TOnaSync & {
export type TOnaScopeFilter = {
projectId?: string;
- userId?: string;
};
export type TOnaSecret = {
@@ -41,10 +40,3 @@ export type TOnaListSecretsResponse = {
export type TOnaGetSecretValueResponse = {
value?: string;
};
-
-export type TOnaAuthenticatedIdentityResponse = {
- subject?: {
- id?: string;
- principal?: string;
- };
-};
diff --git a/docs/images/app-connections/ona/ona-access-token-tab.png b/docs/images/app-connections/ona/ona-access-token-tab.png
new file mode 100644
index 0000000000..8d232380e0
Binary files /dev/null and b/docs/images/app-connections/ona/ona-access-token-tab.png differ
diff --git a/docs/integrations/app-connections/ona.mdx b/docs/integrations/app-connections/ona.mdx
index 0bea5905f7..a6e09d4563 100644
--- a/docs/integrations/app-connections/ona.mdx
+++ b/docs/integrations/app-connections/ona.mdx
@@ -10,14 +10,15 @@ Infisical supports connecting to [Ona](https://www.gitpod.io/) (Gitpod's cloud d
<Steps>
<Step title="Open your user settings on Ona">
- Navigate to your Ona user settings.
+ In the lower-left corner of Ona, select your name, then click the gear icon to open user settings.
+ ![Open Account setting](/images/app-connections/ona/ona-account-settings.png)
</Step>
<Step title="Select the Personal Access Tokens tab">
- In the bottom left, click your name, then click the gear icon to access your user settings.
- ![Open Account setting](/images/app-connections/ona/ona-account-settings.png)
+ ![PAT tab](/images/app-connections/ona/ona-access-token-tab.png)
+
</Step>
<Step title="Create the token">
Click the **New Token** button and add a description for the token (eg, "infisical integration"). The token must have Read & Write access so that Infisical can apply changes in Ona.
diff --git a/docs/integrations/secret-syncs/ona.mdx b/docs/integrations/secret-syncs/ona.mdx
index 71fa4843fa..5a7b743ee8 100644
--- a/docs/integrations/secret-syncs/ona.mdx
+++ b/docs/integrations/secret-syncs/ona.mdx
@@ -8,9 +8,6 @@ description: "Learn how to configure an Ona Sync for Infisical."
- Set up and add secrets to [Infisical Cloud](https://app.infisical.com)
- Create an [Ona Connection](/integrations/app-connections/ona)
-<Note>
- Ona Sync is **one-way** (Infisical → Ona). Importing existing Ona secrets into Infisical is not supported because Ona only exposes secret values from within active workspaces. Manage the source of truth in Infisical.
-</Note>
<Tabs>
<Tab title="Infisical UI">
@@ -38,9 +35,7 @@ description: "Learn how to configure an Ona Sync for Infisical."
![Configure Destination](/images/secret-syncs/ona/ona-destination.png)
- **Ona Connection**: The Ona Connection to authenticate with.
- - **Scope**: Where secrets should be stored in Ona.
- - **Project**: Sync secrets to a specific Ona project as project-level environment variables. Select the target project from the dropdown populated by your connection.
- - **User**: Sync secrets to the authenticated user's personal environment variables. The user is resolved automatically from the Personal Access Token on the connection.
+ - **Ona Project**: Sync secrets to the selected Ona project as project-level environment variables. Choose the target project from the dropdown populated by your connection.
</Step>
<Step title="Configure sync options">
Configure the **Sync Options** to specify how secrets should be synced, then click **Next**.
@@ -78,7 +73,7 @@ description: "Learn how to configure an Ona Sync for Infisical."
<Tab title="API">
To create an **Ona Sync**, make an API request to the [Create Ona Sync](/api-reference/endpoints/secret-syncs/ona/create) API endpoint.
- ### Sample request (project scope)
+ ### Sample request
```bash Request
curl --request POST \
@@ -97,35 +92,12 @@ description: "Learn how to configure an Ona Sync for Infisical."
"keySchema": "INFISICAL_{{secretKey}}"
},
"destinationConfig": {
- "scope": "project",
"projectId": "ona-project-uuid",
"projectName": "my-ona-project"
}
}'
```
- ### Sample request (user scope)
-
- ```bash Request
- curl --request POST \
- --url https://app.infisical.com/api/v1/secret-syncs/ona \
- --header 'Content-Type: application/json' \
- --data '{
- "name": "my-ona-user-sync",
- "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
- "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
- "environment": "dev",
- "secretPath": "/my-secrets",
- "isAutoSyncEnabled": true,
- "syncOptions": {
- "initialSyncBehavior": "overwrite-destination"
- },
- "destinationConfig": {
- "scope": "user"
- }
- }'
- ```
-
### Sample response
```json Response
@@ -174,7 +146,6 @@ description: "Learn how to configure an Ona Sync for Infisical."
},
"destination": "ona",
"destinationConfig": {
- "scope": "project",
"projectId": "ona-project-uuid",
"projectName": "my-ona-project"
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx
index ce85c812c8..56a61ab415 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/OnaSyncFields.tsx
@@ -1,116 +1,58 @@
-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 { FilterableSelect, FormControl } 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);
+ {
+ enabled: Boolean(connectionId)
}
- }, [connectionId, scope, setValue]);
+ );
return (
<>
<SecretSyncConnectionField
onChange={() => {
- setValue("destinationConfig.scope", OnaSyncScope.Project);
setValue("destinationConfig.projectId", "");
setValue("destinationConfig.projectName", "");
}}
/>
<Controller
- name="destinationConfig.scope"
+ name="destinationConfig.projectId"
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", "");
- }
+ <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 ?? "");
}}
- 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>
+ options={projects ?? []}
+ placeholder="Select a project..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
</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/SecretSyncReviewFields/OnaSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx
index ecfe6099c3..1262fa285c 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx
@@ -3,20 +3,10 @@ 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>
- )}
- </>
- );
+ return <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>;
};
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
index f3d0494fbf..2a1dfe5568 100644
--- 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
@@ -2,20 +2,13 @@ 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)
- })
- ])
+ destinationConfig: z.object({
+ projectId: z.string().trim().min(1, "Ona project required"),
+ projectName: z.string().trim().min(1, "Ona project name required")
+ })
})
);
diff --git a/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts b/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts
index 5aef2145db..3daec19780 100644
--- a/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts
@@ -2,16 +2,9 @@ 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 };
+ destinationConfig: { projectId: string; projectName: string };
connection: {
app: AppConnection.Ona;
name: string;
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 1f35464360..bc668a2608 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,7 +9,6 @@ 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";
@@ -235,13 +234,8 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
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";
- }
+ primaryText = destinationConfig.projectName;
+ secondaryText = "Ona Project";
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
index f74b555fda..7734846412 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx
@@ -1,5 +1,5 @@
import { GenericFieldLabel } from "@app/components/secret-syncs";
-import { OnaSyncScope, TOnaSync } from "@app/hooks/api/secretSyncs/types/ona-sync";
+import { TOnaSync } from "@app/hooks/api/secretSyncs/types/ona-sync";
type Props = {
secretSync: TOnaSync;
@@ -8,14 +8,5 @@ type Props = {
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>;
+ return <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>;
};