requested changes

This commit is contained in:
Daniel Hougaard
2025-09-24 00:34:25 +04:00
parent 2641a74b39
commit 78783b245b
6 changed files with 39 additions and 32 deletions

View File

@@ -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();
}
};

View File

@@ -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
})
);

View File

@@ -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"
]
}
]
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB