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
remove scope type and make project name optional
adilsond4fe1761a384
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 4a08247db1..61fb81a214 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2952,7 +2952,7 @@ export const SecretSyncs = {},ONA: {projectId: "The Ona project ID to sync secrets to.",- projectName: "The Ona project name to sync secrets to."+ projectName: "An optional display name for the Ona project."},VERCEL: {app: "The ID of the Vercel app to sync secrets to.",diff --git a/backend/src/services/secret-sync/ona/ona-sync-fns.ts b/backend/src/services/secret-sync/ona/ona-sync-fns.tsindex 00caffc823..404d29c39c 100644--- a/backend/src/services/secret-sync/ona/ona-sync-fns.ts+++ b/backend/src/services/secret-sync/ona/ona-sync-fns.ts@@ -6,7 +6,7 @@ import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";import { ONA_PAGE_SIZE } from "./ona-sync-enums";-import { TOnaListSecretsResponse, TOnaScopeFilter, TOnaSecret, TOnaSyncWithCredentials } from "./ona-sync-types";+import { TOnaListSecretsResponse, TOnaSecret, TOnaSyncWithCredentials } from "./ona-sync-types";const ONA_LIST_SECRETS_PATH = "/gitpod.v1.SecretService/ListSecrets";const ONA_CREATE_SECRET_PATH = "/gitpod.v1.SecretService/CreateSecret";@@ -48,10 +48,7 @@ const getAuthHeaders = (secretSync: TOnaSyncWithCredentials) => ({"Content-Type": "application/json"});-const listEnvVarSecrets = async (- secretSync: TOnaSyncWithCredentials,- scope: TOnaScopeFilter-): Promise<TOnaSecret[]> => {+const listEnvVarSecrets = async (secretSync: TOnaSyncWithCredentials): Promise<TOnaSecret[]> => {const all: TOnaSecret[] = [];let token: string | undefined;let hasMore = true;@@ -62,7 +59,7 @@ const listEnvVarSecrets = async (return request.post<TOnaListSecretsResponse>(`${ONA_API_URL}${ONA_LIST_SECRETS_PATH}`,{- filter: { scope },+ filter: { scope: { projectId: secretSync.destinationConfig.projectId } },pagination: { pageSize: ONA_PAGE_SIZE, ...(token ? { token } : {}) }},{ headers: getAuthHeaders(secretSync) }@@ -78,19 +75,14 @@ const listEnvVarSecrets = async (return all.filter((secret) => secret.environmentVariable === true);};-const createEnvVarSecret = async (- secretSync: TOnaSyncWithCredentials,- scope: TOnaScopeFilter,- name: string,- value: string-): Promise<void> => {+const createEnvVarSecret = async (secretSync: TOnaSyncWithCredentials, name: string, value: string): Promise<void> => {await withOnaRetry(async () => {return request.post(`${ONA_API_URL}${ONA_CREATE_SECRET_PATH}`,{name,value,- scope,+ scope: { projectId: secretSync.destinationConfig.projectId },environmentVariable: true},{ headers: getAuthHeaders(secretSync) }@@ -124,9 +116,7 @@ const deleteSecret = async (secretSync: TOnaSyncWithCredentials, secretId: strinexport const OnaSyncFns = {syncSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {- const scope: TOnaScopeFilter = { projectId: secretSync.destinationConfig.projectId };-- const existingSecrets = await listEnvVarSecrets(secretSync, scope);+ const existingSecrets = await listEnvVarSecrets(secretSync);const existingByName = new Map(existingSecrets.map((s) => [s.name, s]));for (const key of Object.keys(secretMap)) {@@ -134,7 +124,7 @@ export const OnaSyncFns = {try {if (!prior) {// eslint-disable-next-line no-await-in-loop- await createEnvVarSecret(secretSync, scope, key, secretMap[key].value);+ await createEnvVarSecret(secretSync, key, secretMap[key].value);} else {// eslint-disable-next-line no-await-in-loopawait updateSecretValue(secretSync, prior.id, secretMap[key].value);@@ -174,8 +164,7 @@ export const OnaSyncFns = {},removeSecrets: async (secretSync: TOnaSyncWithCredentials, secretMap: TSecretMap) => {- const scope: TOnaScopeFilter = { projectId: secretSync.destinationConfig.projectId };- const existingSecrets = await listEnvVarSecrets(secretSync, scope);+ const existingSecrets = await listEnvVarSecrets(secretSync);for (const existing of existingSecrets) {if (!(existing.name in secretMap)) {diff --git a/backend/src/services/secret-sync/ona/ona-sync-schemas.ts b/backend/src/services/secret-sync/ona/ona-sync-schemas.tsindex c0fef07c30..34ac6e4d5b 100644--- a/backend/src/services/secret-sync/ona/ona-sync-schemas.ts+++ b/backend/src/services/secret-sync/ona/ona-sync-schemas.ts@@ -18,11 +18,7 @@ const OnaSyncDestinationConfigSchema = z.object({.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)+ projectName: z.string().trim().optional().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.tsindex 13fb8f7876..a88be68ba9 100644--- a/backend/src/services/secret-sync/ona/ona-sync-types.ts+++ b/backend/src/services/secret-sync/ona/ona-sync-types.ts@@ -14,10 +14,6 @@ export type TOnaSyncWithCredentials = TOnaSync & {connection: TOnaConnection;};-export type TOnaScopeFilter = {- projectId: string;-};-export type TOnaSecret = {id: string;name: string;diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsxindex 1262fa285c..3d2896b9d8 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/OnaSyncReviewFields.tsx@@ -8,5 +8,9 @@ export const OnaSyncReviewFields = () => {const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Ona }>();const destinationConfig = watch("destinationConfig");- return <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>;+ return (+ <GenericFieldLabel label="Ona Project">+ {destinationConfig.projectName || destinationConfig.projectId}+ </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.tsindex 2a1dfe5568..19224f4040 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@@ -8,7 +8,7 @@ export const OnaSyncDestinationSchema = BaseSecretSyncSchema().merge(destination: z.literal(SecretSync.Ona),destinationConfig: z.object({projectId: z.string().trim().min(1, "Ona project required"),- projectName: z.string().trim().min(1, "Ona project name required")+ projectName: z.string().trim().optional()})}));diff --git a/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts b/frontend/src/hooks/api/secretSyncs/types/ona-sync.tsindex 3daec19780..5595feaaad 100644--- a/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts+++ b/frontend/src/hooks/api/secretSyncs/types/ona-sync.ts@@ -4,7 +4,7 @@ import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";export type TOnaSync = TRootSecretSync & {destination: SecretSync.Ona;- destinationConfig: { projectId: string; projectName: string };+ 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.tsindex bc668a2608..71b98af5ab 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@@ -234,7 +234,7 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {secondaryText = `${destinationConfig.environment} - ${destinationConfig.secretPath}`;break;case SecretSync.Ona:- primaryText = destinationConfig.projectName;+ primaryText = destinationConfig.projectName || destinationConfig.projectId;secondaryText = "Ona Project";break;default:diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsxindex 7734846412..a9cb4b68a5 100644--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/OnaSyncDestinationSection.tsx@@ -8,5 +8,9 @@ type Props = {export const OnaSyncDestinationSection = ({ secretSync }: Props) => {const { destinationConfig } = secretSync;- return <GenericFieldLabel label="Ona Project">{destinationConfig.projectName}</GenericFieldLabel>;+ return (+ <GenericFieldLabel label="Ona Project">+ {destinationConfig.projectName || destinationConfig.projectId}+ </GenericFieldLabel>+ );};