diff --git a/backend/src/ee/routes/v1/app-connection-routers/oracledb-connection-router.ts b/backend/src/ee/routes/v1/app-connection-routers/oracledb-connection-router.ts new file mode 100644 index 000000000..8a90fe9a7 --- /dev/null +++ b/backend/src/ee/routes/v1/app-connection-routers/oracledb-connection-router.ts @@ -0,0 +1,17 @@ +import { + CreateOracleDBConnectionSchema, + SanitizedOracleDBConnectionSchema, + UpdateOracleDBConnectionSchema +} from "@app/ee/services/app-connections/oracledb"; +import { registerAppConnectionEndpoints } from "@app/server/routes/v1/app-connection-routers/app-connection-endpoints"; +import { AppConnection } from "@app/services/app-connection/app-connection-enums"; + +export const registerOracleDBConnectionRouter = async (server: FastifyZodProvider) => { + registerAppConnectionEndpoints({ + app: AppConnection.OracleDB, + server, + sanitizedResponseSchema: SanitizedOracleDBConnectionSchema, + createSchema: CreateOracleDBConnectionSchema, + updateSchema: UpdateOracleDBConnectionSchema + }); +}; diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts index c33609621..5d4ccc021 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 @@ -6,6 +6,7 @@ import { registerAzureClientSecretRotationRouter } from "./azure-client-secret-r import { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router"; import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rotation-router"; import { registerMySqlCredentialsRotationRouter } from "./mysql-credentials-rotation-router"; +import { registerOracleDBCredentialsRotationRouter } from "./oracledb-credentials-rotation-router"; import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router"; export * from "./secret-rotation-v2-router"; @@ -17,6 +18,7 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record< [SecretRotation.PostgresCredentials]: registerPostgresCredentialsRotationRouter, [SecretRotation.MsSqlCredentials]: registerMsSqlCredentialsRotationRouter, [SecretRotation.MySqlCredentials]: registerMySqlCredentialsRotationRouter, + [SecretRotation.OracleDBCredentials]: registerOracleDBCredentialsRotationRouter, [SecretRotation.Auth0ClientSecret]: registerAuth0ClientSecretRotationRouter, [SecretRotation.AzureClientSecret]: registerAzureClientSecretRotationRouter, [SecretRotation.AwsIamUserSecret]: registerAwsIamUserSecretRotationRouter, diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/oracledb-credentials-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/oracledb-credentials-rotation-router.ts new file mode 100644 index 000000000..b1721c59e --- /dev/null +++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/oracledb-credentials-rotation-router.ts @@ -0,0 +1,19 @@ +import { + CreateOracleDBCredentialsRotationSchema, + OracleDBCredentialsRotationSchema, + UpdateOracleDBCredentialsRotationSchema +} from "@app/ee/services/secret-rotation-v2/oracledb-credentials"; +import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums"; +import { SqlCredentialsRotationGeneratedCredentialsSchema } from "@app/ee/services/secret-rotation-v2/shared/sql-credentials"; + +import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints"; + +export const registerOracleDBCredentialsRotationRouter = async (server: FastifyZodProvider) => + registerSecretRotationEndpoints({ + type: SecretRotation.OracleDBCredentials, + server, + responseSchema: OracleDBCredentialsRotationSchema, + createSchema: CreateOracleDBCredentialsRotationSchema, + updateSchema: UpdateOracleDBCredentialsRotationSchema, + generatedCredentialsSchema: SqlCredentialsRotationGeneratedCredentialsSchema + }); diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts index 5e3e09846..86768c3ad 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 @@ -7,6 +7,7 @@ import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret import { LdapPasswordRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/ldap-password"; import { MsSqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials"; import { MySqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mysql-credentials"; +import { OracleDBCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/oracledb-credentials"; import { PostgresCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials"; import { SecretRotationV2Schema } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema"; import { ApiDocsTags, SecretRotations } from "@app/lib/api-docs"; @@ -18,6 +19,7 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [ PostgresCredentialsRotationListItemSchema, MsSqlCredentialsRotationListItemSchema, MySqlCredentialsRotationListItemSchema, + OracleDBCredentialsRotationListItemSchema, Auth0ClientSecretRotationListItemSchema, AzureClientSecretRotationListItemSchema, AwsIamUserSecretRotationListItemSchema, diff --git a/backend/src/ee/services/app-connections/oracledb/index.ts b/backend/src/ee/services/app-connections/oracledb/index.ts new file mode 100644 index 000000000..a9d29ab4b --- /dev/null +++ b/backend/src/ee/services/app-connections/oracledb/index.ts @@ -0,0 +1,4 @@ +export * from "./oracledb-connection-enums"; +export * from "./oracledb-connection-fns"; +export * from "./oracledb-connection-schemas"; +export * from "./oracledb-connection-types"; diff --git a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-enums.ts b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-enums.ts new file mode 100644 index 000000000..570e56f2c --- /dev/null +++ b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-enums.ts @@ -0,0 +1,3 @@ +export enum OracleDBConnectionMethod { + UsernameAndPassword = "username-and-password" +} diff --git a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-fns.ts b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-fns.ts new file mode 100644 index 000000000..97ce64b11 --- /dev/null +++ b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-fns.ts @@ -0,0 +1,12 @@ +import { AppConnection } from "@app/services/app-connection/app-connection-enums"; + +import { OracleDBConnectionMethod } from "./oracledb-connection-enums"; + +export const getOracleDBConnectionListItem = () => { + return { + name: "OracleDB" as const, + app: AppConnection.OracleDB as const, + methods: Object.values(OracleDBConnectionMethod) as [OracleDBConnectionMethod.UsernameAndPassword], + supportsPlatformManagement: true as const + }; +}; diff --git a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts new file mode 100644 index 000000000..f93abae83 --- /dev/null +++ b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-schemas.ts @@ -0,0 +1,64 @@ +import z from "zod"; + +import { AppConnections } from "@app/lib/api-docs"; +import { AppConnection } from "@app/services/app-connection/app-connection-enums"; +import { + BaseAppConnectionSchema, + GenericCreateAppConnectionFieldsSchema, + GenericUpdateAppConnectionFieldsSchema +} from "@app/services/app-connection/app-connection-schemas"; +import { BaseSqlUsernameAndPasswordConnectionSchema } from "@app/services/app-connection/shared/sql"; + +import { OracleDBConnectionMethod } from "./oracledb-connection-enums"; + +export const OracleDBConnectionCredentialsSchema = BaseSqlUsernameAndPasswordConnectionSchema; + +const BaseOracleDBConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.OracleDB) }); + +export const OracleDBConnectionSchema = BaseOracleDBConnectionSchema.extend({ + method: z.literal(OracleDBConnectionMethod.UsernameAndPassword), + credentials: OracleDBConnectionCredentialsSchema +}); + +export const SanitizedOracleDBConnectionSchema = z.discriminatedUnion("method", [ + BaseOracleDBConnectionSchema.extend({ + method: z.literal(OracleDBConnectionMethod.UsernameAndPassword), + credentials: OracleDBConnectionCredentialsSchema.pick({ + host: true, + database: true, + port: true, + username: true, + sslEnabled: true, + sslRejectUnauthorized: true, + sslCertificate: true + }) + }) +]); + +export const ValidateOracleDBConnectionCredentialsSchema = z.discriminatedUnion("method", [ + z.object({ + method: z + .literal(OracleDBConnectionMethod.UsernameAndPassword) + .describe(AppConnections.CREATE(AppConnection.OracleDB).method), + credentials: OracleDBConnectionCredentialsSchema.describe(AppConnections.CREATE(AppConnection.OracleDB).credentials) + }) +]); + +export const CreateOracleDBConnectionSchema = ValidateOracleDBConnectionCredentialsSchema.and( + GenericCreateAppConnectionFieldsSchema(AppConnection.OracleDB, { supportsPlatformManagedCredentials: true }) +); + +export const UpdateOracleDBConnectionSchema = z + .object({ + credentials: OracleDBConnectionCredentialsSchema.optional().describe( + AppConnections.UPDATE(AppConnection.OracleDB).credentials + ) + }) + .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.OracleDB, { supportsPlatformManagedCredentials: true })); + +export const OracleDBConnectionListItemSchema = z.object({ + name: z.literal("OracleDB"), + app: z.literal(AppConnection.OracleDB), + methods: z.nativeEnum(OracleDBConnectionMethod).array(), + supportsPlatformManagement: z.literal(true) +}); diff --git a/backend/src/ee/services/app-connections/oracledb/oracledb-connection-types.ts b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-types.ts new file mode 100644 index 000000000..cffed12da --- /dev/null +++ b/backend/src/ee/services/app-connections/oracledb/oracledb-connection-types.ts @@ -0,0 +1,17 @@ +import z from "zod"; + +import { AppConnection } from "@app/services/app-connection/app-connection-enums"; + +import { + CreateOracleDBConnectionSchema, + OracleDBConnectionSchema, + ValidateOracleDBConnectionCredentialsSchema +} from "./oracledb-connection-schemas"; + +export type TOracleDBConnection = z.infer; + +export type TOracleDBConnectionInput = z.infer & { + app: AppConnection.OracleDB; +}; + +export type TValidateOracleDBConnectionCredentialsSchema = typeof ValidateOracleDBConnectionCredentialsSchema; diff --git a/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/index.ts b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/index.ts new file mode 100644 index 000000000..2902d780d --- /dev/null +++ b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/index.ts @@ -0,0 +1,3 @@ +export * from "./oracledb-credentials-rotation-constants"; +export * from "./oracledb-credentials-rotation-schemas"; +export * from "./oracledb-credentials-rotation-types"; diff --git a/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-constants.ts new file mode 100644 index 000000000..dd685041c --- /dev/null +++ b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-constants.ts @@ -0,0 +1,20 @@ +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 ORACLEDB_CREDENTIALS_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = { + name: "OracleDB Credentials", + type: SecretRotation.OracleDBCredentials, + connection: AppConnection.OracleDB, + template: { + createUserStatement: `-- create user +CREATE USER INFISICAL_USER IDENTIFIED BY "temporary_password"; + +-- grant all privileges +GRANT ALL PRIVILEGES TO INFISICAL_USER;`, + secretsMapping: { + username: "ORACLEDB_USERNAME", + password: "ORACLEDB_PASSWORD" + } + } +}; diff --git a/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-schemas.ts new file mode 100644 index 000000000..267098e9c --- /dev/null +++ b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-schemas.ts @@ -0,0 +1,41 @@ +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 { + SqlCredentialsRotationParametersSchema, + SqlCredentialsRotationSecretsMappingSchema, + SqlCredentialsRotationTemplateSchema +} from "@app/ee/services/secret-rotation-v2/shared/sql-credentials"; +import { AppConnection } from "@app/services/app-connection/app-connection-enums"; + +export const OracleDBCredentialsRotationSchema = BaseSecretRotationSchema(SecretRotation.OracleDBCredentials).extend({ + type: z.literal(SecretRotation.OracleDBCredentials), + parameters: SqlCredentialsRotationParametersSchema, + secretsMapping: SqlCredentialsRotationSecretsMappingSchema +}); + +export const CreateOracleDBCredentialsRotationSchema = BaseCreateSecretRotationSchema( + SecretRotation.OracleDBCredentials +).extend({ + parameters: SqlCredentialsRotationParametersSchema, + secretsMapping: SqlCredentialsRotationSecretsMappingSchema +}); + +export const UpdateOracleDBCredentialsRotationSchema = BaseUpdateSecretRotationSchema( + SecretRotation.OracleDBCredentials +).extend({ + parameters: SqlCredentialsRotationParametersSchema.optional(), + secretsMapping: SqlCredentialsRotationSecretsMappingSchema.optional() +}); + +export const OracleDBCredentialsRotationListItemSchema = z.object({ + name: z.literal("OracleDB Credentials"), + connection: z.literal(AppConnection.OracleDB), + type: z.literal(SecretRotation.OracleDBCredentials), + template: SqlCredentialsRotationTemplateSchema +}); diff --git a/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-types.ts new file mode 100644 index 000000000..d303eea62 --- /dev/null +++ b/backend/src/ee/services/secret-rotation-v2/oracledb-credentials/oracledb-credentials-rotation-types.ts @@ -0,0 +1,18 @@ +import { z } from "zod"; + +import { TOracleDBConnection } from "../../app-connections/oracledb"; +import { + CreateOracleDBCredentialsRotationSchema, + OracleDBCredentialsRotationListItemSchema, + OracleDBCredentialsRotationSchema +} from "./oracledb-credentials-rotation-schemas"; + +export type TOracleDBCredentialsRotation = z.infer; + +export type TOracleDBCredentialsRotationInput = z.infer; + +export type TOracleDBCredentialsRotationListItem = z.infer; + +export type TOracleDBCredentialsRotationWithConnection = TOracleDBCredentialsRotation & { + connection: TOracleDBConnection; +}; diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts index a8c92e255..84dc30821 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 @@ -2,6 +2,7 @@ export enum SecretRotation { PostgresCredentials = "postgres-credentials", MsSqlCredentials = "mssql-credentials", MySqlCredentials = "mysql-credentials", + OracleDBCredentials = "oracledb-credentials", Auth0ClientSecret = "auth0-client-secret", AzureClientSecret = "azure-client-secret", AwsIamUserSecret = "aws-iam-user-secret", diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts index ea1b99107..228c4c2a1 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 @@ -10,6 +10,7 @@ import { AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./azure-client-secret" import { LDAP_PASSWORD_ROTATION_LIST_OPTION, TLdapPasswordRotation } from "./ldap-password"; import { MSSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mssql-credentials"; import { MYSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mysql-credentials"; +import { ORACLEDB_CREDENTIALS_ROTATION_LIST_OPTION } from "./oracledb-credentials"; import { POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION } from "./postgres-credentials"; import { SecretRotation, SecretRotationStatus } from "./secret-rotation-v2-enums"; import { TSecretRotationV2ServiceFactoryDep } from "./secret-rotation-v2-service"; @@ -25,6 +26,7 @@ const SECRET_ROTATION_LIST_OPTIONS: Record = { [SecretRotation.PostgresCredentials]: "PostgreSQL Credentials", [SecretRotation.MsSqlCredentials]: "Microsoft SQL Server Credentials", [SecretRotation.MySqlCredentials]: "MySQL Credentials", + [SecretRotation.OracleDBCredentials]: "OracleDB Credentials", [SecretRotation.Auth0ClientSecret]: "Auth0 Client Secret", [SecretRotation.AzureClientSecret]: "Azure Client Secret", [SecretRotation.AwsIamUserSecret]: "AWS IAM User Secret", @@ -15,6 +16,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record { getLdapConnectionListItem(), getTeamCityConnectionListItem(), getOCIConnectionListItem(), + getOracleDBConnectionListItem(), getOnePassConnectionListItem() ].sort((a, b) => a.name.localeCompare(b.name)); }; @@ -193,6 +195,7 @@ export const validateAppConnectionCredentials = async ( [AppConnection.LDAP]: validateLdapConnectionCredentials as TAppConnectionCredentialsValidator, [AppConnection.TeamCity]: validateTeamCityConnectionCredentials as TAppConnectionCredentialsValidator, [AppConnection.OCI]: validateOCIConnectionCredentials as TAppConnectionCredentialsValidator, + [AppConnection.OracleDB]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator, [AppConnection.OnePass]: validateOnePassConnectionCredentials as TAppConnectionCredentialsValidator }; @@ -229,6 +232,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) => case PostgresConnectionMethod.UsernameAndPassword: case MsSqlConnectionMethod.UsernameAndPassword: case MySqlConnectionMethod.UsernameAndPassword: + case OracleDBConnectionMethod.UsernameAndPassword: return "Username & Password"; case WindmillConnectionMethod.AccessToken: case HCVaultConnectionMethod.AccessToken: @@ -294,6 +298,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record< [AppConnection.LDAP]: platformManagedCredentialsNotSupported, // we could support this in the future [AppConnection.TeamCity]: platformManagedCredentialsNotSupported, [AppConnection.OCI]: platformManagedCredentialsNotSupported, + [AppConnection.OracleDB]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform, [AppConnection.OnePass]: platformManagedCredentialsNotSupported }; diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts index 80a208a66..19967aa3b 100644 --- a/backend/src/services/app-connection/app-connection-maps.ts +++ b/backend/src/services/app-connection/app-connection-maps.ts @@ -23,6 +23,7 @@ export const APP_CONNECTION_NAME_MAP: Record = { [AppConnection.LDAP]: "LDAP", [AppConnection.TeamCity]: "TeamCity", [AppConnection.OCI]: "OCI", + [AppConnection.OracleDB]: "OracleDB", [AppConnection.OnePass]: "1Password" }; @@ -48,6 +49,7 @@ export const APP_CONNECTION_PLAN_MAP: Record>>; -export type TSqlConnection = TPostgresConnection | TMsSqlConnection | TMySqlConnection; +export type TSqlConnection = TPostgresConnection | TMsSqlConnection | TMySqlConnection | TOracleDBConnection; export type TAppConnectionInput = { id: string } & ( | TAwsConnectionInput @@ -184,10 +190,15 @@ export type TAppConnectionInput = { id: string } & ( | TLdapConnectionInput | TTeamCityConnectionInput | TOCIConnectionInput + | TOracleDBConnectionInput | TOnePassConnectionInput ); -export type TSqlConnectionInput = TPostgresConnectionInput | TMsSqlConnectionInput | TMySqlConnectionInput; +export type TSqlConnectionInput = + | TPostgresConnectionInput + | TMsSqlConnectionInput + | TMySqlConnectionInput + | TOracleDBConnectionInput; export type TCreateAppConnectionDTO = Pick< TAppConnectionInput, @@ -244,6 +255,7 @@ export type TValidateAppConnectionCredentialsSchema = | TValidateLdapConnectionCredentialsSchema | TValidateTeamCityConnectionCredentialsSchema | TValidateOCIConnectionCredentialsSchema + | TValidateOracleDBConnectionCredentialsSchema | TValidateOnePassConnectionCredentialsSchema; export type TListAwsConnectionKmsKeys = { diff --git a/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts b/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts index 7df1929ba..33cc8257d 100644 --- a/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts +++ b/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts @@ -16,7 +16,8 @@ const EXTERNAL_REQUEST_TIMEOUT = 10 * 1000; const SQL_CONNECTION_CLIENT_MAP = { [AppConnection.Postgres]: "pg", [AppConnection.MsSql]: "mssql", - [AppConnection.MySql]: "mysql2" + [AppConnection.MySql]: "mysql2", + [AppConnection.OracleDB]: "oracledb" }; const getConnectionConfig = ({ @@ -57,6 +58,17 @@ const getConnectionConfig = ({ : false }; } + + case AppConnection.OracleDB: { + return { + ssl: sslEnabled + ? { + sslCA: sslCertificate, + sslServerDNMatch: sslRejectUnauthorized + } + : false + }; + } default: throw new Error(`Unhandled SQL Connection Config: ${app as AppConnection}`); } @@ -114,7 +126,8 @@ export const SQL_CONNECTION_ALTER_LOGIN_STATEMENT: Record< > = { [AppConnection.Postgres]: ({ username, password }) => [`ALTER USER ?? WITH PASSWORD '${password}';`, [username]], [AppConnection.MsSql]: ({ username, password }) => [`ALTER LOGIN ?? WITH PASSWORD = '${password}';`, [username]], - [AppConnection.MySql]: ({ username, password }) => [`ALTER USER ??@'%' IDENTIFIED BY '${password}';`, [username]] + [AppConnection.MySql]: ({ username, password }) => [`ALTER USER ??@'%' IDENTIFIED BY '${password}';`, [username]], + [AppConnection.OracleDB]: ({ username, password }) => [`ALTER USER ?? IDENTIFIED BY "${password}"`, [username]] }; export const transferSqlConnectionCredentialsToPlatform = async ( diff --git a/docs/api-reference/endpoints/app-connections/oracledb/available.mdx b/docs/api-reference/endpoints/app-connections/oracledb/available.mdx new file mode 100644 index 000000000..ffc067b3a --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/available.mdx @@ -0,0 +1,4 @@ +--- +title: "Available" +openapi: "GET /api/v1/app-connections/oracledb/available" +--- diff --git a/docs/api-reference/endpoints/app-connections/oracledb/create.mdx b/docs/api-reference/endpoints/app-connections/oracledb/create.mdx new file mode 100644 index 000000000..06d9170ee --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/create.mdx @@ -0,0 +1,8 @@ +--- +title: "Create" +openapi: "POST /api/v1/app-connections/oracledb" +--- + + + Check out the configuration docs for [OracleDB Connections](/integrations/app-connections/oracledb) to learn how to obtain the required credentials. + diff --git a/docs/api-reference/endpoints/app-connections/oracledb/delete.mdx b/docs/api-reference/endpoints/app-connections/oracledb/delete.mdx new file mode 100644 index 000000000..3331d4c8f --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/delete.mdx @@ -0,0 +1,4 @@ +--- +title: "Delete" +openapi: "DELETE /api/v1/app-connections/oracledb/{connectionId}" +--- diff --git a/docs/api-reference/endpoints/app-connections/oracledb/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/oracledb/get-by-id.mdx new file mode 100644 index 000000000..c6d445101 --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/get-by-id.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by ID" +openapi: "GET /api/v1/app-connections/oracledb/{connectionId}" +--- diff --git a/docs/api-reference/endpoints/app-connections/oracledb/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/oracledb/get-by-name.mdx new file mode 100644 index 000000000..ba16d8734 --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/get-by-name.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by Name" +openapi: "GET /api/v1/app-connections/oracledb/connection-name/{connectionName}" +--- diff --git a/docs/api-reference/endpoints/app-connections/oracledb/list.mdx b/docs/api-reference/endpoints/app-connections/oracledb/list.mdx new file mode 100644 index 000000000..38964a479 --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/list.mdx @@ -0,0 +1,4 @@ +--- +title: "List" +openapi: "GET /api/v1/app-connections/oracledb" +--- diff --git a/docs/api-reference/endpoints/app-connections/oracledb/update.mdx b/docs/api-reference/endpoints/app-connections/oracledb/update.mdx new file mode 100644 index 000000000..41cc6e5bc --- /dev/null +++ b/docs/api-reference/endpoints/app-connections/oracledb/update.mdx @@ -0,0 +1,8 @@ +--- +title: "Update" +openapi: "PATCH /api/v1/app-connections/oracledb/{connectionId}" +--- + + + Check out the configuration docs for [OracleDB Connections](/integrations/app-connections/oracledb) to learn how to obtain the required credentials. + diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/create.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/create.mdx new file mode 100644 index 000000000..d3bb74fc6 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/create.mdx @@ -0,0 +1,8 @@ +--- +title: "Create" +openapi: "POST /api/v2/secret-rotations/oracledb-credentials" +--- + + + Check out the configuration docs for [OracleDB Credentials Rotations](/documentation/platform/secret-rotation/oracledb-credentials) to learn how to obtain the required parameters. + diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/delete.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/delete.mdx new file mode 100644 index 000000000..c916a27a5 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/delete.mdx @@ -0,0 +1,4 @@ +--- +title: "Delete" +openapi: "DELETE /api/v2/secret-rotations/oracledb-credentials/{rotationId}" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-id.mdx new file mode 100644 index 000000000..980c670e7 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-id.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by ID" +openapi: "GET /api/v2/secret-rotations/oracledb-credentials/{rotationId}" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-name.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-name.mdx new file mode 100644 index 000000000..0aeec7a3e --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-name.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by Name" +openapi: "GET /api/v2/secret-rotations/oracledb-credentials/rotation-name/{rotationName}" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-generated-credentials-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-generated-credentials-by-id.mdx new file mode 100644 index 000000000..18c03cf06 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/get-generated-credentials-by-id.mdx @@ -0,0 +1,4 @@ +--- +title: "Get Credentials by ID" +openapi: "GET /api/v2/secret-rotations/oracledb-credentials/{rotationId}/generated-credentials" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/list.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/list.mdx new file mode 100644 index 000000000..25e70df38 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/list.mdx @@ -0,0 +1,4 @@ +--- +title: "List" +openapi: "GET /api/v2/secret-rotations/oracledb-credentials" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/rotate-secrets.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/rotate-secrets.mdx new file mode 100644 index 000000000..40066565a --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/rotate-secrets.mdx @@ -0,0 +1,4 @@ +--- +title: "Rotate Secrets" +openapi: "POST /api/v2/secret-rotations/oracledb-credentials/{rotationId}/rotate-secrets" +--- diff --git a/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/update.mdx b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/update.mdx new file mode 100644 index 000000000..2436136d7 --- /dev/null +++ b/docs/api-reference/endpoints/secret-rotations/oracledb-credentials/update.mdx @@ -0,0 +1,8 @@ +--- +title: "Update" +openapi: "PATCH /api/v2/secret-rotations/oracledb-credentials/{rotationId}" +--- + + + Check out the configuration docs for [OracleDB Credentials Rotations](/documentation/platform/secret-rotation/oracledb-credentials) to learn how to obtain the required parameters. + diff --git a/docs/documentation/platform/secret-rotation/oracledb-credentials.mdx b/docs/documentation/platform/secret-rotation/oracledb-credentials.mdx new file mode 100644 index 000000000..fb0887d33 --- /dev/null +++ b/docs/documentation/platform/secret-rotation/oracledb-credentials.mdx @@ -0,0 +1,167 @@ +--- +title: "OracleDB Credentials Rotation" +description: "Learn how to automatically rotate Oracle Database credentials." +--- + + + When working with SQL in Oracle databases, any values not surrounded by "quotes" will become UPPERCASE. Keep this in mind when creating users. + + +## Prerequisites + +1. Create a [OracleDB Connection](/integrations/app-connections/oracledb) with the required **Secret Rotation** permissions +2. Create two designated database users for Infisical to rotate the credentials for. Be sure to grant each user login permissions for the desired database with the necessary privileges their use case will require. + + An example creation statement might look like: + ```SQL + -- create user roles + CREATE USER INFISICAL_USER_1 IDENTIFIED BY "temporary_password"; + CREATE USER INFISICAL_USER_2 IDENTIFIED BY "temporary_password"; + + -- grant necessary privileges + GRANT ALL PRIVILEGES TO INFISICAL_USER_1; + GRANT ALL PRIVILEGES TO INFISICAL_USER_2; + ``` + + + Username must either be ALL UPPERCASE or not be surrounded by "quotes". Values not surrounded by quotes get automatically transformed to uppercase by Oracle Database. + + + + To learn more about the Oracle Database permission system, please visit their [documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-privilege-and-role-authorization.html). + + + +## Create an Oracle Database Credentials Rotation in Infisical + + + + 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown. + ![Secret Manager Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png) + + 2. Select the **OracleDB Credentials** option. + ![Select OracleDB Credentials](/images/secret-rotations-v2/oracledb-credentials/select-oracledb-credentials-option.png) + + 3. Select the **OracleDB Connection** to use and configure the rotation behavior. Then click **Next**. + ![Rotation Configuration](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-configuration.png) + + - **OracleDB Connection** - the connection that will perform the rotation of the configured database user credentials. + - **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. Input the usernames of the database users created above that will be used for rotation. Then click **Next**. + ![Rotation Parameters](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-parameters.png) + + - **Database Username 1** - the username of the first user that will be used for rotation. + - **Database Username 2** - the username of the second user that will be used for rotation. + + + If your Oracle usernames were created without "quotes", Oracle sees them as UPPERCASE. Please use UPPERCASE for those names in the fields above. + + + 5. Specify the secret names that the active credentials should be mapped to. Then click **Next**. + ![Rotation Secrets Mapping](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-secrets-mapping.png) + + - **Username** - the name of the secret that the active username will be mapped to. + - **Password** - the name of the secret that the active password will be mapped to. + + 6. Give your rotation a name and description (optional). Then click **Next**. + ![Rotation Details](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-details.png) + + - **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**. + ![Rotation Review](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-confirm.png) + + 8. Your **OracleDB Credentials** are now available for use via the mapped secrets. + ![Rotation Created](/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-created.png) + + + To create a OracleDB Credentials Rotation, make an API request to the [Create OracleDB Credentials Rotation](/api-reference/endpoints/secret-rotations/oracledb-credentials/create) API endpoint. + + ### Sample request + + ```bash Request + curl --request POST \ + --url https://us.infisical.com/api/v2/secret-rotations/oracledb-credentials \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "my-oracledb-rotation", + "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "description": "my database credentials rotation", + "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "environment": "dev", + "secretPath": "/", + "isAutoRotationEnabled": true, + "rotationInterval": 30, + "rotateAtUtc": { + "hours": 0, + "minutes": 0 + }, + "parameters": { + "username1": "INFISICAL_USER_1", + "username2": "INFISICAL_USER_2" + }, + "secretsMapping": { + "username": "ORACLEDB_USERNAME", + "password": "ORACLEDB_PASSWORD" + } + }' + ``` + + ### Sample response + + ```bash Response + { + "secretRotation": { + "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "name": "my-oracledb-rotation", + "description": "my database credentials rotation", + "secretsMapping": { + "username": "ORACLEDB_USERNAME", + "password": "ORACLEDB_PASSWORD" + }, + "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": "oracledb", + "name": "my-oracledb-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": "oracledb-credentials", + "parameters": { + "username1": "INFISICAL_USER_1", + "username2": "INFISICAL_USER_2" + } + } + } + ``` + + diff --git a/docs/images/app-connections/oracledb/create-username-and-password-method.png b/docs/images/app-connections/oracledb/create-username-and-password-method.png new file mode 100644 index 000000000..305710d6f Binary files /dev/null and b/docs/images/app-connections/oracledb/create-username-and-password-method.png differ diff --git a/docs/images/app-connections/oracledb/select-oracledb-connection.png b/docs/images/app-connections/oracledb/select-oracledb-connection.png new file mode 100644 index 000000000..a9f9528ce Binary files /dev/null and b/docs/images/app-connections/oracledb/select-oracledb-connection.png differ diff --git a/docs/images/app-connections/oracledb/username-and-password-connection.png b/docs/images/app-connections/oracledb/username-and-password-connection.png new file mode 100644 index 000000000..911ec36b1 Binary files /dev/null and b/docs/images/app-connections/oracledb/username-and-password-connection.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-configuration.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-configuration.png new file mode 100644 index 000000000..4ea91f1e8 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-configuration.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-confirm.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-confirm.png new file mode 100644 index 000000000..f0960c893 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-confirm.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-created.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-created.png new file mode 100644 index 000000000..3e07971d2 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-created.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-details.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-details.png new file mode 100644 index 000000000..9e48621f4 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-details.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-parameters.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-parameters.png new file mode 100644 index 000000000..5dcc68c32 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-parameters.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-secrets-mapping.png b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-secrets-mapping.png new file mode 100644 index 000000000..02b284491 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/oracledb-credentials-secrets-mapping.png differ diff --git a/docs/images/secret-rotations-v2/oracledb-credentials/select-oracledb-credentials-option.png b/docs/images/secret-rotations-v2/oracledb-credentials/select-oracledb-credentials-option.png new file mode 100644 index 000000000..a49ab7be6 Binary files /dev/null and b/docs/images/secret-rotations-v2/oracledb-credentials/select-oracledb-credentials-option.png differ diff --git a/docs/integrations/app-connections/oracledb.mdx b/docs/integrations/app-connections/oracledb.mdx new file mode 100644 index 000000000..8cab6371b --- /dev/null +++ b/docs/integrations/app-connections/oracledb.mdx @@ -0,0 +1,139 @@ +--- +title: "OracleDB Connection" +description: "Learn how to configure a Oracle Database Connection for Infisical." +--- + + + OracleDB App Connection is a paid feature. + + If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, + then you should contact team@infisical.com to purchase an enterprise license to use it. + + +Infisical supports connecting to OracleDB using a database user. + +## Configure an Oracle Database User for Infisical + + + + Infisical recommends creating a designated user in your Oracle Database for your connection. + ```SQL + -- create user + CREATE USER infisical IDENTIFIED BY "my-password"; + + -- grant create session privileges + GRANT CREATE SESSION TO infisical; + ``` + + Username must either be ALL UPPERCASE or not be surrounded by "quotes". Values not surrounded by quotes get automatically transformed to uppercase by Oracle Database. + + + + Depending on how you intend to use your OracleDB connection, you'll need to grant one or more of the following permissions. + + To learn more about the Oracle Database permission system, please visit their [documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-privilege-and-role-authorization.html). + + + + For Secret Rotations, your Infisical user will require the ability to alter other users' passwords: + ```SQL + -- enable permissions to alter login credentials + GRANT ALTER USER TO infisical; + ``` + + + + + You'll need the following information to create your Oracle Database connection: + - `host` - The hostname or IP address of your Oracle Database server + - `port` - The port number your Oracle Database server is listening on (default: 1521) + - `database` - The Oracle Service Name or SID (System Identifier) for the database you are connecting to. For example: `ORCL`, `FREEPDB1`, `XEPDB1` + - `username` - The user name of the login created in the steps above + - `password` - The user password of the login created in the steps above + - `sslCertificate` (optional) - The SSL certificate required for connection (if configured) + + + If you are self-hosting Infisical and intend to connect to an internal/private IP address, be sure to set the `ALLOW_INTERNAL_IP_CONNECTIONS` environment variable to `true`. + + + + +## Create Connection in Infisical + + + + 1. Navigate to the App Connections tab on the Organization Settings page. + ![App Connections Tab](/images/app-connections/general/add-connection.png) + + 2. Select the **OracleDB Connection** option. + ![Select OracleDB Connection](/images/app-connections/oracledb/select-oracledb-connection.png) + + 3. Select the **Username & Password** method option and provide the details obtained from the previous section and press **Connect to OracleDB**. + + + Optionally, if you'd like Infisical to manage the credentials of this connection, you can enable the Platform Managed Credentials option. + If enabled, Infisical will update the password of the connection on creation to prevent external access to this database user. + + + ![Create OracleDB Connection](/images/app-connections/oracledb/create-username-and-password-method.png) + + 4. Your **OracleDB Connection** is now available for use. + ![Assume User OracleDB Connection](/images/app-connections/oracledb/username-and-password-connection.png) + + + To create an Oracle Database Connection, make an API request to the [Create OracleDB Connection](/api-reference/endpoints/app-connections/oracledb/create) API endpoint. + + + Optionally, if you'd like Infisical to manage the credentials of this connection, you can set the `isPlatformManagedCredentials` option to `true`. + If enabled, Infisical will update the password of the connection on creation to prevent external access to this database user. + + + ### Sample request + + ```bash Request + curl --request POST \ + --url https://app.infisical.com/api/v1/app-connections/oracledb \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "my-oracledb-connection", + "method": "username-and-password", + "isPlatformManagedCredentials": true, + "credentials": { + "host": "123.4.5.6", + "port": 1521, + "database": "FREEPDB1", + "username": "infisical", + "password": "my-password", + "sslEnabled": true, + "sslRejectUnauthorized": true + }, + }' + ``` + + ### Sample response + + ```bash Response + { + "appConnection": { + "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "name": "my-oracledb-connection", + "version": 1, + "orgId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "createdAt": "2023-11-07T05:31:56Z", + "updatedAt": "2023-11-07T05:31:56Z", + "app": "oracledb", + "method": "username-and-password", + "isPlatformManagedCredentials": true, + "credentials": { + "host": "123.4.5.6", + "port": 1521, + "database": "FREEPDB1", + "username": "infisical", + "sslEnabled": true, + "sslRejectUnauthorized": true + } + } + } + ``` + + diff --git a/docs/mint.json b/docs/mint.json index 8ab83ae1a..1af808fea 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -200,6 +200,7 @@ "documentation/platform/secret-rotation/ldap-password", "documentation/platform/secret-rotation/mssql-credentials", "documentation/platform/secret-rotation/mysql-credentials", + "documentation/platform/secret-rotation/oracledb-credentials", "documentation/platform/secret-rotation/postgres-credentials" ] }, @@ -511,6 +512,7 @@ "integrations/app-connections/mssql", "integrations/app-connections/mysql", "integrations/app-connections/oci", + "integrations/app-connections/oracledb", "integrations/app-connections/postgres", "integrations/app-connections/teamcity", "integrations/app-connections/terraform-cloud", @@ -1051,6 +1053,19 @@ "api-reference/endpoints/secret-rotations/mysql-credentials/update" ] }, + { + "group": "OracleDB Credentials", + "pages": [ + "api-reference/endpoints/secret-rotations/oracledb-credentials/create", + "api-reference/endpoints/secret-rotations/oracledb-credentials/delete", + "api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-id", + "api-reference/endpoints/secret-rotations/oracledb-credentials/get-by-name", + "api-reference/endpoints/secret-rotations/oracledb-credentials/get-generated-credentials-by-id", + "api-reference/endpoints/secret-rotations/oracledb-credentials/list", + "api-reference/endpoints/secret-rotations/oracledb-credentials/rotate-secrets", + "api-reference/endpoints/secret-rotations/oracledb-credentials/update" + ] + }, { "group": "PostgreSQL Credentials", "pages": [ @@ -1355,6 +1370,18 @@ "api-reference/endpoints/app-connections/oci/delete" ] }, + { + "group": "OracleDB", + "pages": [ + "api-reference/endpoints/app-connections/oracledb/list", + "api-reference/endpoints/app-connections/oracledb/available", + "api-reference/endpoints/app-connections/oracledb/get-by-id", + "api-reference/endpoints/app-connections/oracledb/get-by-name", + "api-reference/endpoints/app-connections/oracledb/create", + "api-reference/endpoints/app-connections/oracledb/update", + "api-reference/endpoints/app-connections/oracledb/delete" + ] + }, { "group": "PostgreSQL", "pages": [ diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx index 969c4a049..c81eb9920 100644 --- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx +++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx @@ -64,6 +64,7 @@ const Content = ({ secretRotation }: ContentProps) => { case SecretRotation.PostgresCredentials: case SecretRotation.MySqlCredentials: case SecretRotation.MsSqlCredentials: + case SecretRotation.OracleDBCredentials: Component = ( = { [SecretRotation.PostgresCredentials]: SqlCredentialsRotationParametersFields, [SecretRotation.MsSqlCredentials]: SqlCredentialsRotationParametersFields, [SecretRotation.MySqlCredentials]: SqlCredentialsRotationParametersFields, + [SecretRotation.OracleDBCredentials]: SqlCredentialsRotationParametersFields, [SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationParametersFields, [SecretRotation.AzureClientSecret]: AzureClientSecretRotationParametersFields, [SecretRotation.LdapPassword]: LdapPasswordRotationParametersFields, diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx index aa317d695..d22ab70e3 100644 --- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx +++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx @@ -3,6 +3,7 @@ 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 { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2"; +import { AppConnection } from "@app/hooks/api/appConnections/enums"; import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2"; export const SqlCredentialsRotationParametersFields = () => { @@ -25,7 +26,15 @@ export const SqlCredentialsRotationParametersFields = () => { errorText={error?.message} label="Database Username 1" > - + )} control={control} @@ -38,7 +47,15 @@ export const SqlCredentialsRotationParametersFields = () => { errorText={error?.message} label="Database Username 2" > - + )} control={control} diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx index 98367eed3..17cc34f27 100644 --- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx +++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx @@ -16,6 +16,7 @@ const COMPONENT_MAP: Record = { [SecretRotation.PostgresCredentials]: SqlCredentialsRotationReviewFields, [SecretRotation.MsSqlCredentials]: SqlCredentialsRotationReviewFields, [SecretRotation.MySqlCredentials]: SqlCredentialsRotationReviewFields, + [SecretRotation.OracleDBCredentials]: SqlCredentialsRotationReviewFields, [SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationReviewFields, [SecretRotation.AzureClientSecret]: AzureClientSecretRotationReviewFields, [SecretRotation.LdapPassword]: LdapPasswordRotationReviewFields, diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx index f77dc99e5..428a99161 100644 --- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx +++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx @@ -13,6 +13,7 @@ const COMPONENT_MAP: Record = { [SecretRotation.PostgresCredentials]: SqlCredentialsRotationSecretsMappingFields, [SecretRotation.MsSqlCredentials]: SqlCredentialsRotationSecretsMappingFields, [SecretRotation.MySqlCredentials]: SqlCredentialsRotationSecretsMappingFields, + [SecretRotation.OracleDBCredentials]: SqlCredentialsRotationSecretsMappingFields, [SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationSecretsMappingFields, [SecretRotation.AzureClientSecret]: AzureClientSecretRotationSecretsMappingFields, [SecretRotation.LdapPassword]: LdapPasswordRotationSecretsMappingFields, diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts index 6d6fc64e2..77151bf1e 100644 --- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts +++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts @@ -10,6 +10,8 @@ import { PostgresCredentialsRotationSchema } from "@app/components/secret-rotati import { SecretRotation } from "@app/hooks/api/secretRotationsV2"; import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/types/ldap-password-rotation"; +import { OracleDBCredentialsRotationSchema } from "./oracledb-credentials-rotation-schema"; + export const SecretRotationV2FormSchema = (isUpdate: boolean) => z .intersection( @@ -19,6 +21,7 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) => PostgresCredentialsRotationSchema, MsSqlCredentialsRotationSchema, MySqlCredentialsRotationSchema, + OracleDBCredentialsRotationSchema, LdapPasswordRotationSchema, AwsIamUserSecretRotationSchema ]), diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/oracledb-credentials-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/oracledb-credentials-rotation-schema.ts new file mode 100644 index 000000000..98574e0a6 --- /dev/null +++ b/frontend/src/components/secret-rotations-v2/forms/schemas/oracledb-credentials-rotation-schema.ts @@ -0,0 +1,12 @@ +import { z } from "zod"; + +import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema"; +import { SqlCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/shared"; +import { SecretRotation } from "@app/hooks/api/secretRotationsV2"; + +export const OracleDBCredentialsRotationSchema = z + .object({ + type: z.literal(SecretRotation.OracleDBCredentials) + }) + .merge(SqlCredentialsRotationSchema) + .merge(BaseSecretRotationSchema); diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts index 0fca6aa95..7a87de58c 100644 --- a/frontend/src/helpers/appConnections.ts +++ b/frontend/src/helpers/appConnections.ts @@ -28,6 +28,7 @@ import { MsSqlConnectionMethod, MySqlConnectionMethod, OnePassConnectionMethod, + OracleDBConnectionMethod, PostgresConnectionMethod, TAppConnection, TeamCityConnectionMethod, @@ -69,6 +70,7 @@ export const APP_CONNECTION_MAP: Record< [AppConnection.Postgres]: { name: "PostgreSQL", image: "Postgres.png" }, [AppConnection.MsSql]: { name: "Microsoft SQL Server", image: "MsSql.png" }, [AppConnection.MySql]: { name: "MySQL", image: "MySql.png" }, + [AppConnection.OracleDB]: { name: "OracleDB", image: "Oracle.png", enterprise: true }, [AppConnection.Camunda]: { name: "Camunda", image: "Camunda.png" }, [AppConnection.Windmill]: { name: "Windmill", image: "Windmill.png" }, [AppConnection.Auth0]: { name: "Auth0", image: "Auth0.png", size: 40 }, @@ -109,6 +111,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) case PostgresConnectionMethod.UsernameAndPassword: case MsSqlConnectionMethod.UsernameAndPassword: case MySqlConnectionMethod.UsernameAndPassword: + case OracleDBConnectionMethod.UsernameAndPassword: return { name: "Username & Password", icon: faLock }; case HCVaultConnectionMethod.AccessToken: case TeamCityConnectionMethod.AccessToken: diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts index a654a1782..6e484881d 100644 --- a/frontend/src/helpers/secretRotationsV2.ts +++ b/frontend/src/helpers/secretRotationsV2.ts @@ -20,6 +20,11 @@ export const SECRET_ROTATION_MAP: Record< image: "MySql.png", size: 50 }, + [SecretRotation.OracleDBCredentials]: { + name: "OracleDB Credentials", + image: "Oracle.png", + size: 50 + }, [SecretRotation.Auth0ClientSecret]: { name: "Auth0 Client Secret", image: "Auth0.png", @@ -46,6 +51,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record = { [SecretRotation.PostgresCredentials]: true, [SecretRotation.MsSqlCredentials]: true, [SecretRotation.MySqlCredentials]: true, + [SecretRotation.OracleDBCredentials]: true, [SecretRotation.Auth0ClientSecret]: false, [SecretRotation.AzureClientSecret]: true, [SecretRotation.LdapPassword]: false, diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts index 6438cc5be..1a3afe355 100644 --- a/frontend/src/hooks/api/appConnections/enums.ts +++ b/frontend/src/hooks/api/appConnections/enums.ts @@ -14,6 +14,7 @@ export enum AppConnection { Postgres = "postgres", MsSql = "mssql", MySql = "mysql", + OracleDB = "oracledb", Camunda = "camunda", Windmill = "windmill", Auth0 = "auth0", diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts index 1dc5d852a..0dcb11fa6 100644 --- a/frontend/src/hooks/api/appConnections/types/app-options.ts +++ b/frontend/src/hooks/api/appConnections/types/app-options.ts @@ -74,6 +74,10 @@ export type TMySqlConnectionOption = TAppConnectionOptionBase & { app: AppConnection.MySql; }; +export type TOracleDBConnectionOption = TAppConnectionOptionBase & { + app: AppConnection.OracleDB; +}; + export type TCamundaConnectionOption = TAppConnectionOptionBase & { app: AppConnection.Camunda; }; @@ -121,6 +125,7 @@ export type TAppConnectionOption = | TPostgresConnectionOption | TMsSqlConnectionOption | TMySqlConnectionOption + | TOracleDBConnectionOption | TCamundaConnectionOption | TWindmillConnectionOption | TAuth0ConnectionOption @@ -145,6 +150,7 @@ export type TAppConnectionOptionMap = { [AppConnection.Postgres]: TPostgresConnectionOption; [AppConnection.MsSql]: TMsSqlConnectionOption; [AppConnection.MySql]: TMySqlConnectionOption; + [AppConnection.OracleDB]: TOracleDBConnectionOption; [AppConnection.Camunda]: TCamundaConnectionOption; [AppConnection.Windmill]: TWindmillConnectionOption; [AppConnection.Auth0]: TAuth0ConnectionOption; diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts index f60c213a7..890562b6b 100644 --- a/frontend/src/hooks/api/appConnections/types/index.ts +++ b/frontend/src/hooks/api/appConnections/types/index.ts @@ -18,6 +18,7 @@ import { TLdapConnection } from "./ldap-connection"; import { TMsSqlConnection } from "./mssql-connection"; import { TMySqlConnection } from "./mysql-connection"; import { TOCIConnection } from "./oci-connection"; +import { TOracleDBConnection } from "./oracledb-connection"; import { TPostgresConnection } from "./postgres-connection"; import { TTeamCityConnection } from "./teamcity-connection"; import { TTerraformCloudConnection } from "./terraform-cloud-connection"; @@ -42,6 +43,7 @@ export * from "./ldap-connection"; export * from "./mssql-connection"; export * from "./mysql-connection"; export * from "./oci-connection"; +export * from "./oracledb-connection"; export * from "./postgres-connection"; export * from "./teamcity-connection"; export * from "./terraform-cloud-connection"; @@ -64,6 +66,7 @@ export type TAppConnection = | TPostgresConnection | TMsSqlConnection | TMySqlConnection + | TOracleDBConnection | TCamundaConnection | TWindmillConnection | TAuth0Connection @@ -114,6 +117,7 @@ export type TAppConnectionMap = { [AppConnection.Postgres]: TPostgresConnection; [AppConnection.MsSql]: TMsSqlConnection; [AppConnection.MySql]: TMySqlConnection; + [AppConnection.OracleDB]: TOracleDBConnection; [AppConnection.Camunda]: TCamundaConnection; [AppConnection.Windmill]: TWindmillConnection; [AppConnection.Auth0]: TAuth0Connection; diff --git a/frontend/src/hooks/api/appConnections/types/oracledb-connection.ts b/frontend/src/hooks/api/appConnections/types/oracledb-connection.ts new file mode 100644 index 000000000..ba500ad04 --- /dev/null +++ b/frontend/src/hooks/api/appConnections/types/oracledb-connection.ts @@ -0,0 +1,13 @@ +import { AppConnection } from "@app/hooks/api/appConnections/enums"; +import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection"; + +import { TBaseSqlConnectionCredentials } from "./shared"; + +export enum OracleDBConnectionMethod { + UsernameAndPassword = "username-and-password" +} + +export type TOracleDBConnection = TRootAppConnection & { app: AppConnection.OracleDB } & { + method: OracleDBConnectionMethod.UsernameAndPassword; + credentials: TBaseSqlConnectionCredentials; +}; diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts index 5daab0d9a..bb2765ffd 100644 --- a/frontend/src/hooks/api/secretRotationsV2/enums.ts +++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts @@ -2,6 +2,7 @@ export enum SecretRotation { PostgresCredentials = "postgres-credentials", MsSqlCredentials = "mssql-credentials", MySqlCredentials = "mysql-credentials", + OracleDBCredentials = "oracledb-credentials", Auth0ClientSecret = "auth0-client-secret", AzureClientSecret = "azure-client-secret", LdapPassword = "ldap-password", diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts index 6f1a82c68..e4b3b6ee1 100644 --- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts +++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts @@ -35,11 +35,16 @@ import { TMySqlCredentialsRotation, TMySqlCredentialsRotationGeneratedCredentialsResponse } from "./mysql-credentials-rotation"; +import { + TOracleDBCredentialsRotation, + TOracleDBCredentialsRotationGeneratedCredentialsResponse +} from "./oracledb-credentials-rotation"; export type TSecretRotationV2 = ( | TPostgresCredentialsRotation | TMsSqlCredentialsRotation | TMySqlCredentialsRotation + | TOracleDBCredentialsRotation | TAuth0ClientSecretRotation | TAzureClientSecretRotation | TLdapPasswordRotation @@ -63,6 +68,7 @@ export type TViewSecretRotationGeneratedCredentialsResponse = | TPostgresCredentialsRotationGeneratedCredentialsResponse | TMsSqlCredentialsRotationGeneratedCredentialsResponse | TMySqlCredentialsRotationGeneratedCredentialsResponse + | TOracleDBCredentialsRotationGeneratedCredentialsResponse | TAuth0ClientSecretRotationGeneratedCredentialsResponse | TAzureClientSecretRotationGeneratedCredentialsResponse | TLdapPasswordRotationGeneratedCredentialsResponse @@ -113,6 +119,7 @@ export type TSecretRotationOptionMap = { [SecretRotation.PostgresCredentials]: TSqlCredentialsRotationOption; [SecretRotation.MsSqlCredentials]: TSqlCredentialsRotationOption; [SecretRotation.MySqlCredentials]: TSqlCredentialsRotationOption; + [SecretRotation.OracleDBCredentials]: TSqlCredentialsRotationOption; [SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationOption; [SecretRotation.AzureClientSecret]: TAzureClientSecretRotationOption; [SecretRotation.LdapPassword]: TLdapPasswordRotationOption; @@ -123,6 +130,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = { [SecretRotation.PostgresCredentials]: TPostgresCredentialsRotationGeneratedCredentialsResponse; [SecretRotation.MsSqlCredentials]: TMsSqlCredentialsRotationGeneratedCredentialsResponse; [SecretRotation.MySqlCredentials]: TMySqlCredentialsRotationGeneratedCredentialsResponse; + [SecretRotation.OracleDBCredentials]: TOracleDBCredentialsRotationGeneratedCredentialsResponse; [SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationGeneratedCredentialsResponse; [SecretRotation.AzureClientSecret]: TAzureClientSecretRotationGeneratedCredentialsResponse; [SecretRotation.LdapPassword]: TLdapPasswordRotationGeneratedCredentialsResponse; diff --git a/frontend/src/hooks/api/secretRotationsV2/types/oracledb-credentials-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/oracledb-credentials-rotation.ts new file mode 100644 index 000000000..80b9d7899 --- /dev/null +++ b/frontend/src/hooks/api/secretRotationsV2/types/oracledb-credentials-rotation.ts @@ -0,0 +1,17 @@ +import { SecretRotation } from "@app/hooks/api/secretRotationsV2"; +import { + TSecretRotationV2Base, + TSecretRotationV2GeneratedCredentialsResponseBase, + TSqlCredentialsRotationGeneratedCredentials, + TSqlCredentialsRotationProperties +} from "@app/hooks/api/secretRotationsV2/types/shared"; + +export type TOracleDBCredentialsRotation = TSecretRotationV2Base & { + type: SecretRotation.OracleDBCredentials; +} & TSqlCredentialsRotationProperties; + +export type TOracleDBCredentialsRotationGeneratedCredentialsResponse = + TSecretRotationV2GeneratedCredentialsResponseBase< + SecretRotation.OracleDBCredentials, + TSqlCredentialsRotationGeneratedCredentials + >; diff --git a/frontend/src/hooks/api/secretRotationsV2/types/shared/sql-credentials-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/shared/sql-credentials-rotation.ts index 3be6679f0..a24242510 100644 --- a/frontend/src/hooks/api/secretRotationsV2/types/shared/sql-credentials-rotation.ts +++ b/frontend/src/hooks/api/secretRotationsV2/types/shared/sql-credentials-rotation.ts @@ -17,8 +17,13 @@ export type TSqlCredentialsRotationOption = { type: | SecretRotation.PostgresCredentials | SecretRotation.MsSqlCredentials - | SecretRotation.MySqlCredentials; - connection: AppConnection.Postgres | AppConnection.MsSql | AppConnection.MySql; + | SecretRotation.MySqlCredentials + | SecretRotation.OracleDBCredentials; + connection: + | AppConnection.Postgres + | AppConnection.MsSql + | AppConnection.MySql + | AppConnection.OracleDB; template: { secretsMapping: TSqlCredentialsRotationProperties["secretsMapping"]; createUserStatement: string; diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx index a5075e033..052ff18a7 100644 --- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx +++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx @@ -27,6 +27,7 @@ import { LdapConnectionForm } from "./LdapConnectionForm"; import { MsSqlConnectionForm } from "./MsSqlConnectionForm"; import { MySqlConnectionForm } from "./MySqlConnectionForm"; import { OCIConnectionForm } from "./OCIConnectionForm"; +import { OracleDBConnectionForm } from "./OracleDBConnectionForm"; import { PostgresConnectionForm } from "./PostgresConnectionForm"; import { TeamCityConnectionForm } from "./TeamCityConnectionForm"; import { TerraformCloudConnectionForm } from "./TerraformCloudConnectionForm"; @@ -96,6 +97,8 @@ const CreateForm = ({ app, onComplete }: CreateFormProps) => { return ; case AppConnection.MySql: return ; + case AppConnection.OracleDB: + return ; case AppConnection.Camunda: return ; case AppConnection.AzureClientSecrets: @@ -178,6 +181,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => { return ; case AppConnection.MySql: return ; + case AppConnection.OracleDB: + return ; case AppConnection.Camunda: return ; case AppConnection.AzureClientSecrets: diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx new file mode 100644 index 000000000..25dded675 --- /dev/null +++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/OracleDBConnectionForm.tsx @@ -0,0 +1,155 @@ +import { useState } from "react"; +import { Controller, FormProvider, useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { z } from "zod"; + +import { Button, FormControl, ModalClose, Select, SelectItem } from "@app/components/v2"; +import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections"; +import { OracleDBConnectionMethod, TOracleDBConnection } from "@app/hooks/api/appConnections"; +import { AppConnection } from "@app/hooks/api/appConnections/enums"; +import { PlatformManagedConfirmationModal } from "@app/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/shared/PlatformManagedConfirmationModal"; + +import { + genericAppConnectionFieldsSchema, + GenericAppConnectionsFields +} from "./GenericAppConnectionFields"; +import { + BaseSqlUsernameAndPasswordConnectionSchema, + PlatformManagedNoticeBanner, + SqlConnectionFields +} from "./shared"; + +type Props = { + appConnection?: TOracleDBConnection; + onSubmit: (formData: FormData) => Promise; +}; + +const rootSchema = genericAppConnectionFieldsSchema.extend({ + app: z.literal(AppConnection.OracleDB), + isPlatformManagedCredentials: z.boolean().optional() +}); + +const formSchema = z.discriminatedUnion("method", [ + rootSchema.extend({ + method: z.literal(OracleDBConnectionMethod.UsernameAndPassword), + credentials: BaseSqlUsernameAndPasswordConnectionSchema + }) +]); + +type FormData = z.infer; + +export const OracleDBConnectionForm = ({ appConnection, onSubmit }: Props) => { + const isUpdate = Boolean(appConnection); + const [showConfirmation, setShowConfirmation] = useState(false); + const [selectedTabIndex, setSelectedTabIndex] = useState(0); + + const form = useForm({ + resolver: zodResolver(formSchema), + defaultValues: appConnection ?? { + app: AppConnection.OracleDB, + method: OracleDBConnectionMethod.UsernameAndPassword, + credentials: { + host: "", + port: 1521, + database: "ORCL", // Typically FREEPDB1 or ORCL + username: "", // Typically pdbadmin or ADMIN + password: "", + sslEnabled: true, + sslRejectUnauthorized: true, + sslCertificate: undefined + } + } + }); + + const { + handleSubmit, + control, + formState: { isSubmitting, isDirty } + } = form; + + const isPlatformManagedCredentials = appConnection?.isPlatformManagedCredentials ?? false; + + const confirmSubmit = async (formData: FormData) => { + if (formData.isPlatformManagedCredentials) { + setShowConfirmation(true); + return; + } + + await onSubmit(formData); + }; + + return ( + +
{ + setSelectedTabIndex(0); + handleSubmit(confirmSubmit)(e); + }} + > + {!isUpdate && } + ( + + + + )} + /> + + {isPlatformManagedCredentials ? ( + + ) : ( +
+ + + + +
+ )} + + handleSubmit(onSubmit)()} + onOpenChange={setShowConfirmation} + isOpen={showConfirmation} + /> +
+ ); +};