fix(server): removed global aws cred config in secret integration

This commit is contained in:
Akhil Mohan
2024-03-06 23:21:06 +05:30
parent 7e044ad9ff
commit ed6c6e8d1e

View File

@@ -441,16 +441,19 @@ const syncSecretsAWSParameterStore = async ({
}) => {
if (!accessId) return;
AWS.config.update({
const config = new AWS.Config({
region: integration.region as string,
accessKeyId: accessId,
secretAccessKey: accessToken
credentials: {
accessKeyId: accessId,
secretAccessKey: accessToken
}
});
const ssm = new AWS.SSM({
apiVersion: "2014-11-06",
region: integration.region as string
});
ssm.config.update(config);
const params = {
Path: integration.path as string,
@@ -514,12 +517,6 @@ const syncSecretsAWSParameterStore = async ({
}
})
);
AWS.config.update({
region: undefined,
accessKeyId: undefined,
secretAccessKey: undefined
});
};
/**
@@ -541,12 +538,6 @@ const syncSecretsAWSSecretManager = async ({
try {
if (!accessId) return;
AWS.config.update({
region: integration.region as string,
accessKeyId: accessId,
secretAccessKey: accessToken
});
secretsManager = new SecretsManagerClient({
region: integration.region as string,
credentials: {
@@ -575,12 +566,6 @@ const syncSecretsAWSSecretManager = async ({
})
);
}
AWS.config.update({
region: undefined,
accessKeyId: undefined,
secretAccessKey: undefined
});
} catch (err) {
if (err instanceof ResourceNotFoundException && secretsManager) {
await secretsManager.send(
@@ -590,11 +575,6 @@ const syncSecretsAWSSecretManager = async ({
})
);
}
AWS.config.update({
region: undefined,
accessKeyId: undefined,
secretAccessKey: undefined
});
}
};