Skip to content

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

add new secret rotation

adilson97c0bb4978ab
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
index 07cef7ba2c..15c5529133 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts
@@ -15,6 +15,7 @@ import { registerOpenRouterApiKeyRotationRouter } from "./open-router-api-key-ro
import { registerOracleDBCredentialsRotationRouter } from "./oracledb-credentials-rotation-router";
import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";
import { registerRedisCredentialsRotationRouter } from "./redis-credentials-rotation-router";
+import { registerSalesforceOauthCredentialsRotationRouter } from "./salesforce-oauth-credentials-rotation-router";
import { registerSupabaseApiKeyRotationRouter } from "./supabase-api-key-rotation-router";
import { registerUnixLinuxLocalAccountRotationRouter } from "./unix-linux-local-account-rotation-router";
import { registerWindowsLocalAccountRotationRouter } from "./windows-local-account-rotation-router";
@@ -42,5 +43,6 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<
[SecretRotation.WindowsLocalAccount]: registerWindowsLocalAccountRotationRouter,
[SecretRotation.OpenRouterApiKey]: registerOpenRouterApiKeyRotationRouter,
[SecretRotation.HpIloLocalAccount]: registerHpIloRotationRouter,
- [SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter
+ [SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter,
+ [SecretRotation.SalesforceOauthCredentials]: registerSalesforceOauthCredentialsRotationRouter
};
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/salesforce-oauth-credentials-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/salesforce-oauth-credentials-rotation-router.ts
new file mode 100644
index 0000000000..d571f1fe1f
--- /dev/null
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/salesforce-oauth-credentials-rotation-router.ts
@@ -0,0 +1,19 @@
+import {
+ CreateSalesforceOauthCredentialsRotationSchema,
+ SalesforceOauthCredentialsRotationGeneratedCredentialsSchema,
+ SalesforceOauthCredentialsRotationSchema,
+ UpdateSalesforceOauthCredentialsRotationSchema
+} from "@app/ee/services/secret-rotation-v2/salesforce-oauth-credentials";
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+
+import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";
+
+export const registerSalesforceOauthCredentialsRotationRouter = async (server: FastifyZodProvider) =>
+ registerSecretRotationEndpoints({
+ type: SecretRotation.SalesforceOauthCredentials,
+ server,
+ responseSchema: SalesforceOauthCredentialsRotationSchema,
+ createSchema: CreateSalesforceOauthCredentialsRotationSchema,
+ updateSchema: UpdateSalesforceOauthCredentialsRotationSchema,
+ generatedCredentialsSchema: SalesforceOauthCredentialsRotationGeneratedCredentialsSchema
+ });
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
index e5ff3d6d48..788383075b 100644
--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts
@@ -16,6 +16,7 @@ import { OpenRouterApiKeyRotationListItemSchema } from "@app/ee/services/secret-
import { OracleDBCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/oracledb-credentials";
import { PostgresCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
import { RedisCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";
+import { SalesforceOauthCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/salesforce-oauth-credentials";
import { SecretRotationV2Schema } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema";
import { SupabaseApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/supabase-api-key";
import { UnixLinuxLocalAccountRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/unix-linux-local-account-rotation";
@@ -43,7 +44,8 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [
WindowsLocalAccountRotationListItemSchema,
OpenRouterApiKeyRotationListItemSchema,
HpIloRotationListItemSchema,
- SupabaseApiKeyRotationListItemSchema
+ SupabaseApiKeyRotationListItemSchema,
+ SalesforceOauthCredentialsRotationListItemSchema
]);
export const registerSecretRotationV2Router = async (server: FastifyZodProvider) => {
diff --git a/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/index.ts b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/index.ts
new file mode 100644
index 0000000000..43e17faadd
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/index.ts
@@ -0,0 +1,3 @@
+export * from "./salesforce-oauth-credentials-rotation-constants";
+export * from "./salesforce-oauth-credentials-rotation-schemas";
+export * from "./salesforce-oauth-credentials-rotation-types";
diff --git a/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-constants.ts
new file mode 100644
index 0000000000..9726b79217
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-constants.ts
@@ -0,0 +1,15 @@
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import { TSecretRotationV2ListItem } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const SALESFORCE_OAUTH_CREDENTIALS_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {
+ name: "Salesforce OAuth Credentials",
+ type: SecretRotation.SalesforceOauthCredentials,
+ connection: AppConnection.Salesforce,
+ template: {
+ secretsMapping: {
+ consumerKey: "SALESFORCE_CONSUMER_KEY",
+ consumerSecret: "SALESFORCE_CONSUMER_SECRET"
+ }
+ }
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-fns.ts
new file mode 100644
index 0000000000..2f23e4cc78
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-fns.ts
@@ -0,0 +1,175 @@
+import { AxiosError } from "axios";
+
+import {
+ TRotationFactory,
+ TRotationFactoryGetSecretsPayload,
+ TRotationFactoryIssueCredentials,
+ TRotationFactoryRevokeCredentials,
+ TRotationFactoryRotateCredentials
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import {
+ getSalesforceConnectionAccessToken,
+ SALESFORCE_API_VERSION
+} from "@app/services/app-connection/salesforce/salesforce-connection-fns";
+
+import {
+ TSalesforceConsumersResponse,
+ TSalesforceOauthCredentialsRotationGeneratedCredentials,
+ TSalesforceOauthCredentialsRotationWithConnection,
+ TSalesforceStagedCredentialsResponse
+} from "./salesforce-oauth-credentials-rotation-types";
+
+export const salesforceOauthCredentialsRotationFactory: TRotationFactory<
+ TSalesforceOauthCredentialsRotationWithConnection,
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+> = (secretRotation) => {
+ const {
+ connection,
+ parameters: { appId },
+ secretsMapping
+ } = secretRotation;
+
+ const $authedRequest = async () => {
+ const { accessToken, instanceUrl } = await getSalesforceConnectionAccessToken(connection.credentials);
+ return {
+ instanceUrl,
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json",
+ "Content-Type": "application/json"
+ } as const
+ };
+ };
+
+ const $deleteStagedCredential = async (stagedCredentialUrl: string) => {
+ const { instanceUrl, headers } = await $authedRequest();
+ try {
+ await request.request({
+ method: "DELETE",
+ url: `${instanceUrl}${stagedCredentialUrl}`,
+ headers
+ });
+ } catch (error) {
+ // 404 means the credential was already gone (manually deleted, or auto-expired past Salesforce's grace window)
+ if (error instanceof AxiosError && error.response?.status === 404) return;
+ throw error;
+ }
+ };
+
+ const $issueConsumerSecret = async (): Promise<TSalesforceOauthCredentialsRotationGeneratedCredentials[number]> => {
+ const { instanceUrl, headers } = await $authedRequest();
+
+ const { data: consumersData } = await request.request<TSalesforceConsumersResponse>({
+ method: "GET",
+ url: `${instanceUrl}/services/data/${SALESFORCE_API_VERSION}/apps/oauth/credentials/${appId}`,
+ headers
+ });
+
+ const consumer = consumersData.consumers?.[0];
+ if (!consumer?.stagedCredentialsUrl) {
+ throw new Error(`Salesforce app "${appId}" has no consumers configured for rotation`);
+ }
+ // rotating the External Client App that the connection itself authenticates with would
+ // immediately invalidate the connection's own credentials, breaking this rotation and any
+ // subsequent ones. Refuse rather than self-revoke.
+ if (consumer.key === connection.credentials.consumerKey) {
+ throw new BadRequestError({
+ message:
+ "Cannot rotate the consumer secret of the External Client App that this Salesforce connection authenticates with. Choose a different app or use a separate Salesforce connection."
+ });
+ }
+ if (consumersData.consumers.length > 1) {
+ logger.warn(
+ `Salesforce app [appId=${appId}] has ${consumersData.consumers.length} consumers; rotating the first one only — assign each consumer to its own External Client App if all need rotation`
+ );
+ }
+
+ const { data: stagedData } = await request.request<TSalesforceStagedCredentialsResponse>({
+ method: "POST",
+ url: `${instanceUrl}${consumer.stagedCredentialsUrl}`,
+ headers
+ });
+
+ const staged = stagedData.stagedCredentials?.[0];
+ if (!staged?.url || !staged.key || !staged.secret) {
+ throw new Error("Salesforce did not return a staged credential after POST");
+ }
+
+ try {
+ await request.request({
+ method: "PATCH",
+ url: `${instanceUrl}${staged.url}`,
+ headers,
+ data: { command: "rotate" }
+ });
+ } catch (error) {
+ // best-effort cleanup of the staged credential we just created
+ await request
+ .request({ method: "DELETE", url: `${instanceUrl}${staged.url}`, headers })
+ .catch((cleanupError: Error) => {
+ logger.warn(
+ { err: cleanupError },
+ `Failed to clean up Salesforce staged credential after PATCH rotate failure [stagedUrl=${staged.url}]`
+ );
+ });
+ throw error;
+ }
+
+ return {
+ consumerKey: staged.key,
+ consumerSecret: staged.secret,
+ stagedCredentialUrl: staged.url
+ };
+ };
+
+ const issueCredentials: TRotationFactoryIssueCredentials<
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+ > = async (callback) => {
+ const credentials = await $issueConsumerSecret();
+ return callback(credentials);
+ };
+
+ const revokeCredentials: TRotationFactoryRevokeCredentials<
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+ > = async (credentialsToRevoke, callback) => {
+ logger.info({ credentialsToRevoke }, "Revoking Salesforce OAuth credentials");
+ await Promise.all(
+ credentialsToRevoke
+ .filter((credential) => credential.stagedCredentialUrl)
+ .map((credential) => $deleteStagedCredential(credential.stagedCredentialUrl))
+ );
+
+ return callback();
+ };
+
+ const rotateCredentials: TRotationFactoryRotateCredentials<
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+ > = async (credentialToRevoke, callback) => {
+ const credentials = await $issueConsumerSecret();
+ // Salesforce keeps the previously-active credential valid for a grace period after PATCH rotate,
+ // which is why this rotation is dual-credentials. Once a credential ages out of the array (one
+ // generation past "previous"), DELETE it from Salesforce to prevent stale credentials from
+ // remaining authentic-able beyond their Infisical lifespan.
+ if (credentialToRevoke?.stagedCredentialUrl) {
+ await $deleteStagedCredential(credentialToRevoke.stagedCredentialUrl);
+ }
+ return callback(credentials);
+ };
+
+ const getSecretsPayload: TRotationFactoryGetSecretsPayload<
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+ > = (generatedCredentials) => [
+ { key: secretsMapping.consumerKey, value: generatedCredentials.consumerKey },
+ { key: secretsMapping.consumerSecret, value: generatedCredentials.consumerSecret }
+ ];
+
+ return {
+ issueCredentials,
+ revokeCredentials,
+ rotateCredentials,
+ getSecretsPayload
+ };
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-schemas.ts
new file mode 100644
index 0000000000..7900c92d87
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-schemas.ts
@@ -0,0 +1,75 @@
+import { z } from "zod";
+
+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
+import {
+ BaseCreateSecretRotationSchema,
+ BaseSecretRotationSchema,
+ BaseUpdateSecretRotationSchema
+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-schemas";
+import { SecretRotations } from "@app/lib/api-docs";
+import { SecretNameSchema } from "@app/server/lib/schemas";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+export const SalesforceOauthCredentialsRotationGeneratedCredentialsSchema = z
+ .object({
+ consumerKey: z.string(),
+ consumerSecret: z.string(),
+ stagedCredentialUrl: z.string()
+ })
+ .array()
+ .min(1)
+ .max(2);
+
+const SalesforceOauthCredentialsRotationParametersSchema = z.object({
+ appId: z
+ .string()
+ .trim()
+ .min(1, "App Identifier Required")
+ .describe(SecretRotations.PARAMETERS.SALESFORCE_OAUTH_CREDENTIALS.appId),
+ appName: z
+ .string()
+ .trim()
+ .min(1, "App Name Required")
+ .describe(SecretRotations.PARAMETERS.SALESFORCE_OAUTH_CREDENTIALS.appName)
+});
+
+const SalesforceOauthCredentialsRotationSecretsMappingSchema = z.object({
+ consumerKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.SALESFORCE_OAUTH_CREDENTIALS.consumerKey),
+ consumerSecret: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.SALESFORCE_OAUTH_CREDENTIALS.consumerSecret)
+});
+
+export const SalesforceOauthCredentialsRotationTemplateSchema = z.object({
+ secretsMapping: z.object({
+ consumerKey: z.string(),
+ consumerSecret: z.string()
+ })
+});
+
+export const SalesforceOauthCredentialsRotationSchema = BaseSecretRotationSchema(
+ SecretRotation.SalesforceOauthCredentials
+).extend({
+ type: z.literal(SecretRotation.SalesforceOauthCredentials),
+ parameters: SalesforceOauthCredentialsRotationParametersSchema,
+ secretsMapping: SalesforceOauthCredentialsRotationSecretsMappingSchema
+});
+
+export const CreateSalesforceOauthCredentialsRotationSchema = BaseCreateSecretRotationSchema(
+ SecretRotation.SalesforceOauthCredentials
+).extend({
+ parameters: SalesforceOauthCredentialsRotationParametersSchema,
+ secretsMapping: SalesforceOauthCredentialsRotationSecretsMappingSchema
+});
+
+export const UpdateSalesforceOauthCredentialsRotationSchema = BaseUpdateSecretRotationSchema(
+ SecretRotation.SalesforceOauthCredentials
+).extend({
+ parameters: SalesforceOauthCredentialsRotationParametersSchema.optional(),
+ secretsMapping: SalesforceOauthCredentialsRotationSecretsMappingSchema.optional()
+});
+
+export const SalesforceOauthCredentialsRotationListItemSchema = z.object({
+ name: z.literal("Salesforce OAuth Credentials"),
+ connection: z.literal(AppConnection.Salesforce),
+ type: z.literal(SecretRotation.SalesforceOauthCredentials),
+ template: SalesforceOauthCredentialsRotationTemplateSchema
+});
diff --git a/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-types.ts
new file mode 100644
index 0000000000..f0aecf3b1f
--- /dev/null
+++ b/backend/src/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-types.ts
@@ -0,0 +1,53 @@
+import { z } from "zod";
+
+import { TSalesforceConnection } from "@app/services/app-connection/salesforce";
+
+import {
+ CreateSalesforceOauthCredentialsRotationSchema,
+ SalesforceOauthCredentialsRotationGeneratedCredentialsSchema,
+ SalesforceOauthCredentialsRotationListItemSchema,
+ SalesforceOauthCredentialsRotationSchema
+} from "./salesforce-oauth-credentials-rotation-schemas";
+
+export type TSalesforceOauthCredentialsRotation = z.infer<typeof SalesforceOauthCredentialsRotationSchema>;
+
+export type TSalesforceOauthCredentialsRotationInput = z.infer<typeof CreateSalesforceOauthCredentialsRotationSchema>;
+
+export type TSalesforceOauthCredentialsRotationListItem = z.infer<
+ typeof SalesforceOauthCredentialsRotationListItemSchema
+>;
+
+export type TSalesforceOauthCredentialsRotationWithConnection = TSalesforceOauthCredentialsRotation & {
+ connection: TSalesforceConnection;
+};
+
+export type TSalesforceOauthCredentialsRotationGeneratedCredentials = z.infer<
+ typeof SalesforceOauthCredentialsRotationGeneratedCredentialsSchema
+>;
+
+type TSalesforceConsumer = {
+ id: string;
+ key: string;
+ name: string;
+ stagedCredentialsUrl: string;
+ url: string;
+};
+
+export type TSalesforceConsumersResponse = {
+ consumers: TSalesforceConsumer[];
+ currentPageUrl: string;
+ nextPageUrl?: string | null;
+};
+
+type TSalesforceStagedCredential = {
+ id: string;
+ key: string;
+ secret: string;
+ state: string;
+ url: string;
+};
+
+export type TSalesforceStagedCredentialsResponse = {
+ stagedCredentials: TSalesforceStagedCredential[];
+ url: string;
+};
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
index 4643531cc8..9ab50b7947 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts
@@ -16,7 +16,8 @@ export enum SecretRotation {
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
HpIloLocalAccount = "hp-ilo-local-account",
- SupabaseApiKey = "supabase-api-key"
+ SupabaseApiKey = "supabase-api-key",
+ SalesforceOauthCredentials = "salesforce-oauth-credentials"
}
export enum SecretRotationStatus {
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
index 3a47fa50b2..53a12b1616 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts
@@ -21,6 +21,7 @@ import { OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION } from "./open-router-api-key"
import { ORACLEDB_CREDENTIALS_ROTATION_LIST_OPTION } from "./oracledb-credentials";
import { POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION } from "./postgres-credentials";
import { REDIS_CREDENTIALS_ROTATION_LIST_OPTION } from "./redis-credentials";
+import { SALESFORCE_OAUTH_CREDENTIALS_ROTATION_LIST_OPTION } from "./salesforce-oauth-credentials";
import { TSecretRotationV2DALFactory } from "./secret-rotation-v2-dal";
import { SecretRotation, SecretRotationStatus } from "./secret-rotation-v2-enums";
import { TSecretRotationV2ServiceFactory, TSecretRotationV2ServiceFactoryDep } from "./secret-rotation-v2-service";
@@ -60,7 +61,8 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List
[SecretRotation.WindowsLocalAccount]: WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION,
[SecretRotation.OpenRouterApiKey]: OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION,
[SecretRotation.HpIloLocalAccount]: HP_ILO_ROTATION_LIST_OPTION,
- [SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION
+ [SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION,
+ [SecretRotation.SalesforceOauthCredentials]: SALESFORCE_OAUTH_CREDENTIALS_ROTATION_LIST_OPTION
};
export const listSecretRotationOptions = () => {
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
index ca22e153cc..a706ea9bc0 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts
@@ -19,7 +19,8 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
[SecretRotation.WindowsLocalAccount]: "Windows Local Account",
[SecretRotation.OpenRouterApiKey]: "OpenRouter API Key",
[SecretRotation.HpIloLocalAccount]: "HP iLO Local Account",
- [SecretRotation.SupabaseApiKey]: "Supabase API Key"
+ [SecretRotation.SupabaseApiKey]: "Supabase API Key",
+ [SecretRotation.SalesforceOauthCredentials]: "Salesforce OAuth Credentials"
};
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
@@ -40,5 +41,6 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
- [SecretRotation.SupabaseApiKey]: AppConnection.Supabase
+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase,
+ [SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce
};
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
index 2508742402..01ec1cae89 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts
@@ -17,6 +17,7 @@ import { auth0ClientSecretRotationFactory } from "@app/ee/services/secret-rotati
import { azureClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns";
import { databricksServicePrincipalSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns";
import { ldapPasswordRotationFactory } from "@app/ee/services/secret-rotation-v2/ldap-password/ldap-password-rotation-fns";
+import { salesforceOauthCredentialsRotationFactory } from "@app/ee/services/secret-rotation-v2/salesforce-oauth-credentials/salesforce-oauth-credentials-rotation-fns";
import { SecretRotation, SecretRotationStatus } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
import {
calculateNextRotationAt,
@@ -186,7 +187,9 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem
[SecretRotation.WindowsLocalAccount]: windowsLocalAccountRotationFactory as TRotationFactoryImplementation,
[SecretRotation.OpenRouterApiKey]: openRouterApiKeyRotationFactory as TRotationFactoryImplementation,
[SecretRotation.HpIloLocalAccount]: hpIloRotationFactory as TRotationFactoryImplementation,
- [SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation
+ [SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation,
+ [SecretRotation.SalesforceOauthCredentials]:
+ salesforceOauthCredentialsRotationFactory as TRotationFactoryImplementation
};
export const secretRotationV2ServiceFactory = ({
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
index e9a67ff84a..e2cab9dbb8 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts
@@ -107,6 +107,13 @@ import {
TRedisCredentialsRotationListItem,
TRedisCredentialsRotationWithConnection
} from "./redis-credentials/redis-credentials-rotation-types";
+import {
+ TSalesforceOauthCredentialsRotation,
+ TSalesforceOauthCredentialsRotationGeneratedCredentials,
+ TSalesforceOauthCredentialsRotationInput,
+ TSalesforceOauthCredentialsRotationListItem,
+ TSalesforceOauthCredentialsRotationWithConnection
+} from "./salesforce-oauth-credentials";
import { TSecretRotationV2DALFactory } from "./secret-rotation-v2-dal";
import { SecretRotation } from "./secret-rotation-v2-enums";
import {
@@ -149,7 +156,8 @@ export type TSecretRotationV2 =
| TWindowsLocalAccountRotation
| TOpenRouterApiKeyRotation
| THpIloRotation
- | TSupabaseApiKeyRotation;
+ | TSupabaseApiKeyRotation
+ | TSalesforceOauthCredentialsRotation;
export type TSecretRotationV2WithConnection =
| TPostgresCredentialsRotationWithConnection
@@ -169,7 +177,8 @@ export type TSecretRotationV2WithConnection =
| TWindowsLocalAccountRotationWithConnection
| TOpenRouterApiKeyRotationWithConnection
| THpIloRotationWithConnection
- | TSupabaseApiKeyRotationWithConnection;
+ | TSupabaseApiKeyRotationWithConnection
+ | TSalesforceOauthCredentialsRotationWithConnection;
export type TSecretRotationV2GeneratedCredentials =
| TSqlCredentialsRotationGeneratedCredentials
@@ -185,7 +194,8 @@ export type TSecretRotationV2GeneratedCredentials =
| TWindowsLocalAccountRotationGeneratedCredentials
| TOpenRouterApiKeyRotationGeneratedCredentials
| THpIloRotationGeneratedCredentials
- | TSupabaseApiKeyRotationGeneratedCredentials;
+ | TSupabaseApiKeyRotationGeneratedCredentials
+ | TSalesforceOauthCredentialsRotationGeneratedCredentials;
export type TSecretRotationV2Input =
| TPostgresCredentialsRotationInput
@@ -205,7 +215,8 @@ export type TSecretRotationV2Input =
| TWindowsLocalAccountRotationInput
| TOpenRouterApiKeyRotationInput
| THpIloRotationInput
- | TSupabaseApiKeyRotationInput;
+ | TSupabaseApiKeyRotationInput
+ | TSalesforceOauthCredentialsRotationInput;
export type TSecretRotationV2ListItem =
| TPostgresCredentialsRotationListItem
@@ -225,7 +236,8 @@ export type TSecretRotationV2ListItem =
| TWindowsLocalAccountRotationListItem
| TOpenRouterApiKeyRotationListItem
| THpIloRotationListItem
- | TSupabaseApiKeyRotationListItem;
+ | TSupabaseApiKeyRotationListItem
+ | TSalesforceOauthCredentialsRotationListItem;
export type TSecretRotationV2TemporaryParameters =
| TLdapPasswordRotationInput["temporaryParameters"]
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
index 8b88b76faa..d1e45df22e 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts
@@ -13,6 +13,7 @@ import { OpenRouterApiKeyRotationSchema } from "@app/ee/services/secret-rotation
import { OracleDBCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/oracledb-credentials";
import { PostgresCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
import { RedisCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";
+import { SalesforceOauthCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/salesforce-oauth-credentials";
import { UnixLinuxLocalAccountRotationSchema } from "@app/ee/services/secret-rotation-v2/unix-linux-local-account-rotation";
import { WindowsLocalAccountRotationSchema } from "@app/ee/services/secret-rotation-v2/windows-local-account-rotation";
@@ -38,5 +39,6 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
HpIloRotationSchema,
- SupabaseApiKeyRotationSchema
+ SupabaseApiKeyRotationSchema,
+ SalesforceOauthCredentialsRotationSchema
]);
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 68f0cf126f..6f745c35b9 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3295,6 +3295,10 @@ export const SecretRotations = {
SUPABASE_API_KEY: {
projectRef: "The reference ID of the Supabase project to rotate the API key for.",
keyType: "The type of the API key to rotate (e.g. publishable, secret)."
+ },
+ SALESFORCE_OAUTH_CREDENTIALS: {
+ appId: "The identifier of the Salesforce External Client App to rotate the consumer secret for.",
+ appName: "The developer name of the Salesforce External Client App to rotate the consumer secret for."
}
},
SECRETS_MAPPING: {
@@ -3358,6 +3362,10 @@ export const SecretRotations = {
},
SUPABASE_API_KEY: {
apiKey: "The name of the secret that the rotated Supabase API key will be mapped to."
+ },
+ SALESFORCE_OAUTH_CREDENTIALS: {
+ consumerKey: "The name of the secret that the rotated Salesforce consumer key will be mapped to.",
+ consumerSecret: "The name of the secret that the rotated Salesforce consumer secret will be mapped to."
}
}
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/salesforce-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/salesforce-connection-router.ts
index 64e941f95d..fd1812b7d8 100644
--- a/backend/src/server/routes/v1/app-connection-routers/salesforce-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/salesforce-connection-router.ts
@@ -1,9 +1,14 @@
+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 {
CreateSalesforceConnectionSchema,
SanitizedSalesforceConnectionSchema,
UpdateSalesforceConnectionSchema
} from "@app/services/app-connection/salesforce";
+import { AuthMode } from "@app/services/auth/auth-type";
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
@@ -15,4 +20,33 @@ export const registerSalesforceConnectionRouter = async (server: FastifyZodProvi
createSchema: CreateSalesforceConnectionSchema,
updateSchema: UpdateSalesforceConnectionSchema
});
+
+ // The below endpoints are not exposed and for Infisical App use
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/oauth-apps`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listSalesforceOauthApps",
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z.object({
+ apps: z.object({ identifier: z.string(), developerName: z.string() }).array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+
+ const apps = await server.services.appConnection.salesforce.listOauthApps(connectionId, req.permission);
+
+ return { apps };
+ }
+ });
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index 5b96f33232..8ab2008dbf 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -138,6 +138,7 @@ import { ValidateRedisConnectionCredentialsSchema } from "./redis";
import { ValidateRenderConnectionCredentialsSchema } from "./render/render-connection-schema";
import { renderConnectionService } from "./render/render-connection-service";
import { ValidateSalesforceConnectionCredentialsSchema } from "./salesforce";
+import { salesforceConnectionService } from "./salesforce/salesforce-connection-service";
import { ValidateSmbConnectionCredentialsSchema } from "./smb";
import { ValidateSshConnectionCredentialsSchema } from "./ssh";
import { ValidateSupabaseConnectionCredentialsSchema } from "./supabase";
@@ -1087,6 +1088,7 @@ export const appConnectionServiceFactory = ({
azureClientSecrets: azureClientSecretsConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
azureDevOps: azureDevOpsConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
auth0: auth0ConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
+ salesforce: salesforceConnectionService(connectAppConnectionById),
hcvault: hcVaultConnectionService(connectAppConnectionById, gatewayService, gatewayV2Service),
windmill: windmillConnectionService(connectAppConnectionById),
teamcity: teamcityConnectionService(connectAppConnectionById),
diff --git a/backend/src/services/app-connection/salesforce/salesforce-connection-fns.ts b/backend/src/services/app-connection/salesforce/salesforce-connection-fns.ts
index fb36527103..bb4e28c53e 100644
--- a/backend/src/services/app-connection/salesforce/salesforce-connection-fns.ts
+++ b/backend/src/services/app-connection/salesforce/salesforce-connection-fns.ts
@@ -5,7 +5,18 @@ import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { SalesforceConnectionMethod } from "./salesforce-connection-enums";
-import { TSalesforceConnectionConfig, TSalesforceTokenResponse } from "./salesforce-connection-types";
+import {
+ TSalesforceConnection,
+ TSalesforceConnectionConfig,
+ TSalesforceOauthApp,
+ TSalesforceOauthUsageResponse,
+ TSalesforceTokenResponse
+} from "./salesforce-connection-types";
+
+export const SALESFORCE_API_VERSION = "v65.0";
+
+const normalizeInstanceUrl = (instanceUrl: string) =>
+ removeTrailingSlash(instanceUrl.startsWith("http") ? instanceUrl : `https://${instanceUrl}`);
export const getSalesforceConnectionListItem = () => {
return {
@@ -15,29 +26,64 @@ export const getSalesforceConnectionListItem = () => {
};
};
-export const validateSalesforceConnectionCredentials = async ({ credentials }: TSalesforceConnectionConfig) => {
+export const getSalesforceConnectionAccessToken = async (
+ credentials: TSalesforceConnection["credentials"]
+): Promise<{ accessToken: string; instanceUrl: string }> => {
const { instanceUrl, consumerKey, consumerSecret } = credentials;
-
- const normalizedInstanceUrl = instanceUrl.startsWith("https") ? instanceUrl : `https://${instanceUrl}`;
+ const normalizedInstanceUrl = normalizeInstanceUrl(instanceUrl);
await blockLocalAndPrivateIpAddresses(normalizedInstanceUrl);
- try {
- const { data } = await request.request<TSalesforceTokenResponse>({
- method: "POST",
- url: `${removeTrailingSlash(normalizedInstanceUrl)}/services/oauth2/token`,
- headers: { "content-type": "application/x-www-form-urlencoded" },
- data: new URLSearchParams({
- grant_type: "client_credentials",
- client_id: consumerKey,
- client_secret: consumerSecret
- })
+ const { data } = await request.request<TSalesforceTokenResponse>({
+ method: "POST",
+ url: `${normalizedInstanceUrl}/services/oauth2/token`,
+ headers: { "content-type": "application/x-www-form-urlencoded" },
+ data: new URLSearchParams({
+ grant_type: "client_credentials",
+ client_id: consumerKey,
+ client_secret: consumerSecret
+ })
+ });
+
+ if (data.token_type !== "Bearer") {
+ throw new BadRequestError({
+ message: `Unable to authenticate Salesforce connection: unexpected token type "${data.token_type}".`
});
+ }
+
+ return { accessToken: data.access_token, instanceUrl: normalizedInstanceUrl };
+};
+
+// Cap pagination so a misbehaving Salesforce response cannot make this loop unbounded.
+const SALESFORCE_OAUTH_APPS_PAGE_LIMIT = 10;
- if (data.token_type !== "Bearer") {
- throw new BadRequestError({
- message: `Unable to validate Salesforce connection: unexpected token type "${data.token_type}".`
- });
- }
+export const listSalesforceConnectionOauthApps = async (
+ appConnection: TSalesforceConnection
+): Promise<TSalesforceOauthApp[]> => {
+ const { accessToken, instanceUrl } = await getSalesforceConnectionAccessToken(appConnection.credentials);
+ const headers = { Authorization: `Bearer ${accessToken}`, Accept: "application/json" };
+
+ const apps: TSalesforceOauthApp[] = [];
+ let nextUrl: string | null = `/services/data/${SALESFORCE_API_VERSION}/apps/oauth/usage`;
+
+ for (let page = 0; page < SALESFORCE_OAUTH_APPS_PAGE_LIMIT && nextUrl; page += 1) {
+ const url: string = `${instanceUrl}${nextUrl}`;
+ // eslint-disable-next-line no-await-in-loop
+ const response = await request.request<TSalesforceOauthUsageResponse>({
+ method: "GET",
+ url,
+ headers
+ });
+
+ apps.push(...(response.data.apps ?? []));
+ nextUrl = response.data.nextPageUrl ?? null;
+ }
+
+ return apps;
+};
+
+export const validateSalesforceConnectionCredentials = async ({ credentials }: TSalesforceConnectionConfig) => {
+ try {
+ await getSalesforceConnectionAccessToken(credentials);
} catch (error: unknown) {
if (error instanceof BadRequestError) throw error;
throw new BadRequestError({
diff --git a/backend/src/services/app-connection/salesforce/salesforce-connection-service.ts b/backend/src/services/app-connection/salesforce/salesforce-connection-service.ts
new file mode 100644
index 0000000000..2ad0e963f3
--- /dev/null
+++ b/backend/src/services/app-connection/salesforce/salesforce-connection-service.ts
@@ -0,0 +1,25 @@
+import { OrgServiceActor } from "@app/lib/types";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { listSalesforceConnectionOauthApps } from "@app/services/app-connection/salesforce/salesforce-connection-fns";
+
+import { TSalesforceConnection } from "./salesforce-connection-types";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TSalesforceConnection>;
+
+export const salesforceConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
+ const listOauthApps = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.Salesforce, connectionId, actor);
+
+ const apps = await listSalesforceConnectionOauthApps(appConnection);
+
+ return apps;
+ };
+
+ return {
+ listOauthApps
+ };
+};
diff --git a/backend/src/services/app-connection/salesforce/salesforce-connection-types.ts b/backend/src/services/app-connection/salesforce/salesforce-connection-types.ts
index f706c65e3d..b8abe6458d 100644
--- a/backend/src/services/app-connection/salesforce/salesforce-connection-types.ts
+++ b/backend/src/services/app-connection/salesforce/salesforce-connection-types.ts
@@ -32,3 +32,17 @@ export type TSalesforceTokenResponse = {
signature?: string;
scope?: string;
};
+
+export type TSalesforceOauthApp = {
+ identifier: string;
+ developerName: string;
+};
+
+export type TSalesforceOauthUsageResponse = {
+ apps: Array<{
+ identifier: string;
+ developerName: string;
+ }>;
+ currentPageUrl: string;
+ nextPageUrl?: string | null;
+};
diff --git a/frontend/public/images/integrations/Salesforce.png b/frontend/public/images/integrations/Salesforce.png
new file mode 100644
index 0000000000..01ab6b94c1
Binary files /dev/null and b/frontend/public/images/integrations/Salesforce.png differ
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSalesforceOauthCredentialsRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSalesforceOauthCredentialsRotationGeneratedCredentials.tsx
new file mode 100644
index 0000000000..c031b91f1b
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSalesforceOauthCredentialsRotationGeneratedCredentials.tsx
@@ -0,0 +1,41 @@
+import { TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/salesforce-oauth-credentials-rotation";
+
+import { CredentialDisplay, ViewRotationGeneratedCredentialsDisplay } from "./shared";
+
+type Props = {
+ generatedCredentialsResponse: TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse;
+};
+
+export const ViewSalesforceOauthCredentialsRotationGeneratedCredentials = ({
+ generatedCredentialsResponse: { generatedCredentials, activeIndex }
+}: Props) => {
+ const inactiveIndex = activeIndex === 0 ? 1 : 0;
+
+ const activeCredentials = generatedCredentials[activeIndex];
+ const inactiveCredentials = generatedCredentials[inactiveIndex];
+
+ return (
+ <ViewRotationGeneratedCredentialsDisplay
+ activeCredentials={
+ <>
+ <CredentialDisplay isSensitive label="Consumer Key">
+ {activeCredentials?.consumerKey}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="Consumer Secret">
+ {activeCredentials?.consumerSecret}
+ </CredentialDisplay>
+ </>
+ }
+ inactiveCredentials={
+ <>
+ <CredentialDisplay isSensitive label="Consumer Key">
+ {inactiveCredentials?.consumerKey}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="Consumer Secret">
+ {inactiveCredentials?.consumerSecret}
+ </CredentialDisplay>
+ </>
+ }
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
index 7a523c686c..1ef9bd55e8 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
@@ -28,6 +28,7 @@ import { ViewHpIloRotationGeneratedCredentials } from "./ViewHpIloRotationGenera
import { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";
import { ViewOpenRouterApiKeyRotationGeneratedCredentials } from "./ViewOpenRouterApiKeyRotationGeneratedCredentials";
import { ViewRedisCredentialsRotationGeneratedCredentials } from "./ViewRedisCredentialsRotationGeneratedCredentials";
+import { ViewSalesforceOauthCredentialsRotationGeneratedCredentials } from "./ViewSalesforceOauthCredentialsRotationGeneratedCredentials";
import { ViewSupabaseApiKeyRotationGeneratedCredentials } from "./ViewSupabaseApiKeyRotationGeneratedCredentials";
import { ViewUnixLinuxLocalAccountRotationGeneratedCredentials } from "./ViewUnixLinuxLocalAccountRotationGeneratedCredentials";
import { ViewWindowsLocalAccountRotationGeneratedCredentials } from "./ViewWindowsLocalAccountRotationGeneratedCredentials";
@@ -172,6 +173,13 @@ const Content = ({ secretRotation }: ContentProps) => {
/>
);
break;
+ case SecretRotation.SalesforceOauthCredentials:
+ Component = (
+ <ViewSalesforceOauthCredentialsRotationGeneratedCredentials
+ generatedCredentialsResponse={generatedCredentialsResponse}
+ />
+ );
+ break;
default:
throw new Error("Unhandled View Generated Credential Rotation Type");
}
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx
new file mode 100644
index 0000000000..bff5451d84
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx
@@ -0,0 +1,74 @@
+import { Controller, useFormContext } from "react-hook-form";
+import { SingleValue } from "react-select";
+import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { useSalesforceConnectionListOauthApps } from "@app/hooks/api/appConnections/salesforce";
+import { TSalesforceOauthApp } from "@app/hooks/api/appConnections/salesforce/types";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+export const SalesforceOauthCredentialsRotationParametersFields = () => {
+ const { control, watch, setValue } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SalesforceOauthCredentials;
+ }
+ >();
+
+ const connectionId = watch("connection.id");
+
+ const { data: apps, isPending: isAppsPending } = useSalesforceConnectionListOauthApps(
+ connectionId,
+ { enabled: Boolean(connectionId) }
+ );
+
+ return (
+ <Controller
+ name="parameters.appId"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="External Client App"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content={
+ <>
+ Ensure that your Salesforce External Client App has OAuth client credentials
+ enabled and is reachable by the connection.
+ </>
+ }
+ >
+ <div>
+ <span>Don&#39;t see the app you&#39;re looking for?</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </div>
+ </Tooltip>
+ }
+ >
+ <FilterableSelect
+ menuPlacement="top"
+ isLoading={isAppsPending && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ value={apps?.find((app) => app.identifier === value) ?? null}
+ onChange={(option) => {
+ const selected = option as SingleValue<TSalesforceOauthApp>;
+ onChange(selected?.identifier ?? "");
+ setValue("parameters.appName", selected?.developerName ?? "", {
+ shouldDirty: true,
+ shouldValidate: true
+ });
+ }}
+ options={apps}
+ placeholder="Select an external client app..."
+ getOptionLabel={(option) => option.developerName}
+ getOptionValue={(option) => option.identifier}
+ />
+ </FormControl>
+ )}
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index eab5d623ce..94e220c7ce 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -14,6 +14,7 @@ import { MongoRotationParametersFields } from "./MongoRotationParametersFields";
import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotationParametersFields";
import { OpenRouterApiKeyRotationParametersFields } from "./OpenRouterApiKeyRotationParametersFields";
import { RedisCredentialsRotationParametersFields } from "./RedisCredentialsRotationParametersFields";
+import { SalesforceOauthCredentialsRotationParametersFields } from "./SalesforceOauthCredentialsRotationParametersFields";
import { SqlCredentialsRotationParametersFields } from "./shared";
import { SupabaseApiKeyRotationParametersFields } from "./SupabaseApiKeyRotationParametersFields";
import { UnixLinuxLocalAccountRotationParametersFields } from "./UnixLinuxLocalAccountRotationParametersFields";
@@ -38,7 +39,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationParametersFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationParametersFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationParametersFields,
- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields,
+ [SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationParametersFields
};
export const SecretRotationV2ParametersFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx
new file mode 100644
index 0000000000..2bd86b352b
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx
@@ -0,0 +1,29 @@
+import { useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { GenericFieldLabel } from "@app/components/v2";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretRotationReviewSection } from "./shared";
+
+export const SalesforceOauthCredentialsRotationReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SalesforceOauthCredentials;
+ }
+ >();
+
+ const [parameters, { consumerKey, consumerSecret }] = watch(["parameters", "secretsMapping"]);
+
+ return (
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <GenericFieldLabel label="External Client App">{parameters.appName}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <GenericFieldLabel label="Consumer Key">{consumerKey}</GenericFieldLabel>
+ <GenericFieldLabel label="Consumer Secret">{consumerSecret}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index cef3ad5faa..7f3a2c6ee7 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -16,6 +16,7 @@ import { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFi
import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationReviewFields";
import { OpenRouterApiKeyRotationReviewFields } from "./OpenRouterApiKeyRotationReviewFields";
import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";
+import { SalesforceOauthCredentialsRotationReviewFields } from "./SalesforceOauthCredentialsRotationReviewFields";
import { SqlCredentialsRotationReviewFields } from "./shared";
import { SupabaseApiKeyRotationReviewFields } from "./SupabaseApiKeyRotationReviewFields";
import { UnixLinuxLocalAccountRotationReviewFields } from "./UnixLinuxLocalAccountRotationReviewFields";
@@ -40,7 +41,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationReviewFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationReviewFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationReviewFields,
- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields,
+ [SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationReviewFields
};
export const SecretRotationV2ReviewFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx
new file mode 100644
index 0000000000..14d1bf1eb0
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx
@@ -0,0 +1,58 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretsMappingTable } from "./shared";
+
+export const SalesforceOauthCredentialsRotationSecretsMappingFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.SalesforceOauthCredentials;
+ }
+ >();
+
+ const { rotationOption } = useSecretRotationV2Option(SecretRotation.SalesforceOauthCredentials);
+
+ const items = [
+ {
+ name: "Consumer Key",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.consumerKey}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.consumerKey"
+ />
+ )
+ },
+ {
+ name: "Consumer Secret",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.consumerSecret}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.consumerSecret"
+ />
+ )
+ }
+ ];
+
+ return <SecretsMappingTable items={items} />;
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index e9878c6577..e66a8579e2 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -13,6 +13,7 @@ import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotation
import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretRotationSecretsMappingFields";
import { OpenRouterApiKeyRotationSecretsMappingFields } from "./OpenRouterApiKeyRotationSecretsMappingFields";
import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";
+import { SalesforceOauthCredentialsRotationSecretsMappingFields } from "./SalesforceOauthCredentialsRotationSecretsMappingFields";
import { SqlCredentialsRotationSecretsMappingFields } from "./shared";
import { SupabaseApiKeyRotationSecretsMappingFields } from "./SupabaseApiKeyRotationSecretsMappingFields";
import { UnixLinuxLocalAccountRotationSecretsMappingFields } from "./UnixLinuxLocalAccountRotationSecretsMappingFields";
@@ -37,7 +38,9 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationSecretsMappingFields,
[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationSecretsMappingFields,
[SecretRotation.HpIloLocalAccount]: HpIloRotationSecretsMappingFields,
- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields
+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields,
+ [SecretRotation.SalesforceOauthCredentials]:
+ SalesforceOauthCredentialsRotationSecretsMappingFields
};
export const SecretRotationV2SecretsMappingFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
index 863061b4f7..61aee9da30 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
@@ -21,6 +21,7 @@ import { OktaClientSecretRotationSchema } from "./okta-client-secret-rotation-sc
import { OpenRouterApiKeyRotationSchema } from "./open-router-api-key-rotation-schema";
import { OracleDBCredentialsRotationSchema } from "./oracledb-credentials-rotation-schema";
import { RedisCredentialsRotationSchema } from "./redis-credentials-rotation-schema";
+import { SalesforceOauthCredentialsRotationSchema } from "./salesforce-oauth-credentials-rotation-schema";
import { SupabaseApiKeyRotationSchema } from "./supabase-api-key-rotation-schema";
import { UnixLinuxLocalAccountRotationSchema } from "./unix-linux-local-account-rotation-schema";
import { WindowsLocalAccountRotationSchema } from "./windows-local-account-rotation-schema";
@@ -46,7 +47,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
WindowsLocalAccountRotationSchema,
OpenRouterApiKeyRotationSchema,
HpIloRotationSchema,
- SupabaseApiKeyRotationSchema
+ SupabaseApiKeyRotationSchema,
+ SalesforceOauthCredentialsRotationSchema
]),
z.object({ id: z.string().optional() })
)
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/salesforce-oauth-credentials-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/salesforce-oauth-credentials-rotation-schema.ts
new file mode 100644
index 0000000000..0aec7ccb0e
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/salesforce-oauth-credentials-rotation-schema.ts
@@ -0,0 +1,18 @@
+import { z } from "zod";
+
+import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+export const SalesforceOauthCredentialsRotationSchema = z
+ .object({
+ type: z.literal(SecretRotation.SalesforceOauthCredentials),
+ parameters: z.object({
+ appId: z.string().trim().min(1, "App required"),
+ appName: z.string().trim().min(1, "App required")
+ }),
+ secretsMapping: z.object({
+ consumerKey: z.string().trim().min(1, "Consumer Key required"),
+ consumerSecret: z.string().trim().min(1, "Consumer Secret required")
+ })
+ })
+ .merge(BaseSecretRotationSchema);
diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts
index 55afff89bb..359f3601fc 100644
--- a/frontend/src/helpers/secretRotationsV2.ts
+++ b/frontend/src/helpers/secretRotationsV2.ts
@@ -94,6 +94,11 @@ export const SECRET_ROTATION_MAP: Record<
name: "Supabase API Key",
image: "Supabase.png",
size: 50
+ },
+ [SecretRotation.SalesforceOauthCredentials]: {
+ name: "Salesforce OAuth Credentials",
+ image: "Salesforce.png",
+ size: 50
}
};
@@ -115,7 +120,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,
[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,
[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,
- [SecretRotation.SupabaseApiKey]: AppConnection.Supabase
+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase,
+ [SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce
};
// if a rotation can potentially have downtime due to rotating a single credential set this to false
@@ -137,7 +143,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
[SecretRotation.WindowsLocalAccount]: false,
[SecretRotation.OpenRouterApiKey]: true,
[SecretRotation.HpIloLocalAccount]: false,
- [SecretRotation.SupabaseApiKey]: true
+ [SecretRotation.SupabaseApiKey]: true,
+ [SecretRotation.SalesforceOauthCredentials]: true
};
export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {
diff --git a/frontend/src/hooks/api/appConnections/salesforce/index.ts b/frontend/src/hooks/api/appConnections/salesforce/index.ts
new file mode 100644
index 0000000000..b69c251208
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/salesforce/index.ts
@@ -0,0 +1 @@
+export * from "./queries";
diff --git a/frontend/src/hooks/api/appConnections/salesforce/queries.tsx b/frontend/src/hooks/api/appConnections/salesforce/queries.tsx
new file mode 100644
index 0000000000..ab3185ba1a
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/salesforce/queries.tsx
@@ -0,0 +1,37 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { appConnectionKeys } from "../queries";
+import { TSalesforceOauthApp } from "./types";
+
+const salesforceConnectionKeys = {
+ all: [...appConnectionKeys.all, "salesforce"] as const,
+ listOauthApps: (connectionId: string) =>
+ [...salesforceConnectionKeys.all, "oauth-apps", connectionId] as const
+};
+
+export const useSalesforceConnectionListOauthApps = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TSalesforceOauthApp[],
+ unknown,
+ TSalesforceOauthApp[],
+ ReturnType<typeof salesforceConnectionKeys.listOauthApps>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: salesforceConnectionKeys.listOauthApps(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ apps: TSalesforceOauthApp[] }>(
+ `/api/v1/app-connections/salesforce/${connectionId}/oauth-apps`
+ );
+
+ return data.apps;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/salesforce/types.ts b/frontend/src/hooks/api/appConnections/salesforce/types.ts
new file mode 100644
index 0000000000..9905ab4164
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/salesforce/types.ts
@@ -0,0 +1,4 @@
+export type TSalesforceOauthApp = {
+ identifier: string;
+ developerName: string;
+};
diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts
index 22cf52d8e0..545ee59604 100644
--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts
@@ -16,7 +16,8 @@ export enum SecretRotation {
WindowsLocalAccount = "windows-local-account",
OpenRouterApiKey = "open-router-api-key",
HpIloLocalAccount = "hp-ilo-local-account",
- SupabaseApiKey = "supabase-api-key"
+ SupabaseApiKey = "supabase-api-key",
+ SalesforceOauthCredentials = "salesforce-oauth-credentials"
}
export enum SecretRotationStatus {
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
index dc4807a439..f685c3eda5 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
@@ -74,6 +74,11 @@ import {
TRedisCredentialsRotationGeneratedCredentialsResponse,
TRedisCredentialsRotationOption
} from "./redis-credentials-rotation";
+import {
+ TSalesforceOauthCredentialsRotation,
+ TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse,
+ TSalesforceOauthCredentialsRotationOption
+} from "./salesforce-oauth-credentials-rotation";
import {
TSupabaseApiKeyRotation,
TSupabaseApiKeyRotationGeneratedCredentialsResponse,
@@ -109,6 +114,7 @@ export type TSecretRotationV2 = (
| TOpenRouterApiKeyRotation
| THpIloRotation
| TSupabaseApiKeyRotation
+ | TSalesforceOauthCredentialsRotation
) & {
secrets: (SecretV3RawSanitized | null)[];
};
@@ -128,7 +134,8 @@ export type TSecretRotationV2Option =
| TWindowsLocalAccountRotationOption
| TOpenRouterApiKeyRotationOption
| THpIloRotationOption
- | TSupabaseApiKeyRotationOption;
+ | TSupabaseApiKeyRotationOption
+ | TSalesforceOauthCredentialsRotationOption;
export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };
@@ -152,7 +159,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =
| TWindowsLocalAccountRotationGeneratedCredentialsResponse
| TOpenRouterApiKeyRotationGeneratedCredentialsResponse
| THpIloRotationGeneratedCredentialsResponse
- | TSupabaseApiKeyRotationGeneratedCredentialsResponse;
+ | TSupabaseApiKeyRotationGeneratedCredentialsResponse
+ | TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse;
export type TCreateSecretRotationV2DTO = DiscriminativePick<
TSecretRotationV2,
@@ -225,6 +233,7 @@ export type TSecretRotationOptionMap = {
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationOption;
[SecretRotation.HpIloLocalAccount]: THpIloRotationOption;
[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationOption;
+ [SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationOption;
};
export type TSecretRotationGeneratedCredentialsResponseMap = {
@@ -246,6 +255,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {
[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;
[SecretRotation.HpIloLocalAccount]: THpIloRotationGeneratedCredentialsResponse;
[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationGeneratedCredentialsResponse;
+ [SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse;
};
// Unified type for local account reconciliation (Unix/Linux, Windows, and HP iLO)
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/salesforce-oauth-credentials-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/salesforce-oauth-credentials-rotation.ts
new file mode 100644
index 0000000000..70112fa46d
--- /dev/null
+++ b/frontend/src/hooks/api/secretRotationsV2/types/salesforce-oauth-credentials-rotation.ts
@@ -0,0 +1,38 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import {
+ TSecretRotationV2Base,
+ TSecretRotationV2GeneratedCredentialsResponseBase
+} from "@app/hooks/api/secretRotationsV2/types/shared";
+
+export type TSalesforceOauthCredentialsRotation = TSecretRotationV2Base & {
+ type: SecretRotation.SalesforceOauthCredentials;
+ parameters: {
+ appId: string;
+ appName: string;
+ };
+ secretsMapping: {
+ consumerKey: string;
+ consumerSecret: string;
+ };
+};
+
+export type TSalesforceOauthCredentialsRotationGeneratedCredentials = {
+ consumerKey: string;
+ consumerSecret: string;
+};
+
+export type TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse =
+ TSecretRotationV2GeneratedCredentialsResponseBase<
+ SecretRotation.SalesforceOauthCredentials,
+ TSalesforceOauthCredentialsRotationGeneratedCredentials
+ >;
+
+export type TSalesforceOauthCredentialsRotationOption = {
+ name: string;
+ type: SecretRotation.SalesforceOauthCredentials;
+ connection: AppConnection.Salesforce;
+ template: {
+ secretsMapping: TSalesforceOauthCredentialsRotation["secretsMapping"];
+ };
+};