feat: updated by reptile feedback

This commit is contained in:
=
2025-08-07 20:55:41 +05:30
parent adb3185042
commit 676ebaf3c2
7 changed files with 57 additions and 48 deletions
@@ -183,7 +183,12 @@ export const AwsElastiCacheDatabaseProvider = (): TDynamicProviderFns => {
} catch (err) {
const sanitizedErrorMessage = sanitizeString({
unsanitizedString: (err as Error)?.message,
tokens: [providerInputs.accessKeyId, providerInputs.secretAccessKey, providerInputs.clusterName]
tokens: [
providerInputs.accessKeyId,
providerInputs.secretAccessKey,
providerInputs.clusterName,
providerInputs.region
]
});
throw new BadRequestError({
message: `Failed to connect with provider: ${sanitizedErrorMessage}`
@@ -180,6 +180,7 @@ export const AwsIamProvider = (): TDynamicProviderFns => {
awsTags.push(...additionalTags);
}
try {
const createUserRes = await client.send(
new CreateUserCommand({
Path: awsPath,
@@ -206,7 +207,9 @@ export const AwsIamProvider = (): TDynamicProviderFns => {
.split(",")
.filter(Boolean)
.map((policyArn) =>
client.send(new AttachUserPolicyCommand({ UserName: createUserRes?.User?.UserName, PolicyArn: policyArn }))
client.send(
new AttachUserPolicyCommand({ UserName: createUserRes?.User?.UserName, PolicyArn: policyArn })
)
)
);
}
@@ -220,7 +223,6 @@ export const AwsIamProvider = (): TDynamicProviderFns => {
);
}
try {
const createAccessKeyRes = await client.send(
new CreateAccessKeyCommand({
UserName: createUserRes.User.UserName
@@ -114,12 +114,12 @@ export const AzureEntraIDProvider = (): TDynamicProviderFns & {
};
const revoke = async (inputs: unknown, entityId: string) => {
const providerInputs = await validateProviderInputs(inputs);
try {
// Creates a new password
await create({ inputs });
return { entityId };
} catch (err) {
const providerInputs = await validateProviderInputs(inputs);
const sanitizedErrorMessage = sanitizeString({
unsanitizedString: (err as Error)?.message,
tokens: [providerInputs.clientSecret, providerInputs.applicationId, entityId]
@@ -66,11 +66,7 @@ export const ElasticSearchProvider = (): TDynamicProviderFns => {
const connection = await $getClient(providerInputs);
try {
const infoResponse = await connection
.info()
.then(() => true)
.catch(() => false);
const infoResponse = await connection.info().then(() => true);
return infoResponse;
} catch (err) {
const tokens = [];
@@ -216,7 +216,8 @@ export const LdapProvider = (): TDynamicProviderFns => {
if (providerInputs.credentialType === LdapCredentialType.Static) {
const dnRegex = new RE2("^dn:\\s*(.+)", "m");
const dnMatch = dnRegex.exec(providerInputs.rotationLdif);
const username = dnMatch?.[1] || "";
const username = dnMatch?.[1];
if (!username) throw new BadRequestError({ message: "Username not found from Ldif" });
const password = generatePassword();
if (dnMatch) {
@@ -123,7 +123,12 @@ export const RedisDatabaseProvider = (): TDynamicProviderFns => {
if (connection) await connection.quit();
const sanitizedErrorMessage = sanitizeString({
unsanitizedString: (err as Error)?.message,
tokens: [providerInputs.password || "", providerInputs.username, providerInputs.host]
tokens: [
providerInputs.password || "",
providerInputs.username,
providerInputs.host,
String(providerInputs.port)
]
});
throw new BadRequestError({
message: `Failed to connect with provider: ${sanitizedErrorMessage}`
@@ -155,7 +155,7 @@ export const SnowflakeProvider = (): TDynamicProviderFns => {
sqlText: revokeStatement,
complete(err) {
if (err) {
return reject();
return reject(err);
}
return resolve(true);