mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 10:28:00 +00:00
checkpoint
This commit is contained in:
@@ -5,6 +5,7 @@ import { registerAwsIamUserSecretRotationRouter } from "./aws-iam-user-secret-ro
|
|||||||
import { registerAzureClientSecretRotationRouter } from "./azure-client-secret-rotation-router";
|
import { registerAzureClientSecretRotationRouter } from "./azure-client-secret-rotation-router";
|
||||||
import { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router";
|
import { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router";
|
||||||
import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rotation-router";
|
import { registerMsSqlCredentialsRotationRouter } from "./mssql-credentials-rotation-router";
|
||||||
|
import { registerMySqlCredentialsRotationRouter } from "./mysql-credentials-rotation-router";
|
||||||
import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";
|
import { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";
|
||||||
|
|
||||||
export * from "./secret-rotation-v2-router";
|
export * from "./secret-rotation-v2-router";
|
||||||
@@ -15,6 +16,7 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<
|
|||||||
> = {
|
> = {
|
||||||
[SecretRotation.PostgresCredentials]: registerPostgresCredentialsRotationRouter,
|
[SecretRotation.PostgresCredentials]: registerPostgresCredentialsRotationRouter,
|
||||||
[SecretRotation.MsSqlCredentials]: registerMsSqlCredentialsRotationRouter,
|
[SecretRotation.MsSqlCredentials]: registerMsSqlCredentialsRotationRouter,
|
||||||
|
[SecretRotation.MySqlCredentials]: registerMySqlCredentialsRotationRouter,
|
||||||
[SecretRotation.Auth0ClientSecret]: registerAuth0ClientSecretRotationRouter,
|
[SecretRotation.Auth0ClientSecret]: registerAuth0ClientSecretRotationRouter,
|
||||||
[SecretRotation.AzureClientSecret]: registerAzureClientSecretRotationRouter,
|
[SecretRotation.AzureClientSecret]: registerAzureClientSecretRotationRouter,
|
||||||
[SecretRotation.AwsIamUserSecret]: registerAwsIamUserSecretRotationRouter,
|
[SecretRotation.AwsIamUserSecret]: registerAwsIamUserSecretRotationRouter,
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
import {
|
||||||
|
CreateMySqlCredentialsRotationSchema,
|
||||||
|
MySqlCredentialsRotationSchema,
|
||||||
|
UpdateMySqlCredentialsRotationSchema
|
||||||
|
} from "@app/ee/services/secret-rotation-v2/mysql-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 registerMySqlCredentialsRotationRouter = async (server: FastifyZodProvider) =>
|
||||||
|
registerSecretRotationEndpoints({
|
||||||
|
type: SecretRotation.MySqlCredentials,
|
||||||
|
server,
|
||||||
|
responseSchema: MySqlCredentialsRotationSchema,
|
||||||
|
createSchema: CreateMySqlCredentialsRotationSchema,
|
||||||
|
updateSchema: UpdateMySqlCredentialsRotationSchema,
|
||||||
|
generatedCredentialsSchema: SqlCredentialsRotationGeneratedCredentialsSchema
|
||||||
|
});
|
||||||
@@ -6,6 +6,7 @@ import { AwsIamUserSecretRotationListItemSchema } from "@app/ee/services/secret-
|
|||||||
import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";
|
import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";
|
||||||
import { LdapPasswordRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";
|
import { LdapPasswordRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";
|
||||||
import { MsSqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
import { MsSqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
||||||
|
import { MySqlCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/mysql-credentials";
|
||||||
import { PostgresCredentialsRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/postgres-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 { SecretRotationV2Schema } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema";
|
||||||
import { ApiDocsTags, SecretRotations } from "@app/lib/api-docs";
|
import { ApiDocsTags, SecretRotations } from "@app/lib/api-docs";
|
||||||
@@ -16,6 +17,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [
|
const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [
|
||||||
PostgresCredentialsRotationListItemSchema,
|
PostgresCredentialsRotationListItemSchema,
|
||||||
MsSqlCredentialsRotationListItemSchema,
|
MsSqlCredentialsRotationListItemSchema,
|
||||||
|
MySqlCredentialsRotationListItemSchema,
|
||||||
Auth0ClientSecretRotationListItemSchema,
|
Auth0ClientSecretRotationListItemSchema,
|
||||||
AzureClientSecretRotationListItemSchema,
|
AzureClientSecretRotationListItemSchema,
|
||||||
AwsIamUserSecretRotationListItemSchema,
|
AwsIamUserSecretRotationListItemSchema,
|
||||||
|
|||||||
@@ -18,33 +18,33 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
|
|||||||
environmentsUsed: 0,
|
environmentsUsed: 0,
|
||||||
identityLimit: null,
|
identityLimit: null,
|
||||||
identitiesUsed: 0,
|
identitiesUsed: 0,
|
||||||
dynamicSecret: false,
|
dynamicSecret: true,
|
||||||
secretVersioning: true,
|
secretVersioning: true,
|
||||||
pitRecovery: false,
|
pitRecovery: true,
|
||||||
ipAllowlisting: false,
|
ipAllowlisting: true,
|
||||||
rbac: false,
|
rbac: true,
|
||||||
githubOrgSync: false,
|
githubOrgSync: true,
|
||||||
customRateLimits: false,
|
customRateLimits: false,
|
||||||
customAlerts: false,
|
customAlerts: true,
|
||||||
secretAccessInsights: false,
|
secretAccessInsights: true,
|
||||||
auditLogs: false,
|
auditLogs: true,
|
||||||
auditLogsRetentionDays: 0,
|
auditLogsRetentionDays: 3,
|
||||||
auditLogStreams: false,
|
auditLogStreams: true,
|
||||||
auditLogStreamLimit: 3,
|
auditLogStreamLimit: 3,
|
||||||
samlSSO: false,
|
samlSSO: true,
|
||||||
hsm: false,
|
hsm: true,
|
||||||
oidcSSO: false,
|
oidcSSO: true,
|
||||||
scim: false,
|
scim: true,
|
||||||
ldap: false,
|
ldap: true,
|
||||||
groups: false,
|
groups: true,
|
||||||
status: null,
|
status: null,
|
||||||
trial_end: null,
|
trial_end: null,
|
||||||
has_used_trial: true,
|
has_used_trial: true,
|
||||||
secretApproval: false,
|
secretApproval: true,
|
||||||
secretRotation: false,
|
secretRotation: true,
|
||||||
caCrl: false,
|
caCrl: true,
|
||||||
instanceUserManagement: false,
|
instanceUserManagement: true,
|
||||||
externalKms: false,
|
externalKms: true,
|
||||||
rateLimits: {
|
rateLimits: {
|
||||||
readLimit: 60,
|
readLimit: 60,
|
||||||
writeLimit: 200,
|
writeLimit: 200,
|
||||||
@@ -52,10 +52,10 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
|
|||||||
},
|
},
|
||||||
pkiEst: false,
|
pkiEst: false,
|
||||||
enforceMfa: false,
|
enforceMfa: false,
|
||||||
projectTemplates: false,
|
projectTemplates: true,
|
||||||
kmip: false,
|
kmip: true,
|
||||||
gateway: false,
|
gateway: true,
|
||||||
sshHostGroups: false
|
sshHostGroups: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const setupLicenseRequestWithStore = (baseURL: string, refreshUrl: string, licenseKey: string) => {
|
export const setupLicenseRequestWithStore = (baseURL: string, refreshUrl: string, licenseKey: string) => {
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export * from "./mysql-credentials-rotation-constants";
|
||||||
|
export * from "./mysql-credentials-rotation-schemas";
|
||||||
|
export * from "./mysql-credentials-rotation-types";
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
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 MYSQL_CREDENTIALS_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {
|
||||||
|
name: "MySQL Credentials",
|
||||||
|
type: SecretRotation.MySqlCredentials,
|
||||||
|
connection: AppConnection.MySql,
|
||||||
|
template: {
|
||||||
|
createUserStatement: `-- create user
|
||||||
|
CREATE USER 'infisical_user'@'%' IDENTIFIED BY 'temporary_password';
|
||||||
|
|
||||||
|
-- grant all privilages
|
||||||
|
GRANT ALL PRIVILEGES ON my_database.* TO 'infisical_user'@'%';
|
||||||
|
|
||||||
|
-- apply the privilege changes
|
||||||
|
FLUSH PRIVILEGES;`,
|
||||||
|
secretsMapping: {
|
||||||
|
username: "MYSQL_USERNAME",
|
||||||
|
password: "MYSQL_PASSWORD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+41
@@ -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 MySqlCredentialsRotationSchema = BaseSecretRotationSchema(SecretRotation.MySqlCredentials).extend({
|
||||||
|
type: z.literal(SecretRotation.MySqlCredentials),
|
||||||
|
parameters: SqlCredentialsRotationParametersSchema,
|
||||||
|
secretsMapping: SqlCredentialsRotationSecretsMappingSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const CreateMySqlCredentialsRotationSchema = BaseCreateSecretRotationSchema(
|
||||||
|
SecretRotation.MySqlCredentials
|
||||||
|
).extend({
|
||||||
|
parameters: SqlCredentialsRotationParametersSchema,
|
||||||
|
secretsMapping: SqlCredentialsRotationSecretsMappingSchema
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UpdateMySqlCredentialsRotationSchema = BaseUpdateSecretRotationSchema(
|
||||||
|
SecretRotation.MySqlCredentials
|
||||||
|
).extend({
|
||||||
|
parameters: SqlCredentialsRotationParametersSchema.optional(),
|
||||||
|
secretsMapping: SqlCredentialsRotationSecretsMappingSchema.optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
export const MySqlCredentialsRotationListItemSchema = z.object({
|
||||||
|
name: z.literal("MySQL Credentials"),
|
||||||
|
connection: z.literal(AppConnection.MySql),
|
||||||
|
type: z.literal(SecretRotation.MySqlCredentials),
|
||||||
|
template: SqlCredentialsRotationTemplateSchema
|
||||||
|
});
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { TMySqlConnection } from "@app/services/app-connection/mysql";
|
||||||
|
|
||||||
|
import {
|
||||||
|
CreateMySqlCredentialsRotationSchema,
|
||||||
|
MySqlCredentialsRotationListItemSchema,
|
||||||
|
MySqlCredentialsRotationSchema
|
||||||
|
} from "./mysql-credentials-rotation-schemas";
|
||||||
|
|
||||||
|
export type TMySqlCredentialsRotation = z.infer<typeof MySqlCredentialsRotationSchema>;
|
||||||
|
|
||||||
|
export type TMySqlCredentialsRotationInput = z.infer<typeof CreateMySqlCredentialsRotationSchema>;
|
||||||
|
|
||||||
|
export type TMySqlCredentialsRotationListItem = z.infer<typeof MySqlCredentialsRotationListItemSchema>;
|
||||||
|
|
||||||
|
export type TMySqlCredentialsRotationWithConnection = TMySqlCredentialsRotation & {
|
||||||
|
connection: TMySqlConnection;
|
||||||
|
};
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
export enum SecretRotation {
|
export enum SecretRotation {
|
||||||
PostgresCredentials = "postgres-credentials",
|
PostgresCredentials = "postgres-credentials",
|
||||||
MsSqlCredentials = "mssql-credentials",
|
MsSqlCredentials = "mssql-credentials",
|
||||||
|
MySqlCredentials = "mysql-credentials",
|
||||||
Auth0ClientSecret = "auth0-client-secret",
|
Auth0ClientSecret = "auth0-client-secret",
|
||||||
AzureClientSecret = "azure-client-secret",
|
AzureClientSecret = "azure-client-secret",
|
||||||
AwsIamUserSecret = "aws-iam-user-secret",
|
AwsIamUserSecret = "aws-iam-user-secret",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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 { AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./azure-client-secret";
|
||||||
import { LDAP_PASSWORD_ROTATION_LIST_OPTION, TLdapPasswordRotation } from "./ldap-password";
|
import { LDAP_PASSWORD_ROTATION_LIST_OPTION, TLdapPasswordRotation } from "./ldap-password";
|
||||||
import { MSSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mssql-credentials";
|
import { MSSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mssql-credentials";
|
||||||
|
import { MYSQL_CREDENTIALS_ROTATION_LIST_OPTION } from "./mysql-credentials";
|
||||||
import { POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION } from "./postgres-credentials";
|
import { POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION } from "./postgres-credentials";
|
||||||
import { SecretRotation, SecretRotationStatus } from "./secret-rotation-v2-enums";
|
import { SecretRotation, SecretRotationStatus } from "./secret-rotation-v2-enums";
|
||||||
import { TSecretRotationV2ServiceFactoryDep } from "./secret-rotation-v2-service";
|
import { TSecretRotationV2ServiceFactoryDep } from "./secret-rotation-v2-service";
|
||||||
@@ -23,6 +24,7 @@ import {
|
|||||||
const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2ListItem> = {
|
const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2ListItem> = {
|
||||||
[SecretRotation.PostgresCredentials]: POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION,
|
[SecretRotation.PostgresCredentials]: POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION,
|
||||||
[SecretRotation.MsSqlCredentials]: MSSQL_CREDENTIALS_ROTATION_LIST_OPTION,
|
[SecretRotation.MsSqlCredentials]: MSSQL_CREDENTIALS_ROTATION_LIST_OPTION,
|
||||||
|
[SecretRotation.MySqlCredentials]: MYSQL_CREDENTIALS_ROTATION_LIST_OPTION,
|
||||||
[SecretRotation.Auth0ClientSecret]: AUTH0_CLIENT_SECRET_ROTATION_LIST_OPTION,
|
[SecretRotation.Auth0ClientSecret]: AUTH0_CLIENT_SECRET_ROTATION_LIST_OPTION,
|
||||||
[SecretRotation.AzureClientSecret]: AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION,
|
[SecretRotation.AzureClientSecret]: AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION,
|
||||||
[SecretRotation.AwsIamUserSecret]: AWS_IAM_USER_SECRET_ROTATION_LIST_OPTION,
|
[SecretRotation.AwsIamUserSecret]: AWS_IAM_USER_SECRET_ROTATION_LIST_OPTION,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enums
|
|||||||
export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
|
export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
|
||||||
[SecretRotation.PostgresCredentials]: "PostgreSQL Credentials",
|
[SecretRotation.PostgresCredentials]: "PostgreSQL Credentials",
|
||||||
[SecretRotation.MsSqlCredentials]: "Microsoft SQL Server Credentials",
|
[SecretRotation.MsSqlCredentials]: "Microsoft SQL Server Credentials",
|
||||||
|
[SecretRotation.MySqlCredentials]: "MySQL Credentials",
|
||||||
[SecretRotation.Auth0ClientSecret]: "Auth0 Client Secret",
|
[SecretRotation.Auth0ClientSecret]: "Auth0 Client Secret",
|
||||||
[SecretRotation.AzureClientSecret]: "Azure Client Secret",
|
[SecretRotation.AzureClientSecret]: "Azure Client Secret",
|
||||||
[SecretRotation.AwsIamUserSecret]: "AWS IAM User Secret",
|
[SecretRotation.AwsIamUserSecret]: "AWS IAM User Secret",
|
||||||
@@ -13,6 +14,7 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {
|
|||||||
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
|
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
|
||||||
[SecretRotation.PostgresCredentials]: AppConnection.Postgres,
|
[SecretRotation.PostgresCredentials]: AppConnection.Postgres,
|
||||||
[SecretRotation.MsSqlCredentials]: AppConnection.MsSql,
|
[SecretRotation.MsSqlCredentials]: AppConnection.MsSql,
|
||||||
|
[SecretRotation.MySqlCredentials]: AppConnection.MySql,
|
||||||
[SecretRotation.Auth0ClientSecret]: AppConnection.Auth0,
|
[SecretRotation.Auth0ClientSecret]: AppConnection.Auth0,
|
||||||
[SecretRotation.AzureClientSecret]: AppConnection.AzureClientSecrets,
|
[SecretRotation.AzureClientSecret]: AppConnection.AzureClientSecrets,
|
||||||
[SecretRotation.AwsIamUserSecret]: AppConnection.AWS,
|
[SecretRotation.AwsIamUserSecret]: AppConnection.AWS,
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ type TRotationFactoryImplementation = TRotationFactory<
|
|||||||
const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplementation> = {
|
const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplementation> = {
|
||||||
[SecretRotation.PostgresCredentials]: sqlCredentialsRotationFactory as TRotationFactoryImplementation,
|
[SecretRotation.PostgresCredentials]: sqlCredentialsRotationFactory as TRotationFactoryImplementation,
|
||||||
[SecretRotation.MsSqlCredentials]: sqlCredentialsRotationFactory as TRotationFactoryImplementation,
|
[SecretRotation.MsSqlCredentials]: sqlCredentialsRotationFactory as TRotationFactoryImplementation,
|
||||||
|
[SecretRotation.MySqlCredentials]: sqlCredentialsRotationFactory as TRotationFactoryImplementation,
|
||||||
[SecretRotation.Auth0ClientSecret]: auth0ClientSecretRotationFactory as TRotationFactoryImplementation,
|
[SecretRotation.Auth0ClientSecret]: auth0ClientSecretRotationFactory as TRotationFactoryImplementation,
|
||||||
[SecretRotation.AzureClientSecret]: azureClientSecretRotationFactory as TRotationFactoryImplementation,
|
[SecretRotation.AzureClientSecret]: azureClientSecretRotationFactory as TRotationFactoryImplementation,
|
||||||
[SecretRotation.AwsIamUserSecret]: awsIamUserSecretRotationFactory as TRotationFactoryImplementation,
|
[SecretRotation.AwsIamUserSecret]: awsIamUserSecretRotationFactory as TRotationFactoryImplementation,
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ import {
|
|||||||
TMsSqlCredentialsRotationListItem,
|
TMsSqlCredentialsRotationListItem,
|
||||||
TMsSqlCredentialsRotationWithConnection
|
TMsSqlCredentialsRotationWithConnection
|
||||||
} from "./mssql-credentials";
|
} from "./mssql-credentials";
|
||||||
|
import {
|
||||||
|
TMySqlCredentialsRotation,
|
||||||
|
TMySqlCredentialsRotationInput,
|
||||||
|
TMySqlCredentialsRotationListItem,
|
||||||
|
TMySqlCredentialsRotationWithConnection
|
||||||
|
} from "./mysql-credentials";
|
||||||
import {
|
import {
|
||||||
TPostgresCredentialsRotation,
|
TPostgresCredentialsRotation,
|
||||||
TPostgresCredentialsRotationInput,
|
TPostgresCredentialsRotationInput,
|
||||||
@@ -51,6 +57,7 @@ import { SecretRotation } from "./secret-rotation-v2-enums";
|
|||||||
export type TSecretRotationV2 =
|
export type TSecretRotationV2 =
|
||||||
| TPostgresCredentialsRotation
|
| TPostgresCredentialsRotation
|
||||||
| TMsSqlCredentialsRotation
|
| TMsSqlCredentialsRotation
|
||||||
|
| TMySqlCredentialsRotation
|
||||||
| TAuth0ClientSecretRotation
|
| TAuth0ClientSecretRotation
|
||||||
| TAzureClientSecretRotation
|
| TAzureClientSecretRotation
|
||||||
| TLdapPasswordRotation
|
| TLdapPasswordRotation
|
||||||
@@ -59,6 +66,7 @@ export type TSecretRotationV2 =
|
|||||||
export type TSecretRotationV2WithConnection =
|
export type TSecretRotationV2WithConnection =
|
||||||
| TPostgresCredentialsRotationWithConnection
|
| TPostgresCredentialsRotationWithConnection
|
||||||
| TMsSqlCredentialsRotationWithConnection
|
| TMsSqlCredentialsRotationWithConnection
|
||||||
|
| TMySqlCredentialsRotationWithConnection
|
||||||
| TAuth0ClientSecretRotationWithConnection
|
| TAuth0ClientSecretRotationWithConnection
|
||||||
| TAzureClientSecretRotationWithConnection
|
| TAzureClientSecretRotationWithConnection
|
||||||
| TLdapPasswordRotationWithConnection
|
| TLdapPasswordRotationWithConnection
|
||||||
@@ -74,6 +82,7 @@ export type TSecretRotationV2GeneratedCredentials =
|
|||||||
export type TSecretRotationV2Input =
|
export type TSecretRotationV2Input =
|
||||||
| TPostgresCredentialsRotationInput
|
| TPostgresCredentialsRotationInput
|
||||||
| TMsSqlCredentialsRotationInput
|
| TMsSqlCredentialsRotationInput
|
||||||
|
| TMySqlCredentialsRotationInput
|
||||||
| TAuth0ClientSecretRotationInput
|
| TAuth0ClientSecretRotationInput
|
||||||
| TAzureClientSecretRotationInput
|
| TAzureClientSecretRotationInput
|
||||||
| TLdapPasswordRotationInput
|
| TLdapPasswordRotationInput
|
||||||
@@ -82,6 +91,7 @@ export type TSecretRotationV2Input =
|
|||||||
export type TSecretRotationV2ListItem =
|
export type TSecretRotationV2ListItem =
|
||||||
| TPostgresCredentialsRotationListItem
|
| TPostgresCredentialsRotationListItem
|
||||||
| TMsSqlCredentialsRotationListItem
|
| TMsSqlCredentialsRotationListItem
|
||||||
|
| TMySqlCredentialsRotationListItem
|
||||||
| TAuth0ClientSecretRotationListItem
|
| TAuth0ClientSecretRotationListItem
|
||||||
| TAzureClientSecretRotationListItem
|
| TAzureClientSecretRotationListItem
|
||||||
| TLdapPasswordRotationListItem
|
| TLdapPasswordRotationListItem
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Auth0ClientSecretRotationSchema } from "@app/ee/services/secret-rotatio
|
|||||||
import { AzureClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";
|
import { AzureClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";
|
||||||
import { LdapPasswordRotationSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";
|
import { LdapPasswordRotationSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";
|
||||||
import { MsSqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
import { MsSqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
||||||
|
import { MySqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mysql-credentials";
|
||||||
import { PostgresCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
|
import { PostgresCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
|
||||||
|
|
||||||
import { AwsIamUserSecretRotationSchema } from "./aws-iam-user-secret";
|
import { AwsIamUserSecretRotationSchema } from "./aws-iam-user-secret";
|
||||||
@@ -11,6 +12,7 @@ import { AwsIamUserSecretRotationSchema } from "./aws-iam-user-secret";
|
|||||||
export const SecretRotationV2Schema = z.discriminatedUnion("type", [
|
export const SecretRotationV2Schema = z.discriminatedUnion("type", [
|
||||||
PostgresCredentialsRotationSchema,
|
PostgresCredentialsRotationSchema,
|
||||||
MsSqlCredentialsRotationSchema,
|
MsSqlCredentialsRotationSchema,
|
||||||
|
MySqlCredentialsRotationSchema,
|
||||||
Auth0ClientSecretRotationSchema,
|
Auth0ClientSecretRotationSchema,
|
||||||
AzureClientSecretRotationSchema,
|
AzureClientSecretRotationSchema,
|
||||||
LdapPasswordRotationSchema,
|
LdapPasswordRotationSchema,
|
||||||
|
|||||||
+3
-1
@@ -1,13 +1,15 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { TMsSqlCredentialsRotationWithConnection } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
import { TMsSqlCredentialsRotationWithConnection } from "@app/ee/services/secret-rotation-v2/mssql-credentials";
|
||||||
|
import { TMySqlCredentialsRotationWithConnection } from "@app/ee/services/secret-rotation-v2/mysql-credentials";
|
||||||
import { TPostgresCredentialsRotationWithConnection } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
|
import { TPostgresCredentialsRotationWithConnection } from "@app/ee/services/secret-rotation-v2/postgres-credentials";
|
||||||
|
|
||||||
import { SqlCredentialsRotationGeneratedCredentialsSchema } from "./sql-credentials-rotation-schemas";
|
import { SqlCredentialsRotationGeneratedCredentialsSchema } from "./sql-credentials-rotation-schemas";
|
||||||
|
|
||||||
export type TSqlCredentialsRotationWithConnection =
|
export type TSqlCredentialsRotationWithConnection =
|
||||||
| TPostgresCredentialsRotationWithConnection
|
| TPostgresCredentialsRotationWithConnection
|
||||||
| TMsSqlCredentialsRotationWithConnection;
|
| TMsSqlCredentialsRotationWithConnection
|
||||||
|
| TMySqlCredentialsRotationWithConnection;
|
||||||
|
|
||||||
export type TSqlCredentialsRotationGeneratedCredentials = z.infer<
|
export type TSqlCredentialsRotationGeneratedCredentials = z.infer<
|
||||||
typeof SqlCredentialsRotationGeneratedCredentialsSchema
|
typeof SqlCredentialsRotationGeneratedCredentialsSchema
|
||||||
|
|||||||
+7
@@ -171,6 +171,13 @@ export const getDbSetQuery = (db: TDbProviderClients, variables: { username: str
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (db === TDbProviderClients.MySql) {
|
||||||
|
return {
|
||||||
|
query: `ALTER USER ??@'%' IDENTIFIED BY '${variables.password}'`,
|
||||||
|
variables: [variables.username]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// add more based on client
|
// add more based on client
|
||||||
return {
|
return {
|
||||||
query: `ALTER USER ?? IDENTIFIED BY '${variables.password}'`,
|
query: `ALTER USER ?? IDENTIFIED BY '${variables.password}'`,
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
} from "@app/services/app-connection/humanitec";
|
} from "@app/services/app-connection/humanitec";
|
||||||
import { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";
|
import { LdapConnectionListItemSchema, SanitizedLdapConnectionSchema } from "@app/services/app-connection/ldap";
|
||||||
import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
|
import { MsSqlConnectionListItemSchema, SanitizedMsSqlConnectionSchema } from "@app/services/app-connection/mssql";
|
||||||
|
import { MySqlConnectionListItemSchema, SanitizedMySqlConnectionSchema } from "@app/services/app-connection/mysql";
|
||||||
import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/services/app-connection/oci";
|
import { OCIConnectionListItemSchema, SanitizedOCIConnectionSchema } from "@app/services/app-connection/oci";
|
||||||
import {
|
import {
|
||||||
PostgresConnectionListItemSchema,
|
PostgresConnectionListItemSchema,
|
||||||
@@ -71,6 +72,7 @@ const SanitizedAppConnectionSchema = z.union([
|
|||||||
...SanitizedVercelConnectionSchema.options,
|
...SanitizedVercelConnectionSchema.options,
|
||||||
...SanitizedPostgresConnectionSchema.options,
|
...SanitizedPostgresConnectionSchema.options,
|
||||||
...SanitizedMsSqlConnectionSchema.options,
|
...SanitizedMsSqlConnectionSchema.options,
|
||||||
|
...SanitizedMySqlConnectionSchema.options,
|
||||||
...SanitizedCamundaConnectionSchema.options,
|
...SanitizedCamundaConnectionSchema.options,
|
||||||
...SanitizedAuth0ConnectionSchema.options,
|
...SanitizedAuth0ConnectionSchema.options,
|
||||||
...SanitizedHCVaultConnectionSchema.options,
|
...SanitizedHCVaultConnectionSchema.options,
|
||||||
@@ -93,6 +95,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
|
|||||||
VercelConnectionListItemSchema,
|
VercelConnectionListItemSchema,
|
||||||
PostgresConnectionListItemSchema,
|
PostgresConnectionListItemSchema,
|
||||||
MsSqlConnectionListItemSchema,
|
MsSqlConnectionListItemSchema,
|
||||||
|
MySqlConnectionListItemSchema,
|
||||||
CamundaConnectionListItemSchema,
|
CamundaConnectionListItemSchema,
|
||||||
Auth0ConnectionListItemSchema,
|
Auth0ConnectionListItemSchema,
|
||||||
HCVaultConnectionListItemSchema,
|
HCVaultConnectionListItemSchema,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { registerHCVaultConnectionRouter } from "./hc-vault-connection-router";
|
|||||||
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
|
import { registerHumanitecConnectionRouter } from "./humanitec-connection-router";
|
||||||
import { registerLdapConnectionRouter } from "./ldap-connection-router";
|
import { registerLdapConnectionRouter } from "./ldap-connection-router";
|
||||||
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
|
import { registerMsSqlConnectionRouter } from "./mssql-connection-router";
|
||||||
|
import { registerMySqlConnectionRouter } from "./mysql-connection-router";
|
||||||
import { registerOCIConnectionRouter } from "./oci-connection-router";
|
import { registerOCIConnectionRouter } from "./oci-connection-router";
|
||||||
import { registerPostgresConnectionRouter } from "./postgres-connection-router";
|
import { registerPostgresConnectionRouter } from "./postgres-connection-router";
|
||||||
import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";
|
import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";
|
||||||
@@ -36,6 +37,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
|
|||||||
[AppConnection.Vercel]: registerVercelConnectionRouter,
|
[AppConnection.Vercel]: registerVercelConnectionRouter,
|
||||||
[AppConnection.Postgres]: registerPostgresConnectionRouter,
|
[AppConnection.Postgres]: registerPostgresConnectionRouter,
|
||||||
[AppConnection.MsSql]: registerMsSqlConnectionRouter,
|
[AppConnection.MsSql]: registerMsSqlConnectionRouter,
|
||||||
|
[AppConnection.MySql]: registerMySqlConnectionRouter,
|
||||||
[AppConnection.Camunda]: registerCamundaConnectionRouter,
|
[AppConnection.Camunda]: registerCamundaConnectionRouter,
|
||||||
[AppConnection.Windmill]: registerWindmillConnectionRouter,
|
[AppConnection.Windmill]: registerWindmillConnectionRouter,
|
||||||
[AppConnection.Auth0]: registerAuth0ConnectionRouter,
|
[AppConnection.Auth0]: registerAuth0ConnectionRouter,
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
import {
|
||||||
|
CreateMySqlConnectionSchema,
|
||||||
|
SanitizedMySqlConnectionSchema,
|
||||||
|
UpdateMySqlConnectionSchema
|
||||||
|
} from "@app/services/app-connection/mysql";
|
||||||
|
|
||||||
|
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
||||||
|
|
||||||
|
export const registerMySqlConnectionRouter = async (server: FastifyZodProvider) => {
|
||||||
|
registerAppConnectionEndpoints({
|
||||||
|
app: AppConnection.MySql,
|
||||||
|
server,
|
||||||
|
sanitizedResponseSchema: SanitizedMySqlConnectionSchema,
|
||||||
|
createSchema: CreateMySqlConnectionSchema,
|
||||||
|
updateSchema: UpdateMySqlConnectionSchema
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -53,6 +53,8 @@ import {
|
|||||||
} from "./humanitec";
|
} from "./humanitec";
|
||||||
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
|
import { getLdapConnectionListItem, LdapConnectionMethod, validateLdapConnectionCredentials } from "./ldap";
|
||||||
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
|
import { getMsSqlConnectionListItem, MsSqlConnectionMethod } from "./mssql";
|
||||||
|
import { MySqlConnectionMethod } from "./mysql/mysql-connection-enums";
|
||||||
|
import { getMySqlConnectionListItem } from "./mysql/mysql-connection-fns";
|
||||||
import { getOCIConnectionListItem, OCIConnectionMethod, validateOCIConnectionCredentials } from "./oci";
|
import { getOCIConnectionListItem, OCIConnectionMethod, validateOCIConnectionCredentials } from "./oci";
|
||||||
import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";
|
import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";
|
||||||
import {
|
import {
|
||||||
@@ -86,6 +88,7 @@ export const listAppConnectionOptions = () => {
|
|||||||
getVercelConnectionListItem(),
|
getVercelConnectionListItem(),
|
||||||
getPostgresConnectionListItem(),
|
getPostgresConnectionListItem(),
|
||||||
getMsSqlConnectionListItem(),
|
getMsSqlConnectionListItem(),
|
||||||
|
getMySqlConnectionListItem(),
|
||||||
getCamundaConnectionListItem(),
|
getCamundaConnectionListItem(),
|
||||||
getAzureClientSecretsConnectionListItem(),
|
getAzureClientSecretsConnectionListItem(),
|
||||||
getWindmillConnectionListItem(),
|
getWindmillConnectionListItem(),
|
||||||
@@ -155,6 +158,7 @@ export const validateAppConnectionCredentials = async (
|
|||||||
[AppConnection.Humanitec]: validateHumanitecConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Humanitec]: validateHumanitecConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Postgres]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Postgres]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.MsSql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.MsSql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
|
[AppConnection.MySql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Camunda]: validateCamundaConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Camunda]: validateCamundaConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.Vercel]: validateVercelConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.Vercel]: validateVercelConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
[AppConnection.TerraformCloud]: validateTerraformCloudConnectionCredentials as TAppConnectionCredentialsValidator,
|
[AppConnection.TerraformCloud]: validateTerraformCloudConnectionCredentials as TAppConnectionCredentialsValidator,
|
||||||
@@ -195,6 +199,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
|
|||||||
return "API Token";
|
return "API Token";
|
||||||
case PostgresConnectionMethod.UsernameAndPassword:
|
case PostgresConnectionMethod.UsernameAndPassword:
|
||||||
case MsSqlConnectionMethod.UsernameAndPassword:
|
case MsSqlConnectionMethod.UsernameAndPassword:
|
||||||
|
case MySqlConnectionMethod.UsernameAndPassword:
|
||||||
return "Username & Password";
|
return "Username & Password";
|
||||||
case WindmillConnectionMethod.AccessToken:
|
case WindmillConnectionMethod.AccessToken:
|
||||||
case HCVaultConnectionMethod.AccessToken:
|
case HCVaultConnectionMethod.AccessToken:
|
||||||
@@ -246,6 +251,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
|
|||||||
[AppConnection.Humanitec]: platformManagedCredentialsNotSupported,
|
[AppConnection.Humanitec]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Postgres]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
[AppConnection.Postgres]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
||||||
[AppConnection.MsSql]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
[AppConnection.MsSql]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
||||||
|
[AppConnection.MySql]: transferSqlConnectionCredentialsToPlatform as TAppConnectionTransitionCredentialsToPlatform,
|
||||||
[AppConnection.TerraformCloud]: platformManagedCredentialsNotSupported,
|
[AppConnection.TerraformCloud]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Camunda]: platformManagedCredentialsNotSupported,
|
[AppConnection.Camunda]: platformManagedCredentialsNotSupported,
|
||||||
[AppConnection.Vercel]: platformManagedCredentialsNotSupported,
|
[AppConnection.Vercel]: platformManagedCredentialsNotSupported,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
|
|||||||
[AppConnection.Vercel]: "Vercel",
|
[AppConnection.Vercel]: "Vercel",
|
||||||
[AppConnection.Postgres]: "PostgreSQL",
|
[AppConnection.Postgres]: "PostgreSQL",
|
||||||
[AppConnection.MsSql]: "Microsoft SQL Server",
|
[AppConnection.MsSql]: "Microsoft SQL Server",
|
||||||
|
[AppConnection.MySql]: "MySQL",
|
||||||
[AppConnection.Camunda]: "Camunda",
|
[AppConnection.Camunda]: "Camunda",
|
||||||
[AppConnection.Windmill]: "Windmill",
|
[AppConnection.Windmill]: "Windmill",
|
||||||
[AppConnection.Auth0]: "Auth0",
|
[AppConnection.Auth0]: "Auth0",
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import { ValidateHumanitecConnectionCredentialsSchema } from "./humanitec";
|
|||||||
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
|
import { humanitecConnectionService } from "./humanitec/humanitec-connection-service";
|
||||||
import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
|
import { ValidateLdapConnectionCredentialsSchema } from "./ldap";
|
||||||
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
import { ValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
||||||
|
import { ValidateMySqlConnectionCredentialsSchema } from "./mysql";
|
||||||
import { ValidateOCIConnectionCredentialsSchema } from "./oci";
|
import { ValidateOCIConnectionCredentialsSchema } from "./oci";
|
||||||
import { ociConnectionService } from "./oci/oci-connection-service";
|
import { ociConnectionService } from "./oci/oci-connection-service";
|
||||||
import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";
|
import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";
|
||||||
@@ -81,6 +82,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
|
|||||||
[AppConnection.Vercel]: ValidateVercelConnectionCredentialsSchema,
|
[AppConnection.Vercel]: ValidateVercelConnectionCredentialsSchema,
|
||||||
[AppConnection.Postgres]: ValidatePostgresConnectionCredentialsSchema,
|
[AppConnection.Postgres]: ValidatePostgresConnectionCredentialsSchema,
|
||||||
[AppConnection.MsSql]: ValidateMsSqlConnectionCredentialsSchema,
|
[AppConnection.MsSql]: ValidateMsSqlConnectionCredentialsSchema,
|
||||||
|
[AppConnection.MySql]: ValidateMySqlConnectionCredentialsSchema,
|
||||||
[AppConnection.Camunda]: ValidateCamundaConnectionCredentialsSchema,
|
[AppConnection.Camunda]: ValidateCamundaConnectionCredentialsSchema,
|
||||||
[AppConnection.AzureClientSecrets]: ValidateAzureClientSecretsConnectionCredentialsSchema,
|
[AppConnection.AzureClientSecrets]: ValidateAzureClientSecretsConnectionCredentialsSchema,
|
||||||
[AppConnection.Windmill]: ValidateWindmillConnectionCredentialsSchema,
|
[AppConnection.Windmill]: ValidateWindmillConnectionCredentialsSchema,
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ import {
|
|||||||
TValidateLdapConnectionCredentialsSchema
|
TValidateLdapConnectionCredentialsSchema
|
||||||
} from "./ldap";
|
} from "./ldap";
|
||||||
import { TMsSqlConnection, TMsSqlConnectionInput, TValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
import { TMsSqlConnection, TMsSqlConnectionInput, TValidateMsSqlConnectionCredentialsSchema } from "./mssql";
|
||||||
|
import { TMySqlConnection, TMySqlConnectionInput, TValidateMySqlConnectionCredentialsSchema } from "./mysql";
|
||||||
import {
|
import {
|
||||||
TOCIConnection,
|
TOCIConnection,
|
||||||
TOCIConnectionConfig,
|
TOCIConnectionConfig,
|
||||||
@@ -124,6 +125,7 @@ export type TAppConnection = { id: string } & (
|
|||||||
| TVercelConnection
|
| TVercelConnection
|
||||||
| TPostgresConnection
|
| TPostgresConnection
|
||||||
| TMsSqlConnection
|
| TMsSqlConnection
|
||||||
|
| TMySqlConnection
|
||||||
| TCamundaConnection
|
| TCamundaConnection
|
||||||
| TAzureClientSecretsConnection
|
| TAzureClientSecretsConnection
|
||||||
| TWindmillConnection
|
| TWindmillConnection
|
||||||
@@ -136,7 +138,7 @@ export type TAppConnection = { id: string } & (
|
|||||||
|
|
||||||
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
|
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
|
||||||
|
|
||||||
export type TSqlConnection = TPostgresConnection | TMsSqlConnection;
|
export type TSqlConnection = TPostgresConnection | TMsSqlConnection | TMySqlConnection;
|
||||||
|
|
||||||
export type TAppConnectionInput = { id: string } & (
|
export type TAppConnectionInput = { id: string } & (
|
||||||
| TAwsConnectionInput
|
| TAwsConnectionInput
|
||||||
@@ -150,6 +152,7 @@ export type TAppConnectionInput = { id: string } & (
|
|||||||
| TVercelConnectionInput
|
| TVercelConnectionInput
|
||||||
| TPostgresConnectionInput
|
| TPostgresConnectionInput
|
||||||
| TMsSqlConnectionInput
|
| TMsSqlConnectionInput
|
||||||
|
| TMySqlConnectionInput
|
||||||
| TCamundaConnectionInput
|
| TCamundaConnectionInput
|
||||||
| TAzureClientSecretsConnectionInput
|
| TAzureClientSecretsConnectionInput
|
||||||
| TWindmillConnectionInput
|
| TWindmillConnectionInput
|
||||||
@@ -160,7 +163,7 @@ export type TAppConnectionInput = { id: string } & (
|
|||||||
| TOCIConnectionInput
|
| TOCIConnectionInput
|
||||||
);
|
);
|
||||||
|
|
||||||
export type TSqlConnectionInput = TPostgresConnectionInput | TMsSqlConnectionInput;
|
export type TSqlConnectionInput = TPostgresConnectionInput | TMsSqlConnectionInput | TMySqlConnectionInput;
|
||||||
|
|
||||||
export type TCreateAppConnectionDTO = Pick<
|
export type TCreateAppConnectionDTO = Pick<
|
||||||
TAppConnectionInput,
|
TAppConnectionInput,
|
||||||
@@ -202,6 +205,7 @@ export type TValidateAppConnectionCredentialsSchema =
|
|||||||
| TValidateHumanitecConnectionCredentialsSchema
|
| TValidateHumanitecConnectionCredentialsSchema
|
||||||
| TValidatePostgresConnectionCredentialsSchema
|
| TValidatePostgresConnectionCredentialsSchema
|
||||||
| TValidateMsSqlConnectionCredentialsSchema
|
| TValidateMsSqlConnectionCredentialsSchema
|
||||||
|
| TValidateMySqlConnectionCredentialsSchema
|
||||||
| TValidateCamundaConnectionCredentialsSchema
|
| TValidateCamundaConnectionCredentialsSchema
|
||||||
| TValidateVercelConnectionCredentialsSchema
|
| TValidateVercelConnectionCredentialsSchema
|
||||||
| TValidateTerraformCloudConnectionCredentialsSchema
|
| TValidateTerraformCloudConnectionCredentialsSchema
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export * from "./postgres-connection-enums";
|
export * from "./mysql-connection-enums";
|
||||||
export * from "./postgres-connection-fns";
|
export * from "./mysql-connection-fns";
|
||||||
export * from "./postgres-connection-schemas";
|
export * from "./mysql-connection-schemas";
|
||||||
export * from "./postgres-connection-types";
|
export * from "./mysql-connection-types";
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ const EXTERNAL_REQUEST_TIMEOUT = 10 * 1000;
|
|||||||
|
|
||||||
const SQL_CONNECTION_CLIENT_MAP = {
|
const SQL_CONNECTION_CLIENT_MAP = {
|
||||||
[AppConnection.Postgres]: "pg",
|
[AppConnection.Postgres]: "pg",
|
||||||
[AppConnection.MsSql]: "mssql"
|
[AppConnection.MsSql]: "mssql",
|
||||||
|
[AppConnection.MySql]: "mysql2"
|
||||||
};
|
};
|
||||||
|
|
||||||
const getConnectionConfig = ({
|
const getConnectionConfig = ({
|
||||||
@@ -45,6 +46,17 @@ const getConnectionConfig = ({
|
|||||||
: { encrypt: false }
|
: { encrypt: false }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
case AppConnection.MySql: {
|
||||||
|
return {
|
||||||
|
ssl: sslEnabled
|
||||||
|
? {
|
||||||
|
rejectUnauthorized: sslRejectUnauthorized,
|
||||||
|
ca: sslCertificate,
|
||||||
|
servername: host
|
||||||
|
}
|
||||||
|
: false
|
||||||
|
};
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unhandled SQL Connection Config: ${app as AppConnection}`);
|
throw new Error(`Unhandled SQL Connection Config: ${app as AppConnection}`);
|
||||||
}
|
}
|
||||||
@@ -101,7 +113,8 @@ export const SQL_CONNECTION_ALTER_LOGIN_STATEMENT: Record<
|
|||||||
(credentials: TSqlCredentialsRotationGeneratedCredentials[number]) => [string, Knex.RawBinding]
|
(credentials: TSqlCredentialsRotationGeneratedCredentials[number]) => [string, Knex.RawBinding]
|
||||||
> = {
|
> = {
|
||||||
[AppConnection.Postgres]: ({ username, password }) => [`ALTER USER ?? WITH PASSWORD '${password}';`, [username]],
|
[AppConnection.Postgres]: ({ username, password }) => [`ALTER USER ?? WITH PASSWORD '${password}';`, [username]],
|
||||||
[AppConnection.MsSql]: ({ username, password }) => [`ALTER LOGIN ?? WITH PASSWORD = '${password}';`, [username]]
|
[AppConnection.MsSql]: ({ username, password }) => [`ALTER LOGIN ?? WITH PASSWORD = '${password}';`, [username]],
|
||||||
|
[AppConnection.MySql]: ({ username, password }) => [`ALTER USER ??@'%' IDENTIFIED BY '${password}';`, [username]]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const transferSqlConnectionCredentialsToPlatform = async (
|
export const transferSqlConnectionCredentialsToPlatform = async (
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import { SqlCredentialsRotationParametersFields } from "./shared";
|
|||||||
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
||||||
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationParametersFields,
|
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationParametersFields,
|
||||||
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationParametersFields,
|
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationParametersFields,
|
||||||
|
[SecretRotation.MySqlCredentials]: SqlCredentialsRotationParametersFields,
|
||||||
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationParametersFields,
|
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationParametersFields,
|
||||||
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationParametersFields,
|
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationParametersFields,
|
||||||
[SecretRotation.LdapPassword]: LdapPasswordRotationParametersFields,
|
[SecretRotation.LdapPassword]: LdapPasswordRotationParametersFields,
|
||||||
|
|||||||
+1
@@ -15,6 +15,7 @@ import { SqlCredentialsRotationReviewFields } from "./shared";
|
|||||||
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
||||||
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationReviewFields,
|
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationReviewFields,
|
||||||
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationReviewFields,
|
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationReviewFields,
|
||||||
|
[SecretRotation.MySqlCredentials]: SqlCredentialsRotationReviewFields,
|
||||||
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationReviewFields,
|
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationReviewFields,
|
||||||
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationReviewFields,
|
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationReviewFields,
|
||||||
[SecretRotation.LdapPassword]: LdapPasswordRotationReviewFields,
|
[SecretRotation.LdapPassword]: LdapPasswordRotationReviewFields,
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import { SqlCredentialsRotationSecretsMappingFields } from "./shared";
|
|||||||
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
|
||||||
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationSecretsMappingFields,
|
[SecretRotation.PostgresCredentials]: SqlCredentialsRotationSecretsMappingFields,
|
||||||
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationSecretsMappingFields,
|
[SecretRotation.MsSqlCredentials]: SqlCredentialsRotationSecretsMappingFields,
|
||||||
|
[SecretRotation.MySqlCredentials]: SqlCredentialsRotationSecretsMappingFields,
|
||||||
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationSecretsMappingFields,
|
[SecretRotation.Auth0ClientSecret]: Auth0ClientSecretRotationSecretsMappingFields,
|
||||||
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationSecretsMappingFields,
|
[SecretRotation.AzureClientSecret]: AzureClientSecretRotationSecretsMappingFields,
|
||||||
[SecretRotation.LdapPassword]: LdapPasswordRotationSecretsMappingFields,
|
[SecretRotation.LdapPassword]: LdapPasswordRotationSecretsMappingFields,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { AwsIamUserSecretRotationSchema } from "@app/components/secret-rotations
|
|||||||
import { AzureClientSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/azure-client-secret-rotation-schema";
|
import { AzureClientSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/azure-client-secret-rotation-schema";
|
||||||
import { LdapPasswordRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/ldap-password-rotation-schema";
|
import { LdapPasswordRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/ldap-password-rotation-schema";
|
||||||
import { MsSqlCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/mssql-credentials-rotation-schema";
|
import { MsSqlCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/mssql-credentials-rotation-schema";
|
||||||
|
import { MySqlCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/mysql-credentials-rotation-schema";
|
||||||
import { PostgresCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/postgres-credentials-rotation-schema";
|
import { PostgresCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/postgres-credentials-rotation-schema";
|
||||||
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
|
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
|
||||||
import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/types/ldap-password-rotation";
|
import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/types/ldap-password-rotation";
|
||||||
@@ -17,6 +18,7 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
|
|||||||
AzureClientSecretRotationSchema,
|
AzureClientSecretRotationSchema,
|
||||||
PostgresCredentialsRotationSchema,
|
PostgresCredentialsRotationSchema,
|
||||||
MsSqlCredentialsRotationSchema,
|
MsSqlCredentialsRotationSchema,
|
||||||
|
MySqlCredentialsRotationSchema,
|
||||||
LdapPasswordRotationSchema,
|
LdapPasswordRotationSchema,
|
||||||
AwsIamUserSecretRotationSchema
|
AwsIamUserSecretRotationSchema
|
||||||
]),
|
]),
|
||||||
|
|||||||
+12
@@ -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 MySqlCredentialsRotationSchema = z
|
||||||
|
.object({
|
||||||
|
type: z.literal(SecretRotation.MySqlCredentials)
|
||||||
|
})
|
||||||
|
.merge(SqlCredentialsRotationSchema)
|
||||||
|
.merge(BaseSecretRotationSchema);
|
||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
HumanitecConnectionMethod,
|
HumanitecConnectionMethod,
|
||||||
LdapConnectionMethod,
|
LdapConnectionMethod,
|
||||||
MsSqlConnectionMethod,
|
MsSqlConnectionMethod,
|
||||||
|
MySqlConnectionMethod,
|
||||||
PostgresConnectionMethod,
|
PostgresConnectionMethod,
|
||||||
TAppConnection,
|
TAppConnection,
|
||||||
TeamCityConnectionMethod,
|
TeamCityConnectionMethod,
|
||||||
@@ -57,6 +58,7 @@ export const APP_CONNECTION_MAP: Record<
|
|||||||
[AppConnection.Vercel]: { name: "Vercel", image: "Vercel.png" },
|
[AppConnection.Vercel]: { name: "Vercel", image: "Vercel.png" },
|
||||||
[AppConnection.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
|
[AppConnection.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
|
||||||
[AppConnection.MsSql]: { name: "Microsoft SQL Server", image: "MsSql.png" },
|
[AppConnection.MsSql]: { name: "Microsoft SQL Server", image: "MsSql.png" },
|
||||||
|
[AppConnection.MySql]: { name: "MySQL", image: "MySql.png" },
|
||||||
[AppConnection.Camunda]: { name: "Camunda", image: "Camunda.png" },
|
[AppConnection.Camunda]: { name: "Camunda", image: "Camunda.png" },
|
||||||
[AppConnection.Windmill]: { name: "Windmill", image: "Windmill.png" },
|
[AppConnection.Windmill]: { name: "Windmill", image: "Windmill.png" },
|
||||||
[AppConnection.Auth0]: { name: "Auth0", image: "Auth0.png", size: 40 },
|
[AppConnection.Auth0]: { name: "Auth0", image: "Auth0.png", size: 40 },
|
||||||
@@ -92,6 +94,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
|
|||||||
return { name: "API Token", icon: faKey };
|
return { name: "API Token", icon: faKey };
|
||||||
case PostgresConnectionMethod.UsernameAndPassword:
|
case PostgresConnectionMethod.UsernameAndPassword:
|
||||||
case MsSqlConnectionMethod.UsernameAndPassword:
|
case MsSqlConnectionMethod.UsernameAndPassword:
|
||||||
|
case MySqlConnectionMethod.UsernameAndPassword:
|
||||||
return { name: "Username & Password", icon: faLock };
|
return { name: "Username & Password", icon: faLock };
|
||||||
case HCVaultConnectionMethod.AccessToken:
|
case HCVaultConnectionMethod.AccessToken:
|
||||||
case TeamCityConnectionMethod.AccessToken:
|
case TeamCityConnectionMethod.AccessToken:
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const SECRET_ROTATION_MAP: Record<
|
|||||||
image: "MsSql.png",
|
image: "MsSql.png",
|
||||||
size: 50
|
size: 50
|
||||||
},
|
},
|
||||||
|
[SecretRotation.MySqlCredentials]: {
|
||||||
|
name: "MySQL Credentials",
|
||||||
|
image: "MySql.png",
|
||||||
|
size: 50
|
||||||
|
},
|
||||||
[SecretRotation.Auth0ClientSecret]: {
|
[SecretRotation.Auth0ClientSecret]: {
|
||||||
name: "Auth0 Client Secret",
|
name: "Auth0 Client Secret",
|
||||||
image: "Auth0.png",
|
image: "Auth0.png",
|
||||||
@@ -40,6 +45,7 @@ export const SECRET_ROTATION_MAP: Record<
|
|||||||
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
|
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
|
||||||
[SecretRotation.PostgresCredentials]: AppConnection.Postgres,
|
[SecretRotation.PostgresCredentials]: AppConnection.Postgres,
|
||||||
[SecretRotation.MsSqlCredentials]: AppConnection.MsSql,
|
[SecretRotation.MsSqlCredentials]: AppConnection.MsSql,
|
||||||
|
[SecretRotation.MySqlCredentials]: AppConnection.MySql,
|
||||||
[SecretRotation.Auth0ClientSecret]: AppConnection.Auth0,
|
[SecretRotation.Auth0ClientSecret]: AppConnection.Auth0,
|
||||||
[SecretRotation.AzureClientSecret]: AppConnection.AzureClientSecrets,
|
[SecretRotation.AzureClientSecret]: AppConnection.AzureClientSecrets,
|
||||||
[SecretRotation.LdapPassword]: AppConnection.LDAP,
|
[SecretRotation.LdapPassword]: AppConnection.LDAP,
|
||||||
@@ -50,6 +56,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
|
|||||||
export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
|
export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
|
||||||
[SecretRotation.PostgresCredentials]: true,
|
[SecretRotation.PostgresCredentials]: true,
|
||||||
[SecretRotation.MsSqlCredentials]: true,
|
[SecretRotation.MsSqlCredentials]: true,
|
||||||
|
[SecretRotation.MySqlCredentials]: true,
|
||||||
[SecretRotation.Auth0ClientSecret]: false,
|
[SecretRotation.Auth0ClientSecret]: false,
|
||||||
[SecretRotation.AzureClientSecret]: true,
|
[SecretRotation.AzureClientSecret]: true,
|
||||||
[SecretRotation.LdapPassword]: false,
|
[SecretRotation.LdapPassword]: false,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export enum AppConnection {
|
|||||||
Vercel = "vercel",
|
Vercel = "vercel",
|
||||||
Postgres = "postgres",
|
Postgres = "postgres",
|
||||||
MsSql = "mssql",
|
MsSql = "mssql",
|
||||||
|
MySql = "mysql",
|
||||||
Camunda = "camunda",
|
Camunda = "camunda",
|
||||||
Windmill = "windmill",
|
Windmill = "windmill",
|
||||||
Auth0 = "auth0",
|
Auth0 = "auth0",
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ export type TMsSqlConnectionOption = TAppConnectionOptionBase & {
|
|||||||
app: AppConnection.MsSql;
|
app: AppConnection.MsSql;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TMySqlConnectionOption = TAppConnectionOptionBase & {
|
||||||
|
app: AppConnection.MySql;
|
||||||
|
};
|
||||||
|
|
||||||
export type TCamundaConnectionOption = TAppConnectionOptionBase & {
|
export type TCamundaConnectionOption = TAppConnectionOptionBase & {
|
||||||
app: AppConnection.Camunda;
|
app: AppConnection.Camunda;
|
||||||
};
|
};
|
||||||
@@ -101,6 +105,7 @@ export type TAppConnectionOption =
|
|||||||
| TVercelConnectionOption
|
| TVercelConnectionOption
|
||||||
| TPostgresConnectionOption
|
| TPostgresConnectionOption
|
||||||
| TMsSqlConnectionOption
|
| TMsSqlConnectionOption
|
||||||
|
| TMySqlConnectionOption
|
||||||
| TCamundaConnectionOption
|
| TCamundaConnectionOption
|
||||||
| TWindmillConnectionOption
|
| TWindmillConnectionOption
|
||||||
| TAuth0ConnectionOption
|
| TAuth0ConnectionOption
|
||||||
@@ -121,6 +126,7 @@ export type TAppConnectionOptionMap = {
|
|||||||
[AppConnection.Vercel]: TVercelConnectionOption;
|
[AppConnection.Vercel]: TVercelConnectionOption;
|
||||||
[AppConnection.Postgres]: TPostgresConnectionOption;
|
[AppConnection.Postgres]: TPostgresConnectionOption;
|
||||||
[AppConnection.MsSql]: TMsSqlConnectionOption;
|
[AppConnection.MsSql]: TMsSqlConnectionOption;
|
||||||
|
[AppConnection.MySql]: TMySqlConnectionOption;
|
||||||
[AppConnection.Camunda]: TCamundaConnectionOption;
|
[AppConnection.Camunda]: TCamundaConnectionOption;
|
||||||
[AppConnection.Windmill]: TWindmillConnectionOption;
|
[AppConnection.Windmill]: TWindmillConnectionOption;
|
||||||
[AppConnection.Auth0]: TAuth0ConnectionOption;
|
[AppConnection.Auth0]: TAuth0ConnectionOption;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { THCVaultConnection } from "./hc-vault-connection";
|
|||||||
import { THumanitecConnection } from "./humanitec-connection";
|
import { THumanitecConnection } from "./humanitec-connection";
|
||||||
import { TLdapConnection } from "./ldap-connection";
|
import { TLdapConnection } from "./ldap-connection";
|
||||||
import { TMsSqlConnection } from "./mssql-connection";
|
import { TMsSqlConnection } from "./mssql-connection";
|
||||||
|
import { TMySqlConnection } from "./mysql-connection";
|
||||||
import { TOCIConnection } from "./oci-connection";
|
import { TOCIConnection } from "./oci-connection";
|
||||||
import { TPostgresConnection } from "./postgres-connection";
|
import { TPostgresConnection } from "./postgres-connection";
|
||||||
import { TTeamCityConnection } from "./teamcity-connection";
|
import { TTeamCityConnection } from "./teamcity-connection";
|
||||||
@@ -33,6 +34,7 @@ export * from "./hc-vault-connection";
|
|||||||
export * from "./humanitec-connection";
|
export * from "./humanitec-connection";
|
||||||
export * from "./ldap-connection";
|
export * from "./ldap-connection";
|
||||||
export * from "./mssql-connection";
|
export * from "./mssql-connection";
|
||||||
|
export * from "./mysql-connection";
|
||||||
export * from "./oci-connection";
|
export * from "./oci-connection";
|
||||||
export * from "./postgres-connection";
|
export * from "./postgres-connection";
|
||||||
export * from "./teamcity-connection";
|
export * from "./teamcity-connection";
|
||||||
@@ -53,6 +55,7 @@ export type TAppConnection =
|
|||||||
| TVercelConnection
|
| TVercelConnection
|
||||||
| TPostgresConnection
|
| TPostgresConnection
|
||||||
| TMsSqlConnection
|
| TMsSqlConnection
|
||||||
|
| TMySqlConnection
|
||||||
| TCamundaConnection
|
| TCamundaConnection
|
||||||
| TWindmillConnection
|
| TWindmillConnection
|
||||||
| TAuth0Connection
|
| TAuth0Connection
|
||||||
@@ -99,6 +102,7 @@ export type TAppConnectionMap = {
|
|||||||
[AppConnection.Vercel]: TVercelConnection;
|
[AppConnection.Vercel]: TVercelConnection;
|
||||||
[AppConnection.Postgres]: TPostgresConnection;
|
[AppConnection.Postgres]: TPostgresConnection;
|
||||||
[AppConnection.MsSql]: TMsSqlConnection;
|
[AppConnection.MsSql]: TMsSqlConnection;
|
||||||
|
[AppConnection.MySql]: TMySqlConnection;
|
||||||
[AppConnection.Camunda]: TCamundaConnection;
|
[AppConnection.Camunda]: TCamundaConnection;
|
||||||
[AppConnection.Windmill]: TWindmillConnection;
|
[AppConnection.Windmill]: TWindmillConnection;
|
||||||
[AppConnection.Auth0]: TAuth0Connection;
|
[AppConnection.Auth0]: TAuth0Connection;
|
||||||
|
|||||||
@@ -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 MySqlConnectionMethod {
|
||||||
|
UsernameAndPassword = "username-and-password"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TMySqlConnection = TRootAppConnection & { app: AppConnection.MySql } & {
|
||||||
|
method: MySqlConnectionMethod.UsernameAndPassword;
|
||||||
|
credentials: TBaseSqlConnectionCredentials;
|
||||||
|
};
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
export enum SecretRotation {
|
export enum SecretRotation {
|
||||||
PostgresCredentials = "postgres-credentials",
|
PostgresCredentials = "postgres-credentials",
|
||||||
MsSqlCredentials = "mssql-credentials",
|
MsSqlCredentials = "mssql-credentials",
|
||||||
|
MySqlCredentials = "mysql-credentials",
|
||||||
Auth0ClientSecret = "auth0-client-secret",
|
Auth0ClientSecret = "auth0-client-secret",
|
||||||
AzureClientSecret = "azure-client-secret",
|
AzureClientSecret = "azure-client-secret",
|
||||||
LdapPassword = "ldap-password",
|
LdapPassword = "ldap-password",
|
||||||
|
|||||||
@@ -31,9 +31,15 @@ import { TSqlCredentialsRotationOption } from "@app/hooks/api/secretRotationsV2/
|
|||||||
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";
|
||||||
import { DiscriminativePick } from "@app/types";
|
import { DiscriminativePick } from "@app/types";
|
||||||
|
|
||||||
|
import {
|
||||||
|
TMySqlCredentialsRotation,
|
||||||
|
TMySqlCredentialsRotationGeneratedCredentialsResponse
|
||||||
|
} from "./mysql-credentials-rotation";
|
||||||
|
|
||||||
export type TSecretRotationV2 = (
|
export type TSecretRotationV2 = (
|
||||||
| TPostgresCredentialsRotation
|
| TPostgresCredentialsRotation
|
||||||
| TMsSqlCredentialsRotation
|
| TMsSqlCredentialsRotation
|
||||||
|
| TMySqlCredentialsRotation
|
||||||
| TAuth0ClientSecretRotation
|
| TAuth0ClientSecretRotation
|
||||||
| TAzureClientSecretRotation
|
| TAzureClientSecretRotation
|
||||||
| TLdapPasswordRotation
|
| TLdapPasswordRotation
|
||||||
@@ -56,6 +62,7 @@ export type TSecretRotationV2Response = { secretRotation: TSecretRotationV2 };
|
|||||||
export type TViewSecretRotationGeneratedCredentialsResponse =
|
export type TViewSecretRotationGeneratedCredentialsResponse =
|
||||||
| TPostgresCredentialsRotationGeneratedCredentialsResponse
|
| TPostgresCredentialsRotationGeneratedCredentialsResponse
|
||||||
| TMsSqlCredentialsRotationGeneratedCredentialsResponse
|
| TMsSqlCredentialsRotationGeneratedCredentialsResponse
|
||||||
|
| TMySqlCredentialsRotationGeneratedCredentialsResponse
|
||||||
| TAuth0ClientSecretRotationGeneratedCredentialsResponse
|
| TAuth0ClientSecretRotationGeneratedCredentialsResponse
|
||||||
| TAzureClientSecretRotationGeneratedCredentialsResponse
|
| TAzureClientSecretRotationGeneratedCredentialsResponse
|
||||||
| TLdapPasswordRotationGeneratedCredentialsResponse
|
| TLdapPasswordRotationGeneratedCredentialsResponse
|
||||||
@@ -105,6 +112,7 @@ export type TViewSecretRotationV2GeneratedCredentialsDTO = {
|
|||||||
export type TSecretRotationOptionMap = {
|
export type TSecretRotationOptionMap = {
|
||||||
[SecretRotation.PostgresCredentials]: TSqlCredentialsRotationOption;
|
[SecretRotation.PostgresCredentials]: TSqlCredentialsRotationOption;
|
||||||
[SecretRotation.MsSqlCredentials]: TSqlCredentialsRotationOption;
|
[SecretRotation.MsSqlCredentials]: TSqlCredentialsRotationOption;
|
||||||
|
[SecretRotation.MySqlCredentials]: TSqlCredentialsRotationOption;
|
||||||
[SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationOption;
|
[SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationOption;
|
||||||
[SecretRotation.AzureClientSecret]: TAzureClientSecretRotationOption;
|
[SecretRotation.AzureClientSecret]: TAzureClientSecretRotationOption;
|
||||||
[SecretRotation.LdapPassword]: TLdapPasswordRotationOption;
|
[SecretRotation.LdapPassword]: TLdapPasswordRotationOption;
|
||||||
@@ -114,6 +122,7 @@ export type TSecretRotationOptionMap = {
|
|||||||
export type TSecretRotationGeneratedCredentialsResponseMap = {
|
export type TSecretRotationGeneratedCredentialsResponseMap = {
|
||||||
[SecretRotation.PostgresCredentials]: TPostgresCredentialsRotationGeneratedCredentialsResponse;
|
[SecretRotation.PostgresCredentials]: TPostgresCredentialsRotationGeneratedCredentialsResponse;
|
||||||
[SecretRotation.MsSqlCredentials]: TMsSqlCredentialsRotationGeneratedCredentialsResponse;
|
[SecretRotation.MsSqlCredentials]: TMsSqlCredentialsRotationGeneratedCredentialsResponse;
|
||||||
|
[SecretRotation.MySqlCredentials]: TMySqlCredentialsRotationGeneratedCredentialsResponse;
|
||||||
[SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationGeneratedCredentialsResponse;
|
[SecretRotation.Auth0ClientSecret]: TAuth0ClientSecretRotationGeneratedCredentialsResponse;
|
||||||
[SecretRotation.AzureClientSecret]: TAzureClientSecretRotationGeneratedCredentialsResponse;
|
[SecretRotation.AzureClientSecret]: TAzureClientSecretRotationGeneratedCredentialsResponse;
|
||||||
[SecretRotation.LdapPassword]: TLdapPasswordRotationGeneratedCredentialsResponse;
|
[SecretRotation.LdapPassword]: TLdapPasswordRotationGeneratedCredentialsResponse;
|
||||||
|
|||||||
@@ -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 TMySqlCredentialsRotation = TSecretRotationV2Base & {
|
||||||
|
type: SecretRotation.MySqlCredentials;
|
||||||
|
} & TSqlCredentialsRotationProperties;
|
||||||
|
|
||||||
|
export type TMySqlCredentialsRotationGeneratedCredentialsResponse =
|
||||||
|
TSecretRotationV2GeneratedCredentialsResponseBase<
|
||||||
|
SecretRotation.MySqlCredentials,
|
||||||
|
TSqlCredentialsRotationGeneratedCredentials
|
||||||
|
>;
|
||||||
@@ -14,8 +14,11 @@ export type TSqlCredentialsRotationProperties = {
|
|||||||
|
|
||||||
export type TSqlCredentialsRotationOption = {
|
export type TSqlCredentialsRotationOption = {
|
||||||
name: string;
|
name: string;
|
||||||
type: SecretRotation.PostgresCredentials | SecretRotation.MsSqlCredentials;
|
type:
|
||||||
connection: AppConnection.Postgres | AppConnection.MsSql;
|
| SecretRotation.PostgresCredentials
|
||||||
|
| SecretRotation.MsSqlCredentials
|
||||||
|
| SecretRotation.MySqlCredentials;
|
||||||
|
connection: AppConnection.Postgres | AppConnection.MsSql | AppConnection.MySql;
|
||||||
template: {
|
template: {
|
||||||
secretsMapping: TSqlCredentialsRotationProperties["secretsMapping"];
|
secretsMapping: TSqlCredentialsRotationProperties["secretsMapping"];
|
||||||
createUserStatement: string;
|
createUserStatement: string;
|
||||||
|
|||||||
+5
@@ -22,6 +22,7 @@ import { HCVaultConnectionForm } from "./HCVaultConnectionForm";
|
|||||||
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
|
import { HumanitecConnectionForm } from "./HumanitecConnectionForm";
|
||||||
import { LdapConnectionForm } from "./LdapConnectionForm";
|
import { LdapConnectionForm } from "./LdapConnectionForm";
|
||||||
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
|
import { MsSqlConnectionForm } from "./MsSqlConnectionForm";
|
||||||
|
import { MySqlConnectionForm } from "./MySqlConnectionForm";
|
||||||
import { OCIConnectionForm } from "./OCIConnectionForm";
|
import { OCIConnectionForm } from "./OCIConnectionForm";
|
||||||
import { PostgresConnectionForm } from "./PostgresConnectionForm";
|
import { PostgresConnectionForm } from "./PostgresConnectionForm";
|
||||||
import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
|
import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
|
||||||
@@ -88,6 +89,8 @@ const CreateForm = ({ app, onComplete }: CreateFormProps) => {
|
|||||||
return <PostgresConnectionForm onSubmit={onSubmit} />;
|
return <PostgresConnectionForm onSubmit={onSubmit} />;
|
||||||
case AppConnection.MsSql:
|
case AppConnection.MsSql:
|
||||||
return <MsSqlConnectionForm onSubmit={onSubmit} />;
|
return <MsSqlConnectionForm onSubmit={onSubmit} />;
|
||||||
|
case AppConnection.MySql:
|
||||||
|
return <MySqlConnectionForm onSubmit={onSubmit} />;
|
||||||
case AppConnection.Camunda:
|
case AppConnection.Camunda:
|
||||||
return <CamundaConnectionForm onSubmit={onSubmit} />;
|
return <CamundaConnectionForm onSubmit={onSubmit} />;
|
||||||
case AppConnection.AzureClientSecrets:
|
case AppConnection.AzureClientSecrets:
|
||||||
@@ -162,6 +165,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
|
|||||||
return <PostgresConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
return <PostgresConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
case AppConnection.MsSql:
|
case AppConnection.MsSql:
|
||||||
return <MsSqlConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
return <MsSqlConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
|
case AppConnection.MySql:
|
||||||
|
return <MySqlConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
case AppConnection.Camunda:
|
case AppConnection.Camunda:
|
||||||
return <CamundaConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
return <CamundaConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
|
||||||
case AppConnection.AzureClientSecrets:
|
case AppConnection.AzureClientSecrets:
|
||||||
|
|||||||
+155
@@ -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 { MySqlConnectionMethod, TMySqlConnection } 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?: TMySqlConnection;
|
||||||
|
onSubmit: (formData: FormData) => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const rootSchema = genericAppConnectionFieldsSchema.extend({
|
||||||
|
app: z.literal(AppConnection.MySql),
|
||||||
|
isPlatformManagedCredentials: z.boolean().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
const formSchema = z.discriminatedUnion("method", [
|
||||||
|
rootSchema.extend({
|
||||||
|
method: z.literal(MySqlConnectionMethod.UsernameAndPassword),
|
||||||
|
credentials: BaseSqlUsernameAndPasswordConnectionSchema
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
|
type FormData = z.infer<typeof formSchema>;
|
||||||
|
|
||||||
|
export const MySqlConnectionForm = ({ appConnection, onSubmit }: Props) => {
|
||||||
|
const isUpdate = Boolean(appConnection);
|
||||||
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
||||||
|
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
|
||||||
|
|
||||||
|
const form = useForm<FormData>({
|
||||||
|
resolver: zodResolver(formSchema),
|
||||||
|
defaultValues: appConnection ?? {
|
||||||
|
app: AppConnection.MySql,
|
||||||
|
method: MySqlConnectionMethod.UsernameAndPassword,
|
||||||
|
credentials: {
|
||||||
|
host: "",
|
||||||
|
port: 3306,
|
||||||
|
database: "default",
|
||||||
|
username: "",
|
||||||
|
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 (
|
||||||
|
<FormProvider {...form}>
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
setSelectedTabIndex(0);
|
||||||
|
handleSubmit(confirmSubmit)(e);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!isUpdate && <GenericAppConnectionsFields />}
|
||||||
|
<Controller
|
||||||
|
name="method"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
tooltipText={`The method you would like to use to connect with ${
|
||||||
|
APP_CONNECTION_MAP[AppConnection.MySql].name
|
||||||
|
}. This field cannot be changed after creation.`}
|
||||||
|
errorText={error?.message}
|
||||||
|
isError={Boolean(error?.message)}
|
||||||
|
label="Method"
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
isDisabled={isUpdate}
|
||||||
|
value={value}
|
||||||
|
onValueChange={(val) => onChange(val)}
|
||||||
|
className="w-full border border-mineshaft-500"
|
||||||
|
position="popper"
|
||||||
|
dropdownContainerClassName="max-w-none"
|
||||||
|
>
|
||||||
|
{Object.values(MySqlConnectionMethod).map((method) => {
|
||||||
|
return (
|
||||||
|
<SelectItem value={method} key={method}>
|
||||||
|
{getAppConnectionMethodDetails(method).name}{" "}
|
||||||
|
</SelectItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<SqlConnectionFields
|
||||||
|
isPlatformManagedCredentials={isPlatformManagedCredentials}
|
||||||
|
selectedTabIndex={selectedTabIndex}
|
||||||
|
setSelectedTabIndex={setSelectedTabIndex}
|
||||||
|
/>
|
||||||
|
{isPlatformManagedCredentials ? (
|
||||||
|
<PlatformManagedNoticeBanner />
|
||||||
|
) : (
|
||||||
|
<div className="mt-6 flex items-center">
|
||||||
|
<Button
|
||||||
|
className="mr-4"
|
||||||
|
size="sm"
|
||||||
|
type="submit"
|
||||||
|
colorSchema="secondary"
|
||||||
|
isLoading={isSubmitting}
|
||||||
|
isDisabled={isSubmitting || !isDirty}
|
||||||
|
>
|
||||||
|
{isUpdate ? "Update Credentials" : "Connect to Database"}
|
||||||
|
</Button>
|
||||||
|
<ModalClose asChild>
|
||||||
|
<Button colorSchema="secondary" variant="plain">
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</ModalClose>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
<PlatformManagedConfirmationModal
|
||||||
|
onConfirm={() => handleSubmit(onSubmit)()}
|
||||||
|
onOpenChange={setShowConfirmation}
|
||||||
|
isOpen={showConfirmation}
|
||||||
|
/>
|
||||||
|
</FormProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user