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
Add secrets rotation for Databricks
Carlos Monastyrski0fba3d7e0b25
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.tsnew file mode 100644index 0000000000..76fc1731ff--- /dev/null+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/databricks-service-account-secret-rotation-router.ts@@ -0,0 +1,19 @@+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/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.tsindex d58f3c2f73..614f71c198 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,6 +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 { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router";import { registerMongoDBCredentialsRotationRouter } from "./mongodb-credentials-rotation-router";import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rotation-router";@@ -28,5 +29,6 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<[SecretRotation.LdapPassword]: registerLdapPasswordRotationRouter,[SecretRotation.OktaClientSecret]: registerOktaClientSecretRotationRouter,[SecretRotation.RedisCredentials]: registerRedisCredentialsRotationRouter,- [SecretRotation.MongoDBCredentials]: registerMongoDBCredentialsRotationRouter+ [SecretRotation.MongoDBCredentials]: registerMongoDBCredentialsRotationRouter,+ [SecretRotation.DatabricksServiceAccountSecret]: registerDatabricksServiceAccountSecretRotationRouter};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 53346657bd..ffa3c2be08 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,6 +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 { 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";@@ -29,7 +30,8 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [LdapPasswordRotationListItemSchema,OktaClientSecretRotationListItemSchema,RedisCredentialsRotationListItemSchema,- MongoDBCredentialsRotationListItemSchema+ MongoDBCredentialsRotationListItemSchema,+ DatabricksServiceAccountSecretRotationListItemSchema]);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-constants.ts b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-constants.tsnew file mode 100644index 0000000000..3b36984206--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-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 DATABRICKS_SERVICE_ACCOUNT_SECRET_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {+ name: "Databricks Service Account Secret",+ type: SecretRotation.DatabricksServiceAccountSecret,+ connection: AppConnection.Databricks,+ template: {+ secretsMapping: {+ clientId: "DATABRICKS_CLIENT_ID",+ clientSecret: "DATABRICKS_CLIENT_SECRET"+ }+ }+};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-account-secret/databricks-service-account-secret-rotation-fns.tsnew file mode 100644index 0000000000..1a1e5b3feb--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-fns.ts@@ -0,0 +1,285 @@+/* eslint-disable no-await-in-loop */+import { AxiosError } from "axios";++import {+ TDatabricksServiceAccountSecretRotationGeneratedCredentials,+ TDatabricksServiceAccountSecretRotationWithConnection+} from "@app/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types";+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 { removeTrailingSlash } from "@app/lib/fn";+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";+import { getDatabricksConnectionAccessToken } from "@app/services/app-connection/databricks/databricks-connection-fns";++const DELAY_MS = 1000;+const EXPIRY_PADDING_IN_DAYS = 3;++const sleep = async () =>+ new Promise((resolve) => {+ setTimeout(resolve, DELAY_MS);+ });++export const databricksServiceAccountSecretRotationFactory: TRotationFactory<+ TDatabricksServiceAccountSecretRotationWithConnection,+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+> = (secretRotation, appConnectionDAL, kmsService) => {+ const {+ connection,+ parameters: { servicePrincipalId, clientId: clientIdParam },+ secretsMapping,+ rotationInterval+ } = secretRotation;++ const $rotateClientSecret = async () => {+ const accessToken = await getDatabricksConnectionAccessToken(connection, appConnectionDAL, kmsService);+ const workspaceUrl = removeTrailingSlash(connection.credentials.workspaceUrl);++ await blockLocalAndPrivateIpAddresses(workspaceUrl);++ 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);++ try {+ const { data } = await request.post<unknown>(+ endpoint,+ {+ expire_time: endDateTime.toISOString()+ },+ {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Content-Type": "application/json"+ }+ }+ );++ if (!data || typeof data !== "object") {+ throw new BadRequestError({+ message: `Invalid response from Databricks: expected object, got ${typeof data}`+ });+ }++ const response = data as Record<string, unknown>;+ const clientSecret = (response.secret || response.client_secret) as string | undefined;+ const secretId = response.id as string | undefined;++ if (!clientSecret || !secretId) {+ const responseStr = JSON.stringify(data, null, 2);+ throw new BadRequestError({+ message: `Invalid response from Databricks: missing 'secret' or 'id'. Response: ${responseStr}`+ });+ }++ return {+ clientSecret,+ secretId,+ clientId: clientIdParam || ""+ };+ } catch (error: unknown) {+ 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;+ }++ throw new BadRequestError({+ message: `Failed to generate secret for Databricks service principal ${servicePrincipalId}: ${errorMessage}`+ });+ }+ };++ const $listClientSecrets = async () => {+ const accessToken = await getDatabricksConnectionAccessToken(connection, appConnectionDAL, kmsService);+ const workspaceUrl = removeTrailingSlash(connection.credentials.workspaceUrl);++ await blockLocalAndPrivateIpAddresses(workspaceUrl);++ let endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets`;++ try {+ const { data } = await request.get<{ secrets: Array<{ id: string; client_secret?: string }> }>(endpoint, {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Content-Type": "application/json"+ }+ });++ 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 [];+ }+ }+ return [];+ }+ };++ const revokeCredential = async (secretId: string) => {+ const accessToken = await getDatabricksConnectionAccessToken(connection, appConnectionDAL, kmsService);+ const workspaceUrl = removeTrailingSlash(connection.credentials.workspaceUrl);++ await blockLocalAndPrivateIpAddresses(workspaceUrl);++ let endpoint = `${workspaceUrl}/api/2.0/accounts/servicePrincipals/${servicePrincipalId}/credentials/secrets/${secretId}`;++ try {+ await request.delete(endpoint, {+ headers: {+ Authorization: `Bearer ${accessToken}`,+ "Content-Type": "application/json"+ }+ });+ } 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;+ }++ let errorMessage = "Unknown error";++ if (error instanceof AxiosError && error.response?.data) {+ const responseData: unknown = error.response.data;++ 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 Error) {+ errorMessage = error.message;+ }++ throw new BadRequestError({+ message: `Failed to revoke secret with id ${secretId} for service principal ${servicePrincipalId}: ${errorMessage}`+ });+ }+ };++ const issueCredentials: TRotationFactoryIssueCredentials<+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+ > = async (callback) => {+ if (rotationInterval > Math.floor(365 * 2.5) - EXPIRY_PADDING_IN_DAYS) {+ throw new BadRequestError({+ message: "Databricks does not support OAuth secret duration over 2.5 years"+ });+ }++ const credentials = await $rotateClientSecret();+ return callback(credentials);+ };++ const revokeCredentials: TRotationFactoryRevokeCredentials<+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+ > = async (credentials, callback) => {+ if (!credentials?.length) return callback();++ for (const { secretId } of credentials) {+ await revokeCredential(secretId);+ await sleep();+ }+ return callback();+ };++ const rotateCredentials: TRotationFactoryRotateCredentials<+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+ > = async (oldCredentials, callback, activeCredentials) => {+ const existingSecrets = await $listClientSecrets();++ 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 newCredentials = await $rotateClientSecret();+ return callback(newCredentials);+ };++ const getSecretsPayload: TRotationFactoryGetSecretsPayload<+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+ > = ({ clientSecret, clientId }) => [+ { key: secretsMapping.clientId, value: clientId },+ { key: secretsMapping.clientSecret, value: clientSecret }+ ];++ return {+ issueCredentials,+ revokeCredentials,+ rotateCredentials,+ getSecretsPayload+ };+};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.tsnew file mode 100644index 0000000000..9d8cc91c43--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-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 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.tsnew file mode 100644index 0000000000..ef3e9dce90--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/databricks-service-account-secret-rotation-types.ts@@ -0,0 +1,44 @@+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.tsnew file mode 100644index 0000000000..ff30803cd0--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/databricks-service-account-secret/index.ts@@ -0,0 +1,3 @@+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/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.tsindex 470a638498..3b1e9aa4d2 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@@ -9,7 +9,8 @@ export enum SecretRotation {LdapPassword = "ldap-password",OktaClientSecret = "okta-client-secret",RedisCredentials = "redis-credentials",- MongoDBCredentials = "mongodb-credentials"+ MongoDBCredentials = "mongodb-credentials",+ DatabricksServiceAccountSecret = "databricks-service-account-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 bb774c4bec..6d2f70b664 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,6 +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 { 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";@@ -39,7 +40,8 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List[SecretRotation.LdapPassword]: LDAP_PASSWORD_ROTATION_LIST_OPTION,[SecretRotation.OktaClientSecret]: OKTA_CLIENT_SECRET_ROTATION_LIST_OPTION,[SecretRotation.RedisCredentials]: REDIS_CREDENTIALS_ROTATION_LIST_OPTION,- [SecretRotation.MongoDBCredentials]: MONGODB_CREDENTIALS_ROTATION_LIST_OPTION+ [SecretRotation.MongoDBCredentials]: MONGODB_CREDENTIALS_ROTATION_LIST_OPTION,+ [SecretRotation.DatabricksServiceAccountSecret]: DATABRICKS_SERVICE_ACCOUNT_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 c2b0714ab0..48278384a5 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@@ -12,7 +12,8 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.LdapPassword]: "LDAP Password",[SecretRotation.OktaClientSecret]: "Okta Client Secret",[SecretRotation.RedisCredentials]: "Redis Credentials",- [SecretRotation.MongoDBCredentials]: "MongoDB Credentials"+ [SecretRotation.MongoDBCredentials]: "MongoDB Credentials",+ [SecretRotation.DatabricksServiceAccountSecret]: "Databricks Service Account Secret"};export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {@@ -26,5 +27,6 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.LdapPassword]: AppConnection.LDAP,[SecretRotation.OktaClientSecret]: AppConnection.Okta,[SecretRotation.RedisCredentials]: AppConnection.Redis,- [SecretRotation.MongoDBCredentials]: AppConnection.MongoDB+ [SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,+ [SecretRotation.DatabricksServiceAccountSecret]: 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 a8f3a24f90..58b14ce2ba 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,6 +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 { 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 {@@ -136,7 +137,9 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem[SecretRotation.LdapPassword]: ldapPasswordRotationFactory as TRotationFactoryImplementation,[SecretRotation.OktaClientSecret]: oktaClientSecretRotationFactory as TRotationFactoryImplementation,[SecretRotation.RedisCredentials]: redisCredentialsRotationFactory as TRotationFactoryImplementation,- [SecretRotation.MongoDBCredentials]: mongodbCredentialsRotationFactory as TRotationFactoryImplementation+ [SecretRotation.MongoDBCredentials]: mongodbCredentialsRotationFactory as TRotationFactoryImplementation,+ [SecretRotation.DatabricksServiceAccountSecret]:+ databricksServiceAccountSecretRotationFactory 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 27cf1a7f55..ce1e8b1193 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@@ -28,6 +28,13 @@ import {TAzureClientSecretRotationListItem,TAzureClientSecretRotationWithConnection} from "./azure-client-secret";+import {+ TDatabricksServiceAccountSecretRotation,+ TDatabricksServiceAccountSecretRotationGeneratedCredentials,+ TDatabricksServiceAccountSecretRotationInput,+ TDatabricksServiceAccountSecretRotationListItem,+ TDatabricksServiceAccountSecretRotationWithConnection+} from "./databricks-service-account-secret";import {TLdapPasswordRotation,TLdapPasswordRotationGeneratedCredentials,@@ -93,7 +100,8 @@ export type TSecretRotationV2 =| TAwsIamUserSecretRotation| TOktaClientSecretRotation| TRedisCredentialsRotation- | TMongoDBCredentialsRotation;+ | TMongoDBCredentialsRotation+ | TDatabricksServiceAccountSecretRotation;export type TSecretRotationV2WithConnection =| TPostgresCredentialsRotationWithConnection@@ -106,7 +114,8 @@ export type TSecretRotationV2WithConnection =| TAwsIamUserSecretRotationWithConnection| TOktaClientSecretRotationWithConnection| TRedisCredentialsRotationWithConnection- | TMongoDBCredentialsRotationWithConnection;+ | TMongoDBCredentialsRotationWithConnection+ | TDatabricksServiceAccountSecretRotationWithConnection;export type TSecretRotationV2GeneratedCredentials =| TSqlCredentialsRotationGeneratedCredentials@@ -115,7 +124,8 @@ export type TSecretRotationV2GeneratedCredentials =| TLdapPasswordRotationGeneratedCredentials| TAwsIamUserSecretRotationGeneratedCredentials| TOktaClientSecretRotationGeneratedCredentials- | TRedisCredentialsRotationGeneratedCredentials;+ | TRedisCredentialsRotationGeneratedCredentials+ | TDatabricksServiceAccountSecretRotationGeneratedCredentials;export type TSecretRotationV2Input =| TPostgresCredentialsRotationInput@@ -128,7 +138,8 @@ export type TSecretRotationV2Input =| TAwsIamUserSecretRotationInput| TOktaClientSecretRotationInput| TRedisCredentialsRotationInput- | TMongoDBCredentialsRotationInput;+ | TMongoDBCredentialsRotationInput+ | TDatabricksServiceAccountSecretRotationInput;export type TSecretRotationV2ListItem =| TPostgresCredentialsRotationListItem@@ -141,7 +152,8 @@ export type TSecretRotationV2ListItem =| TAwsIamUserSecretRotationListItem| TOktaClientSecretRotationListItem| TRedisCredentialsRotationListItem- | TMongoDBCredentialsRotationListItem;+ | TMongoDBCredentialsRotationListItem+ | TDatabricksServiceAccountSecretRotationListItem;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 34e701a94d..64fc1f5d36 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,6 +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 { 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";@@ -23,5 +24,6 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [AwsIamUserSecretRotationSchema,OktaClientSecretRotationSchema,RedisCredentialsRotationSchema,- MongoDBCredentialsRotationSchema+ MongoDBCredentialsRotationSchema,+ DatabricksServiceAccountSecretRotationSchema]);diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 16d2e68f2e..fbfb2c466a 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2921,6 +2921,11 @@ export const SecretRotations = {"The username of the first MongoDB user to rotate passwords for. This user must already exist in your database.",username2:"The username of the second MongoDB user to rotate passwords for. This user must already exist in your database."+ },+ 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.",+ clientId: "The client ID of the Databricks Service Principal to rotate the OAuth secret for."}},SECRETS_MAPPING: {@@ -2955,6 +2960,10 @@ export const SecretRotations = {MONGODB_CREDENTIALS: {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_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/server/routes/v1/app-connection-routers/databricks-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/databricks-connection-router.tsindex 7fdb7f3a25..f84c0c8e2a 100644--- a/backend/src/server/routes/v1/app-connection-routers/databricks-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/databricks-connection-router.ts@@ -51,4 +51,39 @@ export const registerDatabricksConnectionRouter = async (server: FastifyZodProvireturn { secretScopes };}});++ server.route({+ method: "GET",+ url: `/:connectionId/service-principals`,+ config: {+ rateLimit: readLimit+ },+ schema: {+ params: z.object({+ connectionId: z.string().uuid()+ }),+ response: {+ 200: z.object({+ servicePrincipals: z+ .object({+ id: z.string(),+ name: z.string(),+ clientId: z.string()+ })+ .array()+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const { connectionId } = req.params;++ const servicePrincipals = await server.services.appConnection.databricks.listServicePrincipals(+ connectionId,+ req.permission+ );++ return { servicePrincipals };+ }+ });};diff --git a/backend/src/services/app-connection/databricks/databricks-connection-service.ts b/backend/src/services/app-connection/databricks/databricks-connection-service.tsindex 37b88705a9..70843cd286 100644--- a/backend/src/services/app-connection/databricks/databricks-connection-service.ts+++ b/backend/src/services/app-connection/databricks/databricks-connection-service.ts@@ -6,7 +6,8 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enumsimport { getDatabricksConnectionAccessToken } from "@app/services/app-connection/databricks/databricks-connection-fns";import {TDatabricksConnection,- TDatabricksListSecretScopesResponse+ TDatabricksListSecretScopesResponse,+ TDatabricksListServicePrincipalsResponse} from "@app/services/app-connection/databricks/databricks-connection-types";import { TKmsServiceFactory } from "@app/services/kms/kms-service";@@ -41,6 +42,34 @@ const listDatabricksSecretScopes = async (return data.scopes ?? [];};+const listDatabricksServicePrincipals = async (+ appConnection: TDatabricksConnection,+ appConnectionDAL: Pick<TAppConnectionDALFactory, "updateById">,+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">+) => {+ const {+ credentials: { workspaceUrl }+ } = appConnection;++ 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"+ }+ }+ );++ return (data.Resources ?? []).map((sp) => ({+ id: sp.id,+ name: sp.displayName,+ clientId: sp.applicationId || ""+ }));+};+export const databricksConnectionService = (getAppConnection: TGetAppConnectionFunc,appConnectionDAL: Pick<TAppConnectionDALFactory, "updateById">,@@ -54,7 +83,16 @@ export const databricksConnectionService = (return secretScopes;};+ const listServicePrincipals = async (connectionId: string, actor: OrgServiceActor) => {+ const appConnection = await getAppConnection(AppConnection.Databricks, connectionId, actor);++ const servicePrincipals = await listDatabricksServicePrincipals(appConnection, appConnectionDAL, kmsService);++ return servicePrincipals;+ };+return {- listSecretScopes+ listSecretScopes,+ listServicePrincipals};};diff --git a/backend/src/services/app-connection/databricks/databricks-connection-types.ts b/backend/src/services/app-connection/databricks/databricks-connection-types.tsindex 611d40fa0e..28f783711b 100644--- a/backend/src/services/app-connection/databricks/databricks-connection-types.ts+++ b/backend/src/services/app-connection/databricks/databricks-connection-types.ts@@ -34,3 +34,17 @@ export type TAuthorizeDatabricksConnection = {export type TDatabricksListSecretScopesResponse = {scopes?: { name: string; backend_type: string; keyvault_metadata: { resource_id: string; dns_name: string } }[];};++export type TDatabricksServicePrincipal = {+ id: string;+ displayName: string;+ applicationId?: string;+ active?: boolean;+};++export type TDatabricksListServicePrincipalsResponse = {+ Resources?: TDatabricksServicePrincipal[];+ totalResults?: number;+ itemsPerPage?: number;+ startIndex?: number;+};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.mdxnew file mode 100644index 0000000000..5e2be2686b--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/create.mdx@@ -0,0 +1,10 @@+---+title: "Create"+openapi: "POST /api/v2/secret-rotations/databricks-service-account-secret"+---++<Note>+ Check out the configuration docs for [Databricks Service Account Secret Rotations](/documentation/platform/secret-rotation/databricks-service-account-secret) to learn how to obtain the required parameters.+</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.mdxnew file mode 100644index 0000000000..1a80f52892--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete.mdx@@ -0,0 +1,6 @@+---+title: "Delete"+openapi: "DELETE /api/v2/secret-rotations/databricks-service-account-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.mdxnew file mode 100644index 0000000000..4184396945--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id.mdx@@ -0,0 +1,6 @@+---+title: "Get by ID"+openapi: "GET /api/v2/secret-rotations/databricks-service-account-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.mdxnew file mode 100644index 0000000000..73cb091aa4--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name.mdx@@ -0,0 +1,6 @@+---+title: "Get by Name"+openapi: "GET /api/v2/secret-rotations/databricks-service-account-secret/by-name"+---++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.mdxnew file mode 100644index 0000000000..8aa5785146--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id.mdx@@ -0,0 +1,6 @@+---+title: "Get Generated Credentials by ID"+openapi: "GET /api/v2/secret-rotations/databricks-service-account-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.mdxnew file mode 100644index 0000000000..b06ffd5934--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/list.mdx@@ -0,0 +1,6 @@+---+title: "List"+openapi: "GET /api/v2/secret-rotations/databricks-service-account-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.mdxnew file mode 100644index 0000000000..8070a77395--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets.mdx@@ -0,0 +1,6 @@+---+title: "Rotate Secrets"+openapi: "POST /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}/rotate"+---++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.mdxnew file mode 100644index 0000000000..c1b8e493ba--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/databricks-service-account-secret/update.mdx@@ -0,0 +1,6 @@+---+title: "Update"+openapi: "PATCH /api/v2/secret-rotations/databricks-service-account-secret/{rotationId}"+---++diff --git a/docs/docs.json b/docs/docs.jsonindex 43fa7430fc..f8621bb027 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -448,6 +448,7 @@"documentation/platform/secret-rotation/auth0-client-secret","documentation/platform/secret-rotation/aws-iam-user-secret","documentation/platform/secret-rotation/azure-client-secret",+ "documentation/platform/secret-rotation/databricks-service-account-secret","documentation/platform/secret-rotation/ldap-password","documentation/platform/secret-rotation/mongodb-credentials","documentation/platform/secret-rotation/mssql-credentials",@@ -1995,6 +1996,19 @@"api-reference/endpoints/secret-rotations/azure-client-secret/update"]},+ {+ "group": "Databricks Service Account Secret",+ "pages": [+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/create",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/delete",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-id",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-by-name",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/get-generated-credentials-by-id",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/list",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/rotate-secrets",+ "api-reference/endpoints/secret-rotations/databricks-service-account-secret/update"+ ]+ },{"group": "LDAP Password","pages": [diff --git a/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdx b/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdxnew file mode 100644index 0000000000..fec9502b11--- /dev/null+++ b/docs/documentation/platform/secret-rotation/databricks-service-account-secret.mdx@@ -0,0 +1,144 @@+---+title: "Databricks Service Account Secret"+description: "Learn how to automatically rotate Databricks Service Account 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 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++<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.+ ++ 3. Select the **Databricks Connection** to use and configure the rotation behavior. Then click **Next**.+ ++ - **Databricks Connection** - the connection that will perform the rotation of the specified service principal's OAuth secret.+ - **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.+ - **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.+ - **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.++ 4. Select the Databricks service principal whose OAuth secret you want to rotate. Then click **Next**.+ ++ 5. Specify the secret names that the client credentials should be mapped to. Then click **Next**.+ ++ - **Client ID** - the name of the secret that the service principal Client ID will be mapped to.+ - **Client Secret** - the name of the secret that the rotated OAuth Client Secret will be mapped to.++ 6. Give your rotation a name and description (optional). Then click **Next**.+ ++ - **Name** - the name of the secret rotation configuration. Must be slug-friendly.+ - **Description** (optional) - a description of this rotation configuration.++ 7. Review your configuration, then click **Create Secret Rotation**.+ ++ 8. Your **Databricks Service Account 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.++ ### Sample request++ ```bash Request+ curl --request POST \+ --url https://us.infisical.com/api/v2/secret-rotations/databricks-service-account-secret \+ --header 'Content-Type: application/json' \+ --data '{+ "name": "my-databricks-rotation",+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "description": "my service account secret rotation",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "environment": "dev",+ "secretPath": "/",+ "isAutoRotationEnabled": true,+ "rotationInterval": 30,+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "parameters": {+ "servicePrincipalId": "76997828332531",+ "servicePrincipalName": "my-service-principal",+ "clientId": "..."+ },+ "secretsMapping": {+ "clientId": "DATABRICKS_CLIENT_ID",+ "clientSecret": "DATABRICKS_CLIENT_SECRET"+ }+ }'+ ```++ ### Sample response++ ```bash Response+ {+ "secretRotation": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "name": "my-databricks-rotation",+ "description": "my service account secret rotation",+ "secretsMapping": {+ "clientId": "DATABRICKS_CLIENT_ID",+ "clientSecret": "DATABRICKS_CLIENT_SECRET"+ },+ "isAutoRotationEnabled": true,+ "activeIndex": 0,+ "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "createdAt": "2023-11-07T05:31:56Z",+ "updatedAt": "2023-11-07T05:31:56Z",+ "rotationInterval": 30,+ "rotationStatus": "success",+ "lastRotationAttemptedAt": "2023-11-07T05:31:56Z",+ "lastRotatedAt": "2023-11-07T05:31:56Z",+ "lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "nextRotationAt": "2023-11-07T05:31:56Z",+ "connection": {+ "app": "databricks",+ "name": "my-databricks-connection",+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"+ },+ "environment": {+ "slug": "dev",+ "name": "Development",+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"+ },+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "folder": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "path": "/"+ },+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "lastRotationMessage": null,+ "type": "databricks-service-account-secret",+ "parameters": {+ "servicePrincipalId": "76997828332531",+ "servicePrincipalName": "my-service-principal",+ "clientId": "..."+ }+ }+ }+ ```+ </Tab>+</Tabs>++diff --git a/docs/images/app-connections/databricks/add-to-admin-group-form.png b/docs/images/app-connections/databricks/add-to-admin-group-form.pngnew file mode 100644index 0000000000..58d4acf20aBinary files /dev/null and b/docs/images/app-connections/databricks/add-to-admin-group-form.png differdiff --git a/docs/images/app-connections/databricks/add-to-admin-group.png b/docs/images/app-connections/databricks/add-to-admin-group.pngnew file mode 100644index 0000000000..239c4a9eb5Binary files /dev/null and b/docs/images/app-connections/databricks/add-to-admin-group.png differdiff --git a/docs/images/app-connections/databricks/admin-group.png b/docs/images/app-connections/databricks/admin-group.pngnew file mode 100644index 0000000000..5e4f2dab79Binary files /dev/null and b/docs/images/app-connections/databricks/admin-group.png differdiff --git a/docs/images/app-connections/databricks/assign-manage-permission.png b/docs/images/app-connections/databricks/assign-manage-permission.pngnew file mode 100644index 0000000000..ca2344da65Binary files /dev/null and b/docs/images/app-connections/databricks/assign-manage-permission.png differdiff --git a/docs/images/app-connections/databricks/permissions-tab.png b/docs/images/app-connections/databricks/permissions-tab.pngnew file mode 100644index 0000000000..b770748eb6Binary files /dev/null and b/docs/images/app-connections/databricks/permissions-tab.png differdiff --git a/docs/images/app-connections/databricks/select-target-service-principal.png b/docs/images/app-connections/databricks/select-target-service-principal.pngnew file mode 100644index 0000000000..93569649d7Binary files /dev/null and b/docs/images/app-connections/databricks/select-target-service-principal.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-configuration.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-configuration.pngnew file mode 100644index 0000000000..5b94325d5cBinary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-configuration.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-created.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-created.pngnew file mode 100644index 0000000000..4ce491b680Binary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-created.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-details.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-details.pngnew file mode 100644index 0000000000..7374841eb4Binary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-details.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-mapping.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-mapping.pngnew file mode 100644index 0000000000..776ddd18b2Binary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-mapping.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-option.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-option.pngnew file mode 100644index 0000000000..33f0983a03Binary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-option.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-parameters.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-parameters.pngnew file mode 100644index 0000000000..8c4c1dd94aBinary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-parameters.png differdiff --git a/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-review.png b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-review.pngnew file mode 100644index 0000000000..724b6812dbBinary files /dev/null and b/docs/images/secret-rotations-v2/databricks-service-account-secret/databricks-service-account-secret-review.png differdiff --git a/docs/integrations/app-connections/databricks.mdx b/docs/integrations/app-connections/databricks.mdxindex e0b861184f..16ec534baf 100644--- a/docs/integrations/app-connections/databricks.mdx+++ b/docs/integrations/app-connections/databricks.mdx@@ -39,6 +39,36 @@ Infisical supports the use of [service principals](https://docs.databricks.com/e</Step></Steps>+<Accordion title="Configure Permissions for Secret Rotation">+ <Steps>+ <Step title="Add Service Principal to Admin Group">+ Navigate to **Settings** > **Identity & Access** > **Groups** and select the admin group (typically named "admins" or "workspace-admins").++ ++ Click **Add** and select the service principal you created for Infisical to add it to the admin group.++ + + </Step>+ <Step title="Grant Manage Permission for Target Service Principals">+ For each service principal whose secrets you want to rotate, navigate to **Settings** > **Identity & Access** > **Service Principals** and select the target service principal.++ + </Step>+ <Step title="Open Permissions Tab">+ Click on the **Permissions** tab for the selected service principal. And then click the **Grant access** button to open the permission modal++ + </Step>+ <Step title="Grant Manage Permission to Infisical Service Principal">+ In the **User, Group or Service Principal** field, select the service principal you created for Infisical. In the **Permission** field, select **Manage** to allow the Infisical service principal to manage credentials and secrets for this service principal. Click **Save** to apply the permissions. Repeat these steps for each service principal whose secrets you want to rotate.++ + </Step>+ </Steps>+</Accordion>+## Setup Databricks Connection in Infisical<Steps>diff --git a/docs/snippets/RotationsBrowser.jsx b/docs/snippets/RotationsBrowser.jsxindex 0666237b31..c919c95814 100644--- a/docs/snippets/RotationsBrowser.jsx+++ b/docs/snippets/RotationsBrowser.jsx@@ -9,6 +9,7 @@ export const RotationsBrowser = () => {const rotations = [{"name": "AWS IAM User", "slug": "aws-iam-user", "path": "/documentation/platform/secret-rotation/aws-iam-user-secret", "description": "Learn how to automatically rotate AWS IAM user access keys.", "category": "Cloud Providers"},{"name": "Azure Client Secret", "slug": "azure-client-secret", "path": "/documentation/platform/secret-rotation/azure-client-secret", "description": "Learn how to automatically rotate Azure client secrets.", "category": "Cloud Providers"},+ {"name": "Databricks Service Account Secret", "slug": "databricks-service-account-secret", "path": "/documentation/platform/secret-rotation/databricks-service-account-secret", "description": "Learn how to automatically rotate Databricks service principal OAuth secrets.", "category": "Cloud Providers"},{"name": "Auth0 Client Secret", "slug": "auth0-client-secret", "path": "/documentation/platform/secret-rotation/auth0-client-secret", "description": "Learn how to automatically rotate Auth0 client secrets.", "category": "Identity & Auth"},{"name": "Okta Client Secret", "slug": "okta-client-secret", "path": "/documentation/platform/secret-rotation/okta-client-secret", "description": "Learn how to automatically rotate Okta client secrets.", "category": "Identity & Auth"},{"name": "LDAP Password", "slug": "ldap-password", "path": "/documentation/platform/secret-rotation/ldap-password", "description": "Learn how to automatically rotate LDAP user passwords.", "category": "Identity & Auth"},diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsxnew file mode 100644index 0000000000..8beb170ba7--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatabricksServiceAccountSecretRotationGeneratedCredentials.tsx@@ -0,0 +1,38 @@+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 { ViewRotationGeneratedCredentialsDisplay } from "./shared";++type Props = {+ generatedCredentialsResponse: TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;+};++export const ViewDatabricksServiceAccountSecretRotationGeneratedCredentials = ({+ 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 01904b8523..378d1ae251 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx@@ -5,6 +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 { 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";@@ -116,6 +117,13 @@ const Content = ({ secretRotation }: ContentProps) => {/>);break;+ case SecretRotation.DatabricksServiceAccountSecret:+ Component = (+ <ViewDatabricksServiceAccountSecretRotationGeneratedCredentials+ generatedCredentialsResponse={generatedCredentialsResponse}+ />+ );+ break;default:throw new Error("Unhandled View Generated Credential Rotation Type");}diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsxnew file mode 100644index 0000000000..b29ea32a40--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.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 DatabricksServiceAccountSecretRotationParametersFields = () => {+ const { control, watch, setValue } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServiceAccountSecret;+ }+ >();++ 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 6e4947fa29..ebebec3a31 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx@@ -6,6 +6,7 @@ import { TSecretRotationV2Form } from "../schemas";import { Auth0ClientSecretRotationParametersFields } from "./Auth0ClientSecretRotationParametersFields";import { AwsIamUserSecretRotationParametersFields } from "./AwsIamUserSecretRotationParametersFields";import { AzureClientSecretRotationParametersFields } from "./AzureClientSecretRotationParametersFields";+import { DatabricksServiceAccountSecretRotationParametersFields } from "./DatabricksServiceAccountSecretRotationParametersFields";import { LdapPasswordRotationParametersFields } from "./LdapPasswordRotationParametersFields";import { MongoRotationParametersFields } from "./MongoRotationParametersFields";import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotationParametersFields";@@ -23,7 +24,9 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.AwsIamUserSecret]: AwsIamUserSecretRotationParametersFields,[SecretRotation.OktaClientSecret]: OktaClientSecretRotationParametersFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationParametersFields,- [SecretRotation.MongoDBCredentials]: MongoRotationParametersFields+ [SecretRotation.MongoDBCredentials]: MongoRotationParametersFields,+ [SecretRotation.DatabricksServiceAccountSecret]:+ DatabricksServiceAccountSecretRotationParametersFields};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.tsxnew file mode 100644index 0000000000..63e60f8078--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.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 DatabricksServiceAccountSecretRotationReviewFields = () => {+ const { watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServiceAccountSecret;+ }+ >();++ 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 d48c69ccac..66233ba2f0 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx@@ -9,6 +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 { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFields";import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationReviewFields";import { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";@@ -25,7 +26,9 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.AwsIamUserSecret]: AwsIamUserSecretRotationReviewFields,[SecretRotation.OktaClientSecret]: OktaClientSecretRotationReviewFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationReviewFields,- [SecretRotation.MongoDBCredentials]: SqlCredentialsRotationReviewFields+ [SecretRotation.MongoDBCredentials]: SqlCredentialsRotationReviewFields,+ [SecretRotation.DatabricksServiceAccountSecret]:+ DatabricksServiceAccountSecretRotationReviewFields};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.tsxnew file mode 100644index 0000000000..5936185ced--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.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 DatabricksServiceAccountSecretRotationSecretsMappingFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatabricksServiceAccountSecret;+ }+ >();++ const { rotationOption } = useSecretRotationV2Option(+ SecretRotation.DatabricksServiceAccountSecret+ );++ 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 a211abff85..7b8c389781 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx@@ -6,6 +6,7 @@ import { TSecretRotationV2Form } from "../schemas";import { Auth0ClientSecretRotationSecretsMappingFields } from "./Auth0ClientSecretRotationSecretsMappingFields";import { AwsIamUserSecretRotationSecretsMappingFields } from "./AwsIamUserSecretRotationSecretsMappingFields";import { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecretRotationSecretsMappingFields";+import { DatabricksServiceAccountSecretRotationSecretsMappingFields } from "./DatabricksServiceAccountSecretRotationSecretsMappingFields";import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotationSecretsMappingFields";import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretRotationSecretsMappingFields";import { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";@@ -22,7 +23,9 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.AwsIamUserSecret]: AwsIamUserSecretRotationSecretsMappingFields,[SecretRotation.OktaClientSecret]: OktaClientSecretRotationSecretsMappingFields,[SecretRotation.RedisCredentials]: RedisCredentialsRotationSecretsMappingFields,- [SecretRotation.MongoDBCredentials]: SqlCredentialsRotationSecretsMappingFields+ [SecretRotation.MongoDBCredentials]: SqlCredentialsRotationSecretsMappingFields,+ [SecretRotation.DatabricksServiceAccountSecret]:+ DatabricksServiceAccountSecretRotationSecretsMappingFields};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-account-secret-rotation-schema.tsnew file mode 100644index 0000000000..c87d662f48--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/databricks-service-account-secret-rotation-schema.ts@@ -0,0 +1,19 @@+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+ .object({+ type: z.literal(SecretRotation.DatabricksServiceAccountSecret),+ parameters: z.object({+ servicePrincipalId: z.string().trim().min(1, "Service Principal ID required"),+ servicePrincipalName: z.string().trim().optional(),+ clientId: z.string().trim().min(1, "Client ID required")+ }),+ secretsMapping: z.object({+ clientId: z.string().trim().min(1, "Client ID required"),+ clientSecret: z.string().trim().min(1, "Client Secret required")+ })+ })+ .merge(BaseSecretRotationSchema);diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.tsindex 3ea0f75ed4..0228bde6f4 100644--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts@@ -3,6 +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 { 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";@@ -29,7 +30,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>AwsIamUserSecretRotationSchema,OktaClientSecretRotationSchema,RedisCredentialsRotationSchema,- MongoDBCredentialsRotationSchema+ MongoDBCredentialsRotationSchema,+ DatabricksServiceAccountSecretRotationSchema]),z.object({ id: z.string().optional() }))diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.tsindex 187177c68e..cbe79ef357 100644--- a/frontend/src/helpers/secretRotationsV2.ts+++ b/frontend/src/helpers/secretRotationsV2.ts@@ -59,6 +59,11 @@ export const SECRET_ROTATION_MAP: Record<name: "MongoDB Credentials",image: "MongoDB.png",size: 50+ },+ [SecretRotation.DatabricksServiceAccountSecret]: {+ name: "Databricks Service Account",+ image: "Databricks.png",+ size: 50}};@@ -73,7 +78,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.AwsIamUserSecret]: AppConnection.AWS,[SecretRotation.OktaClientSecret]: AppConnection.Okta,[SecretRotation.RedisCredentials]: AppConnection.Redis,- [SecretRotation.MongoDBCredentials]: AppConnection.MongoDB+ [SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,+ [SecretRotation.DatabricksServiceAccountSecret]: AppConnection.Databricks};// if a rotation can potentially have downtime due to rotating a single credential set this to false@@ -88,7 +94,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {[SecretRotation.AwsIamUserSecret]: true,[SecretRotation.OktaClientSecret]: true,[SecretRotation.RedisCredentials]: true,- [SecretRotation.MongoDBCredentials]: true+ [SecretRotation.MongoDBCredentials]: true,+ [SecretRotation.DatabricksServiceAccountSecret]: true};export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {diff --git a/frontend/src/hooks/api/appConnections/databricks/queries.tsx b/frontend/src/hooks/api/appConnections/databricks/queries.tsxindex 14f84cf9cb..9144ed90e1 100644--- a/frontend/src/hooks/api/appConnections/databricks/queries.tsx+++ b/frontend/src/hooks/api/appConnections/databricks/queries.tsx@@ -3,12 +3,19 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";import { appConnectionKeys } from "@app/hooks/api/appConnections";-import { TDatabricksConnectionListSecretScopesResponse, TDatabricksSecretScope } from "./types";+import {+ TDatabricksConnectionListSecretScopesResponse,+ TDatabricksConnectionListServicePrincipalsResponse,+ TDatabricksSecretScope,+ TDatabricksServicePrincipal+} from "./types";const databricksConnectionKeys = {all: [...appConnectionKeys.all, "databricks"] as const,listSecretScopes: (connectionId: string) =>- [...databricksConnectionKeys.all, "workspace-scopes", connectionId] as const+ [...databricksConnectionKeys.all, "workspace-scopes", connectionId] as const,+ listServicePrincipals: (connectionId: string) =>+ [...databricksConnectionKeys.all, "service-principals", connectionId] as const};export const useDatabricksConnectionListSecretScopes = (@@ -35,3 +42,28 @@ export const useDatabricksConnectionListSecretScopes = (...options});};++export const useDatabricksConnectionListServicePrincipals = (+ connectionId: string,+ options?: Omit<+ UseQueryOptions<+ TDatabricksServicePrincipal[],+ unknown,+ TDatabricksServicePrincipal[],+ ReturnType<typeof databricksConnectionKeys.listServicePrincipals>+ >,+ "queryKey" | "queryFn"+ >+) => {+ return useQuery({+ queryKey: databricksConnectionKeys.listServicePrincipals(connectionId),+ queryFn: async () => {+ const { data } = await apiRequest.get<TDatabricksConnectionListServicePrincipalsResponse>(+ `/api/v1/app-connections/databricks/${connectionId}/service-principals`+ );++ return data.servicePrincipals;+ },+ ...options+ });+};diff --git a/frontend/src/hooks/api/appConnections/databricks/types.ts b/frontend/src/hooks/api/appConnections/databricks/types.tsindex 1a2c0cae1b..58ed41abdf 100644--- a/frontend/src/hooks/api/appConnections/databricks/types.ts+++ b/frontend/src/hooks/api/appConnections/databricks/types.ts@@ -5,3 +5,13 @@ export type TDatabricksSecretScope = {export type TDatabricksConnectionListSecretScopesResponse = {secretScopes: TDatabricksSecretScope[];};++export type TDatabricksServicePrincipal = {+ id: string;+ name: string;+ clientId: string;+};++export type TDatabricksConnectionListServicePrincipalsResponse = {+ servicePrincipals: TDatabricksServicePrincipal[];+};diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.tsindex d52de16fc9..576ba1a4f5 100644--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts@@ -9,7 +9,8 @@ export enum SecretRotation {AwsIamUserSecret = "aws-iam-user-secret",OktaClientSecret = "okta-client-secret",RedisCredentials = "redis-credentials",- MongoDBCredentials = "mongodb-credentials"+ MongoDBCredentials = "mongodb-credentials",+ DatabricksServiceAccountSecret = "databricks-service-account-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-account-secret-rotation.tsnew file mode 100644index 0000000000..255e57cdd1--- /dev/null+++ b/frontend/src/hooks/api/secretRotationsV2/types/databricks-service-account-secret-rotation.ts@@ -0,0 +1,39 @@+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 TDatabricksServiceAccountSecretRotation = TSecretRotationV2Base & {+ type: SecretRotation.DatabricksServiceAccountSecret;+ parameters: {+ servicePrincipalId: string;+ servicePrincipalName?: string;+ clientId?: string;+ };+ secretsMapping: {+ clientId: string;+ clientSecret: string;+ };+};++export type TDatabricksServiceAccountSecretRotationGeneratedCredentials = {+ clientId: string;+ clientSecret: string;+};++export type TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse =+ TSecretRotationV2GeneratedCredentialsResponseBase<+ SecretRotation.DatabricksServiceAccountSecret,+ TDatabricksServiceAccountSecretRotationGeneratedCredentials+ >;++export type TDatabricksServiceAccountSecretRotationOption = {+ name: string;+ type: SecretRotation.DatabricksServiceAccountSecret;+ connection: AppConnection.Databricks;+ template: {+ secretsMapping: TDatabricksServiceAccountSecretRotation["secretsMapping"];+ };+};diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.tsindex cc938ae053..285b95b379 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts@@ -14,6 +14,11 @@ import {TAzureClientSecretRotationGeneratedCredentialsResponse,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";import {TLdapPasswordRotation,TLdapPasswordRotationGeneratedCredentialsResponse,@@ -67,6 +72,7 @@ export type TSecretRotationV2 = (| TOktaClientSecretRotation| TRedisCredentialsRotation| TMongoDBCredentialsRotation+ | TDatabricksServiceAccountSecretRotation) & {secrets: (SecretV3RawSanitized | null)[];};@@ -79,7 +85,8 @@ export type TSecretRotationV2Option =| TAwsIamUserSecretRotationOption| TOktaClientSecretRotationOption| TRedisCredentialsRotationOption- | TMongoDBCredentialsRotationOption;+ | TMongoDBCredentialsRotationOption+ | TDatabricksServiceAccountSecretRotationOption;export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };@@ -96,7 +103,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =| TAwsIamUserSecretRotationGeneratedCredentialsResponse| TOktaClientSecretRotationGeneratedCredentialsResponse| TRedisCredentialsRotationGeneratedCredentialsResponse- | TMongoDBCredentialsRotationGeneratedCredentialsResponse;+ | TMongoDBCredentialsRotationGeneratedCredentialsResponse+ | TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;export type TCreateSecretRotationV2DTO = DiscriminativePick<TSecretRotationV2,@@ -151,6 +159,7 @@ export type TSecretRotationOptionMap = {[SecretRotation.OktaClientSecret]: TOktaClientSecretRotationOption;[SecretRotation.RedisCredentials]: TRedisCredentialsRotationOption;[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationOption;+ [SecretRotation.DatabricksServiceAccountSecret]: TDatabricksServiceAccountSecretRotationOption;};export type TSecretRotationGeneratedCredentialsResponseMap = {@@ -165,4 +174,5 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {[SecretRotation.OktaClientSecret]: TOktaClientSecretRotationGeneratedCredentialsResponse;[SecretRotation.RedisCredentials]: TRedisCredentialsRotationGeneratedCredentialsResponse;[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationGeneratedCredentialsResponse;+ [SecretRotation.DatabricksServiceAccountSecret]: TDatabricksServiceAccountSecretRotationGeneratedCredentialsResponse;};