diff --git a/backend/src/ee/services/secret-rotation-v2/redis-credentials/redis-credentials-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/redis-credentials/redis-credentials-rotation-fns.ts index c321cdeb0..5dec96d2d 100644 --- a/backend/src/ee/services/secret-rotation-v2/redis-credentials/redis-credentials-rotation-fns.ts +++ b/backend/src/ee/services/secret-rotation-v2/redis-credentials/redis-credentials-rotation-fns.ts @@ -61,21 +61,23 @@ export const redisCredentialsRotationFactory: TRotationFactory< * Creates a new user and password for the redis user using ACL */ const $rotateAclUser = async () => { - const client = await $getClient(); - - const username = generatePassword({ - length: 32, - required: { - symbols: 0, - digits: 5, - uppercase: 5, - lowercase: 5 - } - }); - - const password = generatePassword(parameters.passwordRequirements || DEFAULT_PASSWORD_REQUIREMENTS); + let client: Redis | null = null; try { + client = await $getClient(); + + const username = generatePassword({ + length: 32, + required: { + symbols: 0, + digits: 5, + uppercase: 5, + lowercase: 5 + } + }); + + const password = generatePassword(parameters.passwordRequirements || DEFAULT_PASSWORD_REQUIREMENTS); + // important: permissionScope is user input so we need to sanitize it, which we do by splitting the permission scope into parts and then passing them to the ACL command as separate arguments const permissionParts = (parameters.permissionScope || "~* +@all").split(" "); await client.call("ACL", "SETUSER", username, `>${password}`, "on", ...permissionParts); @@ -88,6 +90,8 @@ export const redisCredentialsRotationFactory: TRotationFactory< throw new BadRequestError({ message: "Unable to validate connection: verify credentials" }); + } finally { + if (client) await client.quit(); } }; @@ -95,14 +99,17 @@ export const redisCredentialsRotationFactory: TRotationFactory< * Revokes a ACL password from the Redis server using its username and password. */ const revokeCredential = async (username: string) => { - const client = await $getClient(); + let client: Redis | null = null; try { + client = await $getClient(); await client.call("ACL", "DELUSER", username); } catch (error: unknown) { throw new BadRequestError({ message: "Unable to revoke credential: verify credentials" }); + } finally { + if (client) await client.quit(); } }; diff --git a/backend/src/services/app-connection/redis/redis-connection-schemas.ts b/backend/src/services/app-connection/redis/redis-connection-schemas.ts index 60c8b8458..f29a2d036 100644 --- a/backend/src/services/app-connection/redis/redis-connection-schemas.ts +++ b/backend/src/services/app-connection/redis/redis-connection-schemas.ts @@ -61,8 +61,8 @@ export const ValidateRedisConnectionCredentialsSchema = z.discriminatedUnion("me export const CreateRedisConnectionSchema = ValidateRedisConnectionCredentialsSchema.and( GenericCreateAppConnectionFieldsSchema(AppConnection.Redis, { - supportsPlatformManagedCredentials: true, - supportsGateways: true + supportsPlatformManagedCredentials: false, + supportsGateways: false }) ); @@ -74,8 +74,8 @@ export const UpdateRedisConnectionSchema = z }) .and( GenericUpdateAppConnectionFieldsSchema(AppConnection.Redis, { - supportsPlatformManagedCredentials: true, - supportsGateways: true + supportsPlatformManagedCredentials: false, + supportsGateways: false }) ); diff --git a/docs/docs.json b/docs/docs.json index 45d02228e..b2ce93499 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -134,14 +134,14 @@ "integrations/app-connections/oracledb", "integrations/app-connections/postgres", "integrations/app-connections/railway", + "integrations/app-connections/redis", "integrations/app-connections/render", "integrations/app-connections/supabase", "integrations/app-connections/teamcity", "integrations/app-connections/terraform-cloud", "integrations/app-connections/vercel", "integrations/app-connections/windmill", - "integrations/app-connections/zabbix", - "integrations/app-connections/redis" + "integrations/app-connections/zabbix" ] } ] @@ -1881,6 +1881,18 @@ "api-reference/endpoints/app-connections/railway/delete" ] }, + { + "group": "Redis", + "pages": [ + "api-reference/endpoints/app-connections/redis/list", + "api-reference/endpoints/app-connections/redis/available", + "api-reference/endpoints/app-connections/redis/get-by-id", + "api-reference/endpoints/app-connections/redis/get-by-name", + "api-reference/endpoints/app-connections/redis/create", + "api-reference/endpoints/app-connections/redis/update", + "api-reference/endpoints/app-connections/redis/delete" + ] + }, { "group": "Render", "pages": [ @@ -1964,18 +1976,6 @@ "api-reference/endpoints/app-connections/zabbix/update", "api-reference/endpoints/app-connections/zabbix/delete" ] - }, - { - "group": "Redis", - "pages": [ - "api-reference/endpoints/app-connections/redis/list", - "api-reference/endpoints/app-connections/redis/available", - "api-reference/endpoints/app-connections/redis/get-by-id", - "api-reference/endpoints/app-connections/redis/get-by-name", - "api-reference/endpoints/app-connections/redis/create", - "api-reference/endpoints/app-connections/redis/update", - "api-reference/endpoints/app-connections/redis/delete" - ] } ] }, diff --git a/docs/images/app-connections/redis/redis-app-connection-form.png b/docs/images/app-connections/redis/redis-app-connection-form.png new file mode 100644 index 000000000..05db36fd5 Binary files /dev/null and b/docs/images/app-connections/redis/redis-app-connection-form.png differ diff --git a/docs/images/app-connections/redis/redis-connection-form.png b/docs/images/app-connections/redis/redis-connection-form.png deleted file mode 100644 index 4f368b22a..000000000 Binary files a/docs/images/app-connections/redis/redis-connection-form.png and /dev/null differ diff --git a/docs/images/secret-rotations-v2/redis-credentials/select-redis-credentials-option.png b/docs/images/secret-rotations-v2/redis-credentials/select-redis-credentials-option.png new file mode 100644 index 000000000..979a77b43 Binary files /dev/null and b/docs/images/secret-rotations-v2/redis-credentials/select-redis-credentials-option.png differ