mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 11:27:07 +00:00
Merge pull request #2801 from Infisical/omar/eng-1952-address-key-vault-integration-failing-due-to-disabled-secret
Fix(Azure Key Vault): Ignore disabled secrets
This commit is contained in:
@@ -473,7 +473,7 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
id: string; // secret URI
|
id: string; // secret URI
|
||||||
value: string;
|
value: string;
|
||||||
attributes: {
|
attributes: {
|
||||||
enabled: true;
|
enabled: boolean;
|
||||||
created: number;
|
created: number;
|
||||||
updated: number;
|
updated: number;
|
||||||
recoveryLevel: string;
|
recoveryLevel: string;
|
||||||
@@ -509,10 +509,19 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
|
|
||||||
const getAzureKeyVaultSecrets = await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`);
|
const getAzureKeyVaultSecrets = await paginateAzureKeyVaultSecrets(`${integration.app}/secrets?api-version=7.3`);
|
||||||
|
|
||||||
|
const enabledAzureKeyVaultSecrets = getAzureKeyVaultSecrets.filter((secret) => secret.attributes.enabled);
|
||||||
|
|
||||||
|
// disabled keys to skip sending updates to
|
||||||
|
const disabledAzureKeyVaultSecretKeys = getAzureKeyVaultSecrets
|
||||||
|
.filter(({ attributes }) => !attributes.enabled)
|
||||||
|
.map((getAzureKeyVaultSecret) => {
|
||||||
|
return getAzureKeyVaultSecret.id.substring(getAzureKeyVaultSecret.id.lastIndexOf("/") + 1);
|
||||||
|
});
|
||||||
|
|
||||||
let lastSlashIndex: number;
|
let lastSlashIndex: number;
|
||||||
const res = (
|
const res = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
getAzureKeyVaultSecrets.map(async (getAzureKeyVaultSecret) => {
|
enabledAzureKeyVaultSecrets.map(async (getAzureKeyVaultSecret) => {
|
||||||
if (!lastSlashIndex) {
|
if (!lastSlashIndex) {
|
||||||
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
|
lastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");
|
||||||
}
|
}
|
||||||
@@ -658,6 +667,7 @@ const syncSecretsAzureKeyVault = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
let isSecretSet = false;
|
let isSecretSet = false;
|
||||||
let maxTries = 6;
|
let maxTries = 6;
|
||||||
|
if (disabledAzureKeyVaultSecretKeys.includes(key)) return;
|
||||||
|
|
||||||
while (!isSecretSet && maxTries > 0) {
|
while (!isSecretSet && maxTries > 0) {
|
||||||
// try to set secret
|
// try to set secret
|
||||||
|
|||||||
Reference in New Issue
Block a user