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
feat: databricks secret rotation. Address PR comments
Carlos Monastyrskie2633da59c36
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-account-secret-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-account-secret-rotation-router.tsdeleted file mode 100644index 76fc1731ff..0000000000--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-account-secret-rotation-router.ts+++ /dev/null@@ -1,19 +0,0 @@-import {- CreateDatabricksServiceAccountSecretRotationSchema,- DatabricksServiceAccountSecretRotationGeneratedCredentialsSchema,- DatabricksServiceAccountSecretRotationSchema,- UpdateDatabricksServiceAccountSecretRotationSchema-} from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret";-import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";--import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";--export const registerDatabricksServiceAccountSecretRotationRouter = async (server: FastifyZodProvider) =>- registerSecretRotationEndpoints({- type: SecretRotation.DatabricksServiceAccountSecret,- server,- responseSchema: DatabricksServiceAccountSecretRotationSchema,- createSchema: CreateDatabricksServiceAccountSecretRotationSchema,- updateSchema: UpdateDatabricksServiceAccountSecretRotationSchema,- generatedCredentialsSchema: DatabricksServiceAccountSecretRotationGeneratedCredentialsSchema- });diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-principal-secret-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-principal-secret-rotation-router.tsnew file mode 100644index 0000000000..63d56e516b--- /dev/null+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-principal-secret-rotation-router.ts@@ -0,0 +1,19 @@+import {+ CreateDatabricksServicePrincipalSecretRotationSchema,+ DatabricksServicePrincipalSecretRotationGeneratedCredentialsSchema,+ DatabricksServicePrincipalSecretRotationSchema,+ UpdateDatabricksServicePrincipalSecretRotationSchema+} from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";++import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";++export const registerDatabricksServicePrincipalSecretRotationRouter = async (server: FastifyZodProvider) =>+ registerSecretRotationEndpoints({+ type: SecretRotation.DatabricksServicePrincipalSecret,+ server,+ responseSchema: DatabricksServicePrincipalSecretRotationSchema,+ createSchema: CreateDatabricksServicePrincipalSecretRotationSchema,+ updateSchema: UpdateDatabricksServicePrincipalSecretRotationSchema,+ generatedCredentialsSchema: DatabricksServicePrincipalSecretRotationGeneratedCredentialsSchema+ });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.tsindex 614f71c198..c2302d8fff 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@@ -3,7 +3,7 @@ import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotatimport { registerAuth0ClientSecretRotationRouter } from "./auth0-client-secret-rotation-router";import { registerAwsIamUserSecretRotationRouter } from "./aws-iam-user-secret-rotation-router";import { registerAzureClientSecretRotationRouter } from "./azure-client-secret-rotation-router";-import { registerDatabricksServiceAccountSecretRotationRouter } from "./databricks-service-account-secret-rotation-router";+import { registerDatabricksServicePrincipalSecretRotationRouter } from "./databricks-service-principal-secret-rotation-router";import { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router";import { registerMongoDBCredentialsRotationRouter } from "./mongodb-credentials-rotation-router";import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rotation-router";@@ -30,5 +30,5 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<[SecretRotation.OktaClientSecret]: registerOktaClientSecretRotationRouter,[SecretRotation.RedisCredentials]: registerRedisCredentialsRotationRouter,[SecretRotation.MongoDBCredentials]: registerMongoDBCredentialsRotationRouter,- [SecretRotation.DatabricksServiceAccountSecret]: registerDatabricksServiceAccountSecretRotationRouter+ [SecretRotation.DatabricksServicePrincipalSecret]: registerDatabricksServicePrincipalSecretRotationRouter};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.tsindex ffa3c2be08..58dd509786 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@@ -4,7 +4,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { Auth0ClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/auth0-client-secret";import { AwsIamUserSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/aws-iam-user-secret";import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";-import { DatabricksServiceAccountSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret";+import { DatabricksServicePrincipalSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";import { LdapPasswordRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";import { MongoDBCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mongodb-credentials";import { MsSqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";@@ -31,7 +31,7 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [OktaClientSecretRotationListItemSchema,RedisCredentialsRotationListItemSchema,MongoDBCredentialsRotationListItemSchema,- DatabricksServiceAccountSecretRotationListItemSchema+ DatabricksServicePrincipalSecretRotationListItemSchema]);export const registerSecretRotationV2Router = async (server: FastifyZodProvider) => {diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-schemas.tsdeleted file mode 100644index 9d8cc91c43..0000000000--- a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-schemas.ts+++ /dev/null@@ -1,82 +0,0 @@-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 DatabricksServiceAccountSecretRotationGeneratedCredentialsSchema = z- .object({- clientId: z.string(),- clientSecret: z.string(),- secretId: z.string()- })- .array()- .min(1)- .max(2);--const DatabricksServiceAccountSecretRotationParametersSchema = z.object({- servicePrincipalId: z- .string()- .trim()- .min(1, "Service Principal ID Required")- .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_ACCOUNT_SECRET.servicePrincipalId),- servicePrincipalName: z- .string()- .trim()- .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_ACCOUNT_SECRET.servicePrincipalName)- .optional(),- clientId: z- .string()- .trim()- .min(1, "Client ID Required")- .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_ACCOUNT_SECRET.clientId)-});--const DatabricksServiceAccountSecretRotationSecretsMappingSchema = z.object({- clientId: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.DATABRICKS_SERVICE_ACCOUNT_SECRET.clientId),- clientSecret: SecretNameSchema.describe(- SecretRotations.SECRETS_MAPPING.DATABRICKS_SERVICE_ACCOUNT_SECRET.clientSecret- )-});--export const DatabricksServiceAccountSecretRotationTemplateSchema = z.object({- secretsMapping: z.object({- clientId: z.string(),- clientSecret: z.string()- })-});--export const DatabricksServiceAccountSecretRotationSchema = BaseSecretRotationSchema(- SecretRotation.DatabricksServiceAccountSecret-).extend({- type: z.literal(SecretRotation.DatabricksServiceAccountSecret),- parameters: DatabricksServiceAccountSecretRotationParametersSchema,- secretsMapping: DatabricksServiceAccountSecretRotationSecretsMappingSchema-});--export const CreateDatabricksServiceAccountSecretRotationSchema = BaseCreateSecretRotationSchema(- SecretRotation.DatabricksServiceAccountSecret-).extend({- parameters: DatabricksServiceAccountSecretRotationParametersSchema,- secretsMapping: DatabricksServiceAccountSecretRotationSecretsMappingSchema-});--export const UpdateDatabricksServiceAccountSecretRotationSchema = BaseUpdateSecretRotationSchema(- SecretRotation.DatabricksServiceAccountSecret-).extend({- parameters: DatabricksServiceAccountSecretRotationParametersSchema.optional(),- secretsMapping: DatabricksServiceAccountSecretRotationSecretsMappingSchema.optional()-});--export const DatabricksServiceAccountSecretRotationListItemSchema = z.object({- name: z.literal("Databricks Service Account Secret"),- connection: z.literal(AppConnection.Databricks),- type: z.literal(SecretRotation.DatabricksServiceAccountSecret),- template: DatabricksServiceAccountSecretRotationTemplateSchema-});diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types.tsdeleted file mode 100644index ef3e9dce90..0000000000--- a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types.ts+++ /dev/null@@ -1,44 +0,0 @@-import { z } from "zod";--import { TDatabricksConnection } from "@app/services/app-connection/databricks/databricks-connection-types";--import {- CreateDatabricksServiceAccountSecretRotationSchema,- DatabricksServiceAccountSecretRotationGeneratedCredentialsSchema,- DatabricksServiceAccountSecretRotationListItemSchema,- DatabricksServiceAccountSecretRotationSchema-} from "./databricks-service-account-secret-rotation-schemas";--export type TDatabricksServiceAccountSecretRotation = z.infer<typeof DatabricksServiceAccountSecretRotationSchema>;--export type TDatabricksServiceAccountSecretRotationInput = z.infer<- typeof CreateDatabricksServiceAccountSecretRotationSchema->;--export type TDatabricksServiceAccountSecretRotationListItem = z.infer<- typeof DatabricksServiceAccountSecretRotationListItemSchema->;--export type TDatabricksServiceAccountSecretRotationWithConnection = TDatabricksServiceAccountSecretRotation & {- connection: TDatabricksConnection;-};--export type TDatabricksServiceAccountSecretRotationGeneratedCredentials = z.infer<- typeof DatabricksServiceAccountSecretRotationGeneratedCredentialsSchema->;--export interface TDatabricksServiceAccountSecretRotationParameters {- servicePrincipalId: string;- servicePrincipalName?: string;- clientId?: string;-}--export interface TDatabricksServiceAccountSecretRotationSecretsMapping {- clientId: string;- clientSecret: string;-}--export interface DatabricksGenerateSecretResponse {- client_secret: string;- id: string;-}diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/index.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/index.tsdeleted file mode 100644index ff30803cd0..0000000000--- a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from "./databricks-service-account-secret-rotation-constants";-export * from "./databricks-service-account-secret-rotation-schemas";-export * from "./databricks-service-account-secret-rotation-types";diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-constants.tssimilarity index 69%rename from backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-constants.tsrename to backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-constants.tsindex 3b36984206..8a61ad9446 100644--- a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-constants.ts+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-constants.ts@@ -2,9 +2,9 @@ import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotatimport { TSecretRotationV2ListItem } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";import { AppConnection } from "@app/services/app-connection/app-connection-enums";-export const DATABRICKS_SERVICE_ACCOUNT_SECRET_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {- name: "Databricks Service Account Secret",- type: SecretRotation.DatabricksServiceAccountSecret,+export const DATABRICKS_SERVICE_PRINCIPAL_SECRET_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {+ name: "Databricks Service Principal Secret",+ type: SecretRotation.DatabricksServicePrincipalSecret,connection: AppConnection.Databricks,template: {secretsMapping: {diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns.tssimilarity index 63%rename from backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-fns.tsrename to backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns.tsindex 1a1e5b3feb..ea1114c3a2 100644--- a/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns.ts@@ -2,9 +2,9 @@import { AxiosError } from "axios";import {- TDatabricksServiceAccountSecretRotationGeneratedCredentials,- TDatabricksServiceAccountSecretRotationWithConnection-} from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types";+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials,+ TDatabricksServicePrincipalSecretRotationWithConnection+} from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-types";import {TRotationFactory,TRotationFactoryGetSecretsPayload,@@ -20,15 +20,17 @@ import { getDatabricksConnectionAccessToken } from "@app/services/app-connectionconst DELAY_MS = 1000;const EXPIRY_PADDING_IN_DAYS = 3;+const MAX_DATABRICKS_SECRETS = 4;+const MAX_ROTATION_INTERVAL_DAYS = 730;const sleep = async () =>new Promise((resolve) => {setTimeout(resolve, DELAY_MS);});-export const databricksServiceAccountSecretRotationFactory: TRotationFactory<- TDatabricksServiceAccountSecretRotationWithConnection,- TDatabricksServiceAccountSecretRotationGeneratedCredentials+export const databricksServicePrincipalSecretRotationFactory: TRotationFactory<+ TDatabricksServicePrincipalSecretRotationWithConnection,+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials> = (secretRotation, appConnectionDAL, kmsService) => {const {connection,@@ -46,8 +48,8 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<const endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets`;const now = new Date();- const endDateTime = new Date();- endDateTime.setDate(now.getDate() + rotationInterval * 2 + EXPIRY_PADDING_IN_DAYS);+ const endDateTime = new Date(now);+ endDateTime.setTime(now.getTime() + (rotationInterval * 2 + EXPIRY_PADDING_IN_DAYS) * 24 * 60 * 60 * 1000);try {const { data } = await request.post<unknown>(@@ -116,7 +118,7 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(workspaceUrl);- let endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets`;+ const endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets`;try {const { data } = await request.get<{ secrets: Array<{ id: string; client_secret?: string }> }>(endpoint, {@@ -128,26 +130,27 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<return data.secrets ?? [];} catch (error: unknown) {- if (error instanceof AxiosError && (error.response?.status === 403 || error.response?.status === 404)) {- endpoint = `${workspaceUrl}/api/2.0/preview/scim/v2/ServicePrincipals/${servicePrincipalId}/credentials/secrets`;-- try {- const { data: workspaceData } = await request.get<{ secrets: Array<{ id: string; client_secret?: string }> }>(- endpoint,- {- headers: {- Authorization: `Bearer ${accessToken}`,- "Content-Type": "application/json"- }- }- );-- return workspaceData.secrets ?? [];- } catch {- return [];+ let errorMessage = "Unknown error";++ if (error instanceof AxiosError && error.response?.data) {+ const responseData: unknown = error.response.data;++ if (typeof responseData === "string") {+ errorMessage = responseData;+ } else if (typeof responseData === "object" && responseData !== null) {+ const data = responseData as Record<string, unknown>;+ errorMessage =+ (data.error as string | undefined) || (data.message as string | undefined) || JSON.stringify(responseData);}+ } else if (error instanceof AxiosError && error.message) {+ errorMessage = error.message;+ } else if (error instanceof Error) {+ errorMessage = error.message;}- return [];++ throw new BadRequestError({+ message: `Failed to list secrets for service principal ${servicePrincipalId}: ${errorMessage}`+ });}};@@ -157,7 +160,7 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(workspaceUrl);- let endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets/${secretId}`;+ const endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets/${secretId}`;try {await request.delete(endpoint, {@@ -167,39 +170,6 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<}});} catch (error: unknown) {- if (error instanceof AxiosError && (error.response?.status === 403 || error.response?.status === 404)) {- endpoint = `${workspaceUrl}/api/2.0/preview/scim/v2/ServicePrincipals/${servicePrincipalId}/credentials/secrets/${secretId}`;-- try {- await request.delete(endpoint, {- headers: {- Authorization: `Bearer ${accessToken}`,- "Content-Type": "application/json"- }- });- return;- } catch (workspaceError: unknown) {- let errorMessage = "Unknown error";-- if (workspaceError instanceof AxiosError && workspaceError.response?.data) {- const responseData: unknown = workspaceError.response.data;-- if (typeof responseData === "string") {- errorMessage = responseData;- } else if (typeof responseData === "object" && responseData !== null) {- const data = responseData as Record<string, unknown>;- errorMessage = (data.error as string | undefined) || workspaceError.message || "Unknown error";- }- } else if (workspaceError instanceof Error) {- errorMessage = workspaceError.message;- }-- throw new BadRequestError({- message: `Failed to revoke secret with id ${secretId} for service principal ${servicePrincipalId}: ${errorMessage}`- });- }- }-if (error instanceof AxiosError && error.response?.status === 404) {return;}@@ -209,10 +179,14 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<if (error instanceof AxiosError && error.response?.data) {const responseData: unknown = error.response.data;- if (typeof responseData === "object" && responseData !== null) {+ if (typeof responseData === "string") {+ errorMessage = responseData;+ } else if (typeof responseData === "object" && responseData !== null) {const data = responseData as Record<string, unknown>;errorMessage = (data.error as string | undefined) || error.message || "Unknown error";}+ } else if (error instanceof AxiosError && error.message) {+ errorMessage = error.message;} else if (error instanceof Error) {errorMessage = error.message;}@@ -224,11 +198,11 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<};const issueCredentials: TRotationFactoryIssueCredentials<- TDatabricksServiceAccountSecretRotationGeneratedCredentials+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials> = async (callback) => {- if (rotationInterval > Math.floor(365 * 2.5) - EXPIRY_PADDING_IN_DAYS) {+ if (rotationInterval > MAX_ROTATION_INTERVAL_DAYS) {throw new BadRequestError({- message: "Databricks does not support OAuth secret duration over 2.5 years"+ message: `Databricks does not support OAuth secret duration over ${MAX_ROTATION_INTERVAL_DAYS} days`});}@@ -237,7 +211,7 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<};const revokeCredentials: TRotationFactoryRevokeCredentials<- TDatabricksServiceAccountSecretRotationGeneratedCredentials+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials> = async (credentials, callback) => {if (!credentials?.length) return callback();@@ -249,20 +223,23 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<};const rotateCredentials: TRotationFactoryRotateCredentials<- TDatabricksServiceAccountSecretRotationGeneratedCredentials- > = async (oldCredentials, callback, activeCredentials) => {- const existingSecrets = await $listClientSecrets();+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials+ > = async (oldCredentials, callback) => {+ if (rotationInterval > MAX_ROTATION_INTERVAL_DAYS) {+ throw new BadRequestError({+ message: `Databricks does not support OAuth secret duration over ${MAX_ROTATION_INTERVAL_DAYS} days`+ });+ }if (oldCredentials?.secretId) {await revokeCredential(oldCredentials.secretId);- } else if (activeCredentials) {- const otherSecrets = existingSecrets.filter((secret) => secret.id !== activeCredentials.secretId);- if (otherSecrets.length > 0) {- const oldestSecret = otherSecrets[0];- if (oldestSecret) {- await revokeCredential(oldestSecret.id);- }- }+ }++ const existingSecrets = await $listClientSecrets();+ if (existingSecrets.length >= MAX_DATABRICKS_SECRETS) {+ throw new BadRequestError({+ message: `Cannot create new secret: service principal ${servicePrincipalId} already has ${existingSecrets.length} secrets. Databricks allows a maximum of ${MAX_DATABRICKS_SECRETS} secrets per service principal. Please revoke at least one secret before rotating.`+ });}const newCredentials = await $rotateClientSecret();@@ -270,7 +247,7 @@ export const databricksServiceAccountSecretRotationFactory: TRotationFactory<};const getSecretsPayload: TRotationFactoryGetSecretsPayload<- TDatabricksServiceAccountSecretRotationGeneratedCredentials+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials> = ({ clientSecret, clientId }) => [{ key: secretsMapping.clientId, value: clientId },{ key: secretsMapping.clientSecret, value: clientSecret }diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-schemas.tsnew file mode 100644index 0000000000..9fe0e88db6--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-schemas.ts@@ -0,0 +1,82 @@+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 DatabricksServicePrincipalSecretRotationGeneratedCredentialsSchema = z+ .object({+ clientId: z.string(),+ clientSecret: z.string(),+ secretId: z.string()+ })+ .array()+ .min(1)+ .max(2);++const DatabricksServicePrincipalSecretRotationParametersSchema = z.object({+ servicePrincipalId: z+ .string()+ .trim()+ .min(1, "Service Principal ID Required")+ .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_PRINCIPAL_SECRET.servicePrincipalId),+ servicePrincipalName: z+ .string()+ .trim()+ .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_PRINCIPAL_SECRET.servicePrincipalName)+ .optional(),+ clientId: z+ .string()+ .trim()+ .min(1, "Client ID Required")+ .describe(SecretRotations.PARAMETERS.DATABRICKS_SERVICE_PRINCIPAL_SECRET.clientId)+});++const DatabricksServicePrincipalSecretRotationSecretsMappingSchema = z.object({+ clientId: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.DATABRICKS_SERVICE_PRINCIPAL_SECRET.clientId),+ clientSecret: SecretNameSchema.describe(+ SecretRotations.SECRETS_MAPPING.DATABRICKS_SERVICE_PRINCIPAL_SECRET.clientSecret+ )+});++export const DatabricksServicePrincipalSecretRotationTemplateSchema = z.object({+ secretsMapping: z.object({+ clientId: z.string(),+ clientSecret: z.string()+ })+});++export const DatabricksServicePrincipalSecretRotationSchema = BaseSecretRotationSchema(+ SecretRotation.DatabricksServicePrincipalSecret+).extend({+ type: z.literal(SecretRotation.DatabricksServicePrincipalSecret),+ parameters: DatabricksServicePrincipalSecretRotationParametersSchema,+ secretsMapping: DatabricksServicePrincipalSecretRotationSecretsMappingSchema+});++export const CreateDatabricksServicePrincipalSecretRotationSchema = BaseCreateSecretRotationSchema(+ SecretRotation.DatabricksServicePrincipalSecret+).extend({+ parameters: DatabricksServicePrincipalSecretRotationParametersSchema,+ secretsMapping: DatabricksServicePrincipalSecretRotationSecretsMappingSchema+});++export const UpdateDatabricksServicePrincipalSecretRotationSchema = BaseUpdateSecretRotationSchema(+ SecretRotation.DatabricksServicePrincipalSecret+).extend({+ parameters: DatabricksServicePrincipalSecretRotationParametersSchema.optional(),+ secretsMapping: DatabricksServicePrincipalSecretRotationSecretsMappingSchema.optional()+});++export const DatabricksServicePrincipalSecretRotationListItemSchema = z.object({+ name: z.literal("Databricks Service Principal Secret"),+ connection: z.literal(AppConnection.Databricks),+ type: z.literal(SecretRotation.DatabricksServicePrincipalSecret),+ template: DatabricksServicePrincipalSecretRotationTemplateSchema+});diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-types.tsnew file mode 100644index 0000000000..960b882552--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-types.ts@@ -0,0 +1,44 @@+import { z } from "zod";++import { TDatabricksConnection } from "@app/services/app-connection/databricks/databricks-connection-types";++import {+ CreateDatabricksServicePrincipalSecretRotationSchema,+ DatabricksServicePrincipalSecretRotationGeneratedCredentialsSchema,+ DatabricksServicePrincipalSecretRotationListItemSchema,+ DatabricksServicePrincipalSecretRotationSchema+} from "./databricks-service-principal-secret-rotation-schemas";++export type TDatabricksServicePrincipalSecretRotation = z.infer<typeof DatabricksServicePrincipalSecretRotationSchema>;++export type TDatabricksServicePrincipalSecretRotationInput = z.infer<+ typeof CreateDatabricksServicePrincipalSecretRotationSchema+>;++export type TDatabricksServicePrincipalSecretRotationListItem = z.infer<+ typeof DatabricksServicePrincipalSecretRotationListItemSchema+>;++export type TDatabricksServicePrincipalSecretRotationWithConnection = TDatabricksServicePrincipalSecretRotation & {+ connection: TDatabricksConnection;+};++export type TDatabricksServicePrincipalSecretRotationGeneratedCredentials = z.infer<+ typeof DatabricksServicePrincipalSecretRotationGeneratedCredentialsSchema+>;++export interface TDatabricksServicePrincipalSecretRotationParameters {+ servicePrincipalId: string;+ servicePrincipalName?: string;+ clientId?: string;+}++export interface TDatabricksServicePrincipalSecretRotationSecretsMapping {+ clientId: string;+ clientSecret: string;+}++export interface DatabricksGenerateSecretResponse {+ client_secret: string;+ id: string;+}diff --git a/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/index.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/index.tsnew file mode 100644index 0000000000..34b43131e8--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-principal-secret/index.ts@@ -0,0 +1,3 @@+export * from "./databricks-service-principal-secret-rotation-constants";+export * from "./databricks-service-principal-secret-rotation-schemas";+export * from "./databricks-service-principal-secret-rotation-types";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.tsindex 3b1e9aa4d2..c9a1078c39 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@@ -10,7 +10,7 @@ export enum SecretRotation {OktaClientSecret = "okta-client-secret",RedisCredentials = "redis-credentials",MongoDBCredentials = "mongodb-credentials",- DatabricksServiceAccountSecret = "databricks-service-account-secret"+ DatabricksServicePrincipalSecret = "databricks-service-principal-secret"}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.tsindex 6d2f70b664..d24c6be970 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@@ -8,7 +8,7 @@ import { KmsDataKey } from "@app/services/kms/kms-types";import { AUTH0_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./auth0-client-secret";import { AWS_IAM_USER_SECRET_ROTATION_LIST_OPTION } from "./aws-iam-user-secret";import { AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./azure-client-secret";-import { DATABRICKS_SERVICE_ACCOUNT_SECRET_ROTATION_LIST_OPTION } from "./databricks-service-account-secret";+import { DATABRICKS_SERVICE_PRINCIPAL_SECRET_ROTATION_LIST_OPTION } from "./databricks-service-principal-secret";import { LDAP_PASSWORD_ROTATION_LIST_OPTION, TLdapPasswordRotation } from "./ldap-password";import { MONGODB_CREDENTIALS_ROTATION_LIST_OPTION } from "./mongodb-credentials";import { MSSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mssql-credentials";@@ -41,7 +41,7 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List[SecretRotation.OktaClientSecret]: OKTA_CLIENT_SECRET_ROTATION_LIST_OPTION,[SecretRotation.RedisCredentials]: REDIS_CREDENTIALS_ROTATION_LIST_OPTION,[SecretRotation.MongoDBCredentials]: MONGODB_CREDENTIALS_ROTATION_LIST_OPTION,- [SecretRotation.DatabricksServiceAccountSecret]: DATABRICKS_SERVICE_ACCOUNT_SECRET_ROTATION_LIST_OPTION+ [SecretRotation.DatabricksServicePrincipalSecret]: DATABRICKS_SERVICE_PRINCIPAL_SECRET_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.tsindex 48278384a5..616d8efc32 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@@ -13,7 +13,7 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.OktaClientSecret]: "Okta Client Secret",[SecretRotation.RedisCredentials]: "Redis Credentials",[SecretRotation.MongoDBCredentials]: "MongoDB Credentials",- [SecretRotation.DatabricksServiceAccountSecret]: "Databricks Service Account Secret"+ [SecretRotation.DatabricksServicePrincipalSecret]: "Databricks Service Principal Secret"};export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {@@ -28,5 +28,5 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.OktaClientSecret]: AppConnection.Okta,[SecretRotation.RedisCredentials]: AppConnection.Redis,[SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,- [SecretRotation.DatabricksServiceAccountSecret]: AppConnection.Databricks+ [SecretRotation.DatabricksServicePrincipalSecret]: AppConnection.Databricks};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.tsindex 58b14ce2ba..a907ac11e5 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@@ -15,7 +15,7 @@ import {} from "@app/ee/services/permission/project-permission";import { auth0ClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns";import { azureClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns";-import { databricksServiceAccountSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-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 { SecretRotation, SecretRotationStatus } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";import {@@ -138,8 +138,8 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem[SecretRotation.OktaClientSecret]: oktaClientSecretRotationFactory as TRotationFactoryImplementation,[SecretRotation.RedisCredentials]: redisCredentialsRotationFactory as TRotationFactoryImplementation,[SecretRotation.MongoDBCredentials]: mongodbCredentialsRotationFactory as TRotationFactoryImplementation,- [SecretRotation.DatabricksServiceAccountSecret]:- databricksServiceAccountSecretRotationFactory as TRotationFactoryImplementation+ [SecretRotation.DatabricksServicePrincipalSecret]:+ databricksServicePrincipalSecretRotationFactory 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.tsindex ce1e8b1193..adccfea73d 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@@ -29,12 +29,12 @@ import {TAzureClientSecretRotationWithConnection} from "./azure-client-secret";import {- TDatabricksServiceAccountSecretRotation,- TDatabricksServiceAccountSecretRotationGeneratedCredentials,- TDatabricksServiceAccountSecretRotationInput,- TDatabricksServiceAccountSecretRotationListItem,- TDatabricksServiceAccountSecretRotationWithConnection-} from "./databricks-service-account-secret";+ TDatabricksServicePrincipalSecretRotation,+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials,+ TDatabricksServicePrincipalSecretRotationInput,+ TDatabricksServicePrincipalSecretRotationListItem,+ TDatabricksServicePrincipalSecretRotationWithConnection+} from "./databricks-service-principal-secret";import {TLdapPasswordRotation,TLdapPasswordRotationGeneratedCredentials,@@ -101,7 +101,7 @@ export type TSecretRotationV2 =| TOktaClientSecretRotation| TRedisCredentialsRotation| TMongoDBCredentialsRotation- | TDatabricksServiceAccountSecretRotation;+ | TDatabricksServicePrincipalSecretRotation;export type TSecretRotationV2WithConnection =| TPostgresCredentialsRotationWithConnection@@ -115,7 +115,7 @@ export type TSecretRotationV2WithConnection =| TOktaClientSecretRotationWithConnection| TRedisCredentialsRotationWithConnection| TMongoDBCredentialsRotationWithConnection- | TDatabricksServiceAccountSecretRotationWithConnection;+ | TDatabricksServicePrincipalSecretRotationWithConnection;export type TSecretRotationV2GeneratedCredentials =| TSqlCredentialsRotationGeneratedCredentials@@ -125,7 +125,7 @@ export type TSecretRotationV2GeneratedCredentials =| TAwsIamUserSecretRotationGeneratedCredentials| TOktaClientSecretRotationGeneratedCredentials| TRedisCredentialsRotationGeneratedCredentials- | TDatabricksServiceAccountSecretRotationGeneratedCredentials;+ | TDatabricksServicePrincipalSecretRotationGeneratedCredentials;export type TSecretRotationV2Input =| TPostgresCredentialsRotationInput@@ -139,7 +139,7 @@ export type TSecretRotationV2Input =| TOktaClientSecretRotationInput| TRedisCredentialsRotationInput| TMongoDBCredentialsRotationInput- | TDatabricksServiceAccountSecretRotationInput;+ | TDatabricksServicePrincipalSecretRotationInput;export type TSecretRotationV2ListItem =| TPostgresCredentialsRotationListItem@@ -153,7 +153,7 @@ export type TSecretRotationV2ListItem =| TOktaClientSecretRotationListItem| TRedisCredentialsRotationListItem| TMongoDBCredentialsRotationListItem- | TDatabricksServiceAccountSecretRotationListItem;+ | TDatabricksServicePrincipalSecretRotationListItem;export type TSecretRotationV2TemporaryParameters = TLdapPasswordRotationInput["temporaryParameters"] | undefined;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.tsindex 64fc1f5d36..a7633e0d54 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@@ -3,7 +3,7 @@ import { z } from "zod";import { Auth0ClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/auth0-client-secret";import { AwsIamUserSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/aws-iam-user-secret";import { AzureClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";-import { DatabricksServiceAccountSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret";+import { DatabricksServicePrincipalSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";import { LdapPasswordRotationSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";import { MongoDBCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mongodb-credentials";import { MsSqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";@@ -25,5 +25,5 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [OktaClientSecretRotationSchema,RedisCredentialsRotationSchema,MongoDBCredentialsRotationSchema,- DatabricksServiceAccountSecretRotationSchema+ DatabricksServicePrincipalSecretRotationSchema]);diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex fbfb2c466a..e6cc2a4942 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2922,6 +2922,11 @@ export const SecretRotations = {username2:"The username of the second MongoDB user to rotate passwords for. This user must already exist in your database."},+ DATABRICKS_SERVICE_PRINCIPAL_SECRET: {+ servicePrincipalId: "The ID of the Databricks Service Principal to rotate the OAuth secret for.",+ servicePrincipalName: "The name of the Databricks Service Principal to rotate the OAuth secret for.",+ clientId: "The client ID of the Databricks Service Principal to rotate the OAuth secret for."+ },DATABRICKS_SERVICE_ACCOUNT_SECRET: {servicePrincipalId: "The ID of the Databricks Service Principal to rotate the OAuth secret for.",servicePrincipalName: "The name of the Databricks Service Principal to rotate the OAuth secret for.",@@ -2961,6 +2966,10 @@ export const SecretRotations = {username: "The name of the secret that the active username will be mapped to.",password: "The name of the secret that the generated password will be mapped to."},+ DATABRICKS_SERVICE_PRINCIPAL_SECRET: {+ clientId: "The name of the secret that the client ID will be mapped to.",+ clientSecret: "The name of the secret that the rotated OAuth client secret will be mapped to."+ },DATABRICKS_SERVICE_ACCOUNT_SECRET: {clientId: "The name of the secret that the client ID will be mapped to.",clientSecret: "The name of the secret that the rotated OAuth client secret will be mapped to."diff --git a/backend/src/services/app-connection/databricks/databricks-connection-service.ts b/backend/src/services/app-connection/databricks/databricks-connection-service.tsindex 70843cd286..c6aaa6a949 100644--- a/backend/src/services/app-connection/databricks/databricks-connection-service.ts+++ b/backend/src/services/app-connection/databricks/databricks-connection-service.ts@@ -53,21 +53,48 @@ const listDatabricksServicePrincipals = async (const accessToken = await getDatabricksConnectionAccessToken(appConnection, appConnectionDAL, kmsService);- const { data } = await request.get<TDatabricksListServicePrincipalsResponse>(- `${removeTrailingSlash(workspaceUrl)}/api/2.0/preview/scim/v2/ServicePrincipals`,- {- headers: {- Authorization: `Bearer ${accessToken}`,- "Content-Type": "application/json"+ const allServicePrincipals: Array<{ id: string; name: string; clientId: string }> = [];+ let startIndex = 1;+ const itemsPerPage = 100;+ const maxPages = 20;+ let currentPage = 0;++ while (currentPage < maxPages) {+ // eslint-disable-next-line no-await-in-loop+ const { data } = await request.get<TDatabricksListServicePrincipalsResponse>(+ `${removeTrailingSlash(workspaceUrl)}/api/2.0/preview/scim/v2/ServicePrincipals`,+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Content-Type": "application/json"+ },+ params: {+ startIndex,+ count: itemsPerPage+ }}+ );++ const resources = data.Resources ?? [];+ allServicePrincipals.push(+ ...resources.map((sp) => ({+ id: sp.id,+ name: sp.displayName,+ clientId: sp.applicationId || ""+ }))+ );++ currentPage += 1;++ const totalResults = data.totalResults ?? resources.length;+ if (allServicePrincipals.length >= totalResults || resources.length < itemsPerPage) {+ break;}- );- return (data.Resources ?? []).map((sp) => ({- id: sp.id,- name: sp.displayName,- clientId: sp.applicationId || ""- }));+ startIndex += itemsPerPage;+ }++ return allServicePrincipals;};export const databricksConnectionService = (diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create.mdxindex 5e2be2686b..9c64cb3950 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create.mdx@@ -1,6 +1,6 @@---title: "Create"-openapi: "POST /api/v2/secret-rotations/databricks-service-account-secret"+openapi: "POST /api/v2/secret-rotations/databricks-service-principal-secret"---<Note>diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete.mdxindex 1a80f52892..759c4ac257 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete.mdx@@ -1,6 +1,6 @@---title: "Delete"-openapi: "DELETE /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}"+openapi: "DELETE /api/v2/secret-rotations/databricks-service-principal-secret/{rotationId}"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id.mdxindex 4184396945..d39262bad9 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id.mdx@@ -1,6 +1,6 @@---title: "Get by ID"-openapi: "GET /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}"+openapi: "GET /api/v2/secret-rotations/databricks-service-principal-secret/{rotationId}"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name.mdxindex 73cb091aa4..15c5c8a074 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name.mdx@@ -1,6 +1,6 @@---title: "Get by Name"-openapi: "GET /api/v2/secret-rotations/databricks-service-account-secret/by-name"+openapi: "GET /api/v2/secret-rotations/databricks-service-principal-secret/rotation-name/{rotationName}"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id.mdxindex 8aa5785146..cebd1139ef 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id.mdx@@ -1,6 +1,6 @@---title: "Get Generated Credentials by ID"-openapi: "GET /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}/generated-credentials"+openapi: "GET /api/v2/secret-rotations/databricks-service-principal-secret/{rotationId}/generated-credentials"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/list.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/list.mdxindex b06ffd5934..57c1eca341 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/list.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/list.mdx@@ -1,6 +1,6 @@---title: "List"-openapi: "GET /api/v2/secret-rotations/databricks-service-account-secret"+openapi: "GET /api/v2/secret-rotations/databricks-service-principal-secret"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets.mdxindex 8070a77395..8780ab6f76 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets.mdx@@ -1,6 +1,6 @@---title: "Rotate Secrets"-openapi: "POST /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}/rotate"+openapi: "POST /api/v2/secret-rotations/databricks-service-principal-secret/{rotationId}/rotate-secrets"---diff --git a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/update.mdx b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/update.mdxindex c1b8e493ba..0388fa0304 100644--- a/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/update.mdx+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/update.mdx@@ -1,6 +1,6 @@---title: "Update"-openapi: "PATCH /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}"+openapi: "PATCH /api/v2/secret-rotations/databricks-service-principal-secret/{rotationId}"---diff --git a/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdx b/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdxindex fec9502b11..d0773dcdba 100644--- a/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdx+++ b/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdx@@ -1,25 +1,21 @@----title: "Databricks Service Account Secret"-description: "Learn how to automatically rotate Databricks Service Account OAuth Secrets."+title: "Databricks Service Principal Secret"+description: "Learn how to automatically rotate Databricks Service Principal OAuth Secrets."----<Note>- The service principal used in the Databricks Connection must be part of the admin group of the workspace to perform secret rotation operations.-</Note>-## Prerequisites-- Create a [Databricks Connection](/integrations/app-connections/databricks).+- Ensure you've configured the service principal for rotation. See [Configure Permissions for Secret Rotation](/integrations/app-connections/databricks#configure-permissions-for-secret-rotation).- Ensure your network security policies allow incoming requests from Infisical to this rotation provider, if network restrictions apply.-## Create a Databricks Service Account Secret Rotation in Infisical+## Create a Databricks Service Principal Secret Rotation in Infisical<Tabs><Tab title="Infisical UI">1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.- 2. Select the **Databricks Service Account Secret** option.+ 2. Select the **Databricks Service Principal Secret** option.3. Select the **Databricks Connection** to use and configure the rotation behavior. Then click **Next**.@@ -48,17 +44,17 @@ description: "Learn how to automatically rotate Databricks Service Account OAuth7. Review your configuration, then click **Create Secret Rotation**.- 8. Your **Databricks Service Account Secret** credentials are now available for use via the mapped secrets.+ 8. Your **Databricks Service Principal Secret** credentials are now available for use via the mapped secrets.</Tab><Tab title="API">- To create a Databricks Service Account Secret Rotation, make an API request to the [Create Databricks Service Account Secret Rotation](/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create) API endpoint.+ To create a Databricks Service Principal Secret Rotation, make an API request to the [Create Databricks Service Principal Secret Rotation](/api-reference/endpoints/secret-rotations/databricks-service-principal-secret/create) API endpoint.### Sample request```bash Requestcurl --request POST \- --url https://us.infisical.com/api/v2/secret-rotations/databricks-service-account-secret \+ --url https://us.infisical.com/api/v2/secret-rotations/databricks-service-principal-secret \--header 'Content-Type: application/json' \--data '{"name": "my-databricks-rotation",@@ -129,7 +125,7 @@ description: "Learn how to automatically rotate Databricks Service Account OAuth"minutes": 0},"lastRotationMessage": null,- "type": "databricks-service-account-secret",+ "type": "databricks-service-principal-secret","parameters": {"servicePrincipalId": "76997828332531","servicePrincipalName": "my-service-principal",diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsxindex 8beb170ba7..3ea2e7f3d8 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsx@@ -1,13 +1,13 @@import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";-import { TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation";+import { TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation";import { ViewRotationGeneratedCredentialsDisplay } from "./shared";type Props = {- generatedCredentialsResponse: TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;+ generatedCredentialsResponse: TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;};-export const ViewDatabricksServiceAccountSecretRotationGeneratedCredentials = ({+export const ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials = ({generatedCredentialsResponse: { generatedCredentials, activeIndex }}: Props) => {const inactiveIndex = activeIndex === 0 ? 1 : 0;diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials.tsxnew file mode 100644index 0000000000..3ea2e7f3d8--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials.tsx@@ -0,0 +1,38 @@+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";+import { TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation";++import { ViewRotationGeneratedCredentialsDisplay } from "./shared";++type Props = {+ generatedCredentialsResponse: TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;+};++export const ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials = ({+ generatedCredentialsResponse: { generatedCredentials, activeIndex }+}: Props) => {+ const inactiveIndex = activeIndex === 0 ? 1 : 0;++ const activeCredentials = generatedCredentials[activeIndex];+ const inactiveCredentials = generatedCredentials[inactiveIndex];++ return (+ <ViewRotationGeneratedCredentialsDisplay+ activeCredentials={+ <>+ <CredentialDisplay label="Client ID">{activeCredentials?.clientId}</CredentialDisplay>+ <CredentialDisplay isSensitive label="Client Secret">+ {activeCredentials?.clientSecret}+ </CredentialDisplay>+ </>+ }+ inactiveCredentials={+ <>+ <CredentialDisplay label="Client ID">{inactiveCredentials?.clientId}</CredentialDisplay>+ <CredentialDisplay isSensitive label="Client Secret">+ {inactiveCredentials?.clientSecret}+ </CredentialDisplay>+ </>+ }+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsxindex 378d1ae251..066a621a46 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx@@ -5,7 +5,7 @@ import { format } from "date-fns";import { ViewAuth0ClientSecretRotationGeneratedCredentials } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewAuth0ClientSecretRotationGeneratedCredentials";import { ViewAzureClientSecretRotationGeneratedCredentials } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewAzureClientSecretRotationGeneratedCredentials";-import { ViewDatabricksServiceAccountSecretRotationGeneratedCredentials } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials";+import { ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServicePrincipalSecretRotationGeneratedCredentials";import { ViewLdapPasswordRotationGeneratedCredentials } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewLdapPasswordRotationGeneratedCredentials";import { Modal, ModalContent, Spinner } from "@app/components/v2";import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";@@ -117,9 +117,9 @@ const Content = ({ secretRotation }: ContentProps) => {/>);break;- case SecretRotation.DatabricksServiceAccountSecret:+ case SecretRotation.DatabricksServicePrincipalSecret:Component = (- <ViewDatabricksServiceAccountSecretRotationGeneratedCredentials+ <ViewDatabricksServicePrincipalSecretRotationGeneratedCredentialsgeneratedCredentialsResponse={generatedCredentialsResponse}/>);diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsxindex b29ea32a40..5413a4b8f2 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx@@ -9,10 +9,10 @@ import { useDatabricksConnectionListServicePrincipals } from "@app/hooks/api/appimport { TDatabricksServicePrincipal } from "@app/hooks/api/appConnections/databricks/types";import { SecretRotation } from "@app/hooks/api/secretRotationsV2";-export const DatabricksServiceAccountSecretRotationParametersFields = () => {+export const DatabricksServicePrincipalSecretRotationParametersFields = () => {const { control, watch, setValue } = useFormContext<TSecretRotationV2Form & {- type: SecretRotation.DatabricksServiceAccountSecret;+ type: SecretRotation.DatabricksServicePrincipalSecret;}>();diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsxnew file mode 100644index 0000000000..5413a4b8f2--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx@@ -0,0 +1,72 @@+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 { useDatabricksConnectionListServicePrincipals } from "@app/hooks/api/appConnections/databricks";+import { TDatabricksServicePrincipal } from "@app/hooks/api/appConnections/databricks/types";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";++export const DatabricksServicePrincipalSecretRotationParametersFields = () => {+ const { control, watch, setValue } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServicePrincipalSecret;+ }+ >();++ const connectionId = watch("connection.id");++ const { data: servicePrincipals, isPending: isServicePrincipalsPending } =+ useDatabricksConnectionListServicePrincipals(connectionId, {+ enabled: Boolean(connectionId)+ });++ return (+ <Controller+ name="parameters.servicePrincipalId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ isError={Boolean(error)}+ errorText={error?.message}+ label="Service Principal"+ helperText={+ <Tooltip+ className="max-w-md"+ content={+ <>+ Ensure that your connection has the necessary permissions to list and manage+ service principals in your Databricks workspace.+ </>+ }+ >+ <div>+ <span>Don't see the service principal you're looking for?</span>{" "}+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />+ </div>+ </Tooltip>+ }+ >+ <FilterableSelect+ menuPlacement="top"+ isLoading={isServicePrincipalsPending && Boolean(connectionId)}+ isDisabled={!connectionId}+ value={servicePrincipals?.find((sp) => sp.id === value) ?? null}+ onChange={(option) => {+ const selectedSp = option as SingleValue<TDatabricksServicePrincipal>;+ onChange(selectedSp?.id ?? null);+ setValue("parameters.servicePrincipalName", selectedSp?.name ?? "");+ setValue("parameters.clientId", selectedSp?.clientId ?? "");+ }}+ options={servicePrincipals}+ placeholder="Select a service principal..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ />+ </FormControl>+ )}+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsxindex ebebec3a31..fc8228d06b 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx@@ -6,7 +6,7 @@ import { TSecretRotationV2Form } from "../schemas";import { Auth0ClientSecretRotationParametersFields } from "./Auth0ClientSecretRotationParametersFields";import { AwsIamUserSecretRotationParametersFields } from "./AwsIamUserSecretRotationParametersFields";import { AzureClientSecretRotationParametersFields } from "./AzureClientSecretRotationParametersFields";-import { DatabricksServiceAccountSecretRotationParametersFields } from "./DatabricksServiceAccountSecretRotationParametersFields";+import { DatabricksServicePrincipalSecretRotationParametersFields } from "./DatabricksServicePrincipalSecretRotationParametersFields";import { LdapPasswordRotationParametersFields } from "./LdapPasswordRotationParametersFields";import { MongoRotationParametersFields } from "./MongoRotationParametersFields";import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotationParametersFields";@@ -25,8 +25,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.OktaClientSecret]: OktaClientSecretRotationParametersFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationParametersFields,[SecretRotation.MongoDBCredentials]: MongoRotationParametersFields,- [SecretRotation.DatabricksServiceAccountSecret]:- DatabricksServiceAccountSecretRotationParametersFields+ [SecretRotation.DatabricksServicePrincipalSecret]:+ DatabricksServicePrincipalSecretRotationParametersFields};export const SecretRotationV2ParametersFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsxindex 63e60f8078..e3f5f88400 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx@@ -6,10 +6,10 @@ import { SecretRotation } from "@app/hooks/api/secretRotationsV2";import { SecretRotationReviewSection } from "./shared";-export const DatabricksServiceAccountSecretRotationReviewFields = () => {+export const DatabricksServicePrincipalSecretRotationReviewFields = () => {const { watch } = useFormContext<TSecretRotationV2Form & {- type: SecretRotation.DatabricksServiceAccountSecret;+ type: SecretRotation.DatabricksServicePrincipalSecret;}>();diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsxnew file mode 100644index 0000000000..e3f5f88400--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx@@ -0,0 +1,34 @@+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 DatabricksServicePrincipalSecretRotationReviewFields = () => {+ const { watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServicePrincipalSecret;+ }+ >();++ const [parameters, { clientId, clientSecret }] = watch(["parameters", "secretsMapping"]);++ return (+ <>+ <SecretRotationReviewSection label="Parameters">+ <GenericFieldLabel label="Service Principal">+ {parameters.servicePrincipalName || parameters.servicePrincipalId}+ </GenericFieldLabel>+ {parameters.clientId && (+ <GenericFieldLabel label="Client ID">{parameters.clientId}</GenericFieldLabel>+ )}+ </SecretRotationReviewSection>+ <SecretRotationReviewSection label="Secrets Mapping">+ <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>+ <GenericFieldLabel label="Client Secret">{clientSecret}</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.tsxindex 66233ba2f0..ec4b57153c 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx@@ -9,7 +9,7 @@ import { SecretRotation } from "@app/hooks/api/secretRotationsV2";import { Auth0ClientSecretRotationReviewFields } from "./Auth0ClientSecretRotationReviewFields";import { AwsIamUserSecretRotationReviewFields } from "./AwsIamUserSecretRotationReviewFields";import { AzureClientSecretRotationReviewFields } from "./AzureClientSecretRotationReviewFields";-import { DatabricksServiceAccountSecretRotationReviewFields } from "./DatabricksServiceAccountSecretRotationReviewFields";+import { DatabricksServicePrincipalSecretRotationReviewFields } from "./DatabricksServicePrincipalSecretRotationReviewFields";import { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFields";import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationReviewFields";import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";@@ -27,8 +27,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.OktaClientSecret]: OktaClientSecretRotationReviewFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationReviewFields,[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationReviewFields,- [SecretRotation.DatabricksServiceAccountSecret]:- DatabricksServiceAccountSecretRotationReviewFields+ [SecretRotation.DatabricksServicePrincipalSecret]:+ DatabricksServicePrincipalSecretRotationReviewFields};export const SecretRotationV2ReviewFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsxindex 5936185ced..21c4d48ba1 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx@@ -6,15 +6,15 @@ import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretimport { SecretsMappingTable } from "./shared";-export const DatabricksServiceAccountSecretRotationSecretsMappingFields = () => {+export const DatabricksServicePrincipalSecretRotationSecretsMappingFields = () => {const { control } = useFormContext<TSecretRotationV2Form & {- type: SecretRotation.DatabricksServiceAccountSecret;+ type: SecretRotation.DatabricksServicePrincipalSecret;}>();const { rotationOption } = useSecretRotationV2Option(- SecretRotation.DatabricksServiceAccountSecret+ SecretRotation.DatabricksServicePrincipalSecret);const items = [diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsxnew file mode 100644index 0000000000..21c4d48ba1--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx@@ -0,0 +1,60 @@+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 DatabricksServicePrincipalSecretRotationSecretsMappingFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServicePrincipalSecret;+ }+ >();++ const { rotationOption } = useSecretRotationV2Option(+ SecretRotation.DatabricksServicePrincipalSecret+ );++ const items = [+ {+ name: "Client ID",+ input: (+ <Controller+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl isError={Boolean(error)} errorText={error?.message}>+ <Input+ value={value}+ onChange={onChange}+ placeholder={rotationOption?.template.secretsMapping.clientId}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.clientId"+ />+ )+ },+ {+ name: "Client 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.clientSecret}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.clientSecret"+ />+ )+ }+ ];++ 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.tsxindex 7b8c389781..0df87039ac 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx@@ -6,7 +6,7 @@ import { TSecretRotationV2Form } from "../schemas";import { Auth0ClientSecretRotationSecretsMappingFields } from "./Auth0ClientSecretRotationSecretsMappingFields";import { AwsIamUserSecretRotationSecretsMappingFields } from "./AwsIamUserSecretRotationSecretsMappingFields";import { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecretRotationSecretsMappingFields";-import { DatabricksServiceAccountSecretRotationSecretsMappingFields } from "./DatabricksServiceAccountSecretRotationSecretsMappingFields";+import { DatabricksServicePrincipalSecretRotationSecretsMappingFields } from "./DatabricksServicePrincipalSecretRotationSecretsMappingFields";import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotationSecretsMappingFields";import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretRotationSecretsMappingFields";import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";@@ -24,8 +24,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.OktaClientSecret]: OktaClientSecretRotationSecretsMappingFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationSecretsMappingFields,[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationSecretsMappingFields,- [SecretRotation.DatabricksServiceAccountSecret]:- DatabricksServiceAccountSecretRotationSecretsMappingFields+ [SecretRotation.DatabricksServicePrincipalSecret]:+ DatabricksServicePrincipalSecretRotationSecretsMappingFields};export const SecretRotationV2SecretsMappingFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-account-secret-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-principal-secret-rotation-schema.tssimilarity index 83%rename from frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-account-secret-rotation-schema.tsrename to frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-principal-secret-rotation-schema.tsindex c87d662f48..d7d24c905e 100644--- a/frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-account-secret-rotation-schema.ts+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-principal-secret-rotation-schema.ts@@ -3,9 +3,9 @@ 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 DatabricksServiceAccountSecretRotationSchema = z+export const DatabricksServicePrincipalSecretRotationSchema = z.object({- type: z.literal(SecretRotation.DatabricksServiceAccountSecret),+ type: z.literal(SecretRotation.DatabricksServicePrincipalSecret),parameters: z.object({servicePrincipalId: z.string().trim().min(1, "Service Principal ID required"),servicePrincipalName: z.string().trim().optional(),diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.tsindex 0228bde6f4..c71adc084d 100644--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts@@ -3,7 +3,7 @@ import { z } from "zod";import { Auth0ClientSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/auth0-client-secret-rotation-schema";import { AwsIamUserSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/aws-iam-user-secret-rotation-schema";import { AzureClientSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/azure-client-secret-rotation-schema";-import { DatabricksServiceAccountSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/databricks-service-account-secret-rotation-schema";+import { DatabricksServicePrincipalSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/databricks-service-principal-secret-rotation-schema";import { LdapPasswordRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/ldap-password-rotation-schema";import { MongoDBCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/mongodb-credentials-rotation-schema";import { MsSqlCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/mssql-credentials-rotation-schema";@@ -31,7 +31,7 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>OktaClientSecretRotationSchema,RedisCredentialsRotationSchema,MongoDBCredentialsRotationSchema,- DatabricksServiceAccountSecretRotationSchema+ DatabricksServicePrincipalSecretRotationSchema]),z.object({ id: z.string().optional() }))diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.tsindex cbe79ef357..655ee82b88 100644--- a/frontend/src/helpers/secretRotationsV2.ts+++ b/frontend/src/helpers/secretRotationsV2.ts@@ -60,8 +60,8 @@ export const SECRET_ROTATION_MAP: Record<image: "MongoDB.png",size: 50},- [SecretRotation.DatabricksServiceAccountSecret]: {- name: "Databricks Service Account",+ [SecretRotation.DatabricksServicePrincipalSecret]: {+ name: "Databricks Service Principal",image: "Databricks.png",size: 50}@@ -79,7 +79,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.OktaClientSecret]: AppConnection.Okta,[SecretRotation.RedisCredentials]: AppConnection.Redis,[SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,- [SecretRotation.DatabricksServiceAccountSecret]: AppConnection.Databricks+ [SecretRotation.DatabricksServicePrincipalSecret]: AppConnection.Databricks};// if a rotation can potentially have downtime due to rotating a single credential set this to false@@ -95,7 +95,7 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {[SecretRotation.OktaClientSecret]: true,[SecretRotation.RedisCredentials]: true,[SecretRotation.MongoDBCredentials]: true,- [SecretRotation.DatabricksServiceAccountSecret]: true+ [SecretRotation.DatabricksServicePrincipalSecret]: true};export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.tsindex 576ba1a4f5..a7d08b31e4 100644--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts@@ -10,7 +10,7 @@ export enum SecretRotation {OktaClientSecret = "okta-client-secret",RedisCredentials = "redis-credentials",MongoDBCredentials = "mongodb-credentials",- DatabricksServiceAccountSecret = "databricks-service-account-secret"+ DatabricksServicePrincipalSecret = "databricks-service-principal-secret"}export enum SecretRotationStatus {diff --git a/frontend/src/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation.tssimilarity index 51%rename from frontend/src/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation.tsrename to frontend/src/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation.tsindex 255e57cdd1..5f505f4fc9 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation.ts@@ -5,8 +5,8 @@ import {TSecretRotationV2GeneratedCredentialsResponseBase} from "@app/hooks/api/secretRotationsV2/types/shared";-export type TDatabricksServiceAccountSecretRotation = TSecretRotationV2Base & {- type: SecretRotation.DatabricksServiceAccountSecret;+export type TDatabricksServicePrincipalSecretRotation = TSecretRotationV2Base & {+ type: SecretRotation.DatabricksServicePrincipalSecret;parameters: {servicePrincipalId: string;servicePrincipalName?: string;@@ -18,22 +18,22 @@ export type TDatabricksServiceAccountSecretRotation = TSecretRotationV2Base & {};};-export type TDatabricksServiceAccountSecretRotationGeneratedCredentials = {+export type TDatabricksServicePrincipalSecretRotationGeneratedCredentials = {clientId: string;clientSecret: string;};-export type TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse =+export type TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse =TSecretRotationV2GeneratedCredentialsResponseBase<- SecretRotation.DatabricksServiceAccountSecret,- TDatabricksServiceAccountSecretRotationGeneratedCredentials+ SecretRotation.DatabricksServicePrincipalSecret,+ TDatabricksServicePrincipalSecretRotationGeneratedCredentials>;-export type TDatabricksServiceAccountSecretRotationOption = {+export type TDatabricksServicePrincipalSecretRotationOption = {name: string;- type: SecretRotation.DatabricksServiceAccountSecret;+ type: SecretRotation.DatabricksServicePrincipalSecret;connection: AppConnection.Databricks;template: {- secretsMapping: TDatabricksServiceAccountSecretRotation["secretsMapping"];+ secretsMapping: TDatabricksServicePrincipalSecretRotation["secretsMapping"];};};diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.tsindex 285b95b379..724f3ddcbd 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts@@ -15,10 +15,10 @@ import {TAzureClientSecretRotationOption} from "@app/hooks/api/secretRotationsV2/types/azure-client-secret-rotation";import {- TDatabricksServiceAccountSecretRotation,- TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse,- TDatabricksServiceAccountSecretRotationOption-} from "@app/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation";+ TDatabricksServicePrincipalSecretRotation,+ TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse,+ TDatabricksServicePrincipalSecretRotationOption+} from "@app/hooks/api/secretRotationsV2/types/databricks-service-principal-secret-rotation";import {TLdapPasswordRotation,TLdapPasswordRotationGeneratedCredentialsResponse,@@ -72,7 +72,7 @@ export type TSecretRotationV2 = (| TOktaClientSecretRotation| TRedisCredentialsRotation| TMongoDBCredentialsRotation- | TDatabricksServiceAccountSecretRotation+ | TDatabricksServicePrincipalSecretRotation) & {secrets: (SecretV3RawSanitized | null)[];};@@ -86,7 +86,7 @@ export type TSecretRotationV2Option =| TOktaClientSecretRotationOption| TRedisCredentialsRotationOption| TMongoDBCredentialsRotationOption- | TDatabricksServiceAccountSecretRotationOption;+ | TDatabricksServicePrincipalSecretRotationOption;export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };@@ -104,7 +104,7 @@ export type TViewSecretRotationGeneratedCredentialsResponse =| TOktaClientSecretRotationGeneratedCredentialsResponse| TRedisCredentialsRotationGeneratedCredentialsResponse| TMongoDBCredentialsRotationGeneratedCredentialsResponse- | TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;+ | TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;export type TCreateSecretRotationV2DTO = DiscriminativePick<TSecretRotationV2,@@ -159,7 +159,7 @@ export type TSecretRotationOptionMap = {[SecretRotation.OktaClientSecret]: TOktaClientSecretRotationOption;[SecretRotation.RedisCredentials]: TRedisCredentialsRotationOption;[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationOption;- [SecretRotation.DatabricksServiceAccountSecret]: TDatabricksServiceAccountSecretRotationOption;+ [SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationOption;};export type TSecretRotationGeneratedCredentialsResponseMap = {@@ -174,5 +174,5 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {[SecretRotation.OktaClientSecret]: TOktaClientSecretRotationGeneratedCredentialsResponse;[SecretRotation.RedisCredentials]: TRedisCredentialsRotationGeneratedCredentialsResponse;[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationGeneratedCredentialsResponse;- [SecretRotation.DatabricksServiceAccountSecret]: TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;+ [SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;};