Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
check role username against app connection
adilson188297c181c5
diff --git a/backend/src/ee/services/secret-rotation-v2/shared/sql-credentials/sql-credentials-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/shared/sql-credentials/sql-credentials-rotation-fns.tsindex 3a33740226..0f3b236aa8 100644--- a/backend/src/ee/services/secret-rotation-v2/shared/sql-credentials/sql-credentials-rotation-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/shared/sql-credentials/sql-credentials-rotation-fns.ts@@ -38,6 +38,24 @@ const redactPasswords = (e: unknown, credentials: TSqlCredentialsRotationGeneratreturn redactedMessage;};+const validateRotationUsernames = (+ connectionUsername: string,+ host: string,+ rotationUsername1: string,+ rotationUsername2: string+) => {+ const connectionRoleUsername = getRoleUsernameForHost(connectionUsername, host);+ const rotationRoleUsername1 = getRoleUsernameForHost(rotationUsername1, host);+ const rotationRoleUsername2 = getRoleUsernameForHost(rotationUsername2, host);++ if (rotationRoleUsername1 === connectionRoleUsername || rotationRoleUsername2 === connectionRoleUsername) {+ throw new BadRequestError({+ message:+ "Rotation username cannot be the same as the connection username. The connection credentials are used to execute rotation operations and changing their password would break the connection."+ });+ }+};+const ORACLE_PASSWORD_REQUIREMENTS = {...DEFAULT_PASSWORD_REQUIREMENTS,length: 30@@ -67,12 +85,7 @@ export const sqlCredentialsRotationFactory: TRotationFactory<secretsMapping} = secretRotation;- if (username1 === connection.credentials.username || username2 === connection.credentials.username) {- throw new BadRequestError({- message:- "Rotation username cannot be the same as the connection username. The connection credentials are used to execute rotation operations and changing their password would break the connection."- });- }+ validateRotationUsernames(connection.credentials.username, connection.credentials.host, username1, username2);const defaultPasswordRequirement =connection.app === AppConnection.OracleDB ? ORACLE_PASSWORD_REQUIREMENTS : DEFAULT_PASSWORD_REQUIREMENTS;