mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Review fixes
This commit is contained in:
@@ -46,6 +46,9 @@ const createErrorMessage = (error: unknown) => {
|
|||||||
return "Unknown error";
|
return "Unknown error";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Delay between each revocation call in revokeCredentials
|
||||||
|
const DELAY_MS = 1000;
|
||||||
|
|
||||||
export const oktaClientSecretRotationFactory: TRotationFactory<
|
export const oktaClientSecretRotationFactory: TRotationFactory<
|
||||||
TOktaClientSecretRotationWithConnection,
|
TOktaClientSecretRotationWithConnection,
|
||||||
TOktaClientSecretRotationGeneratedCredentials
|
TOktaClientSecretRotationGeneratedCredentials
|
||||||
@@ -182,6 +185,16 @@ export const oktaClientSecretRotationFactory: TRotationFactory<
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
if (
|
||||||
|
error instanceof AxiosError &&
|
||||||
|
error.response?.data &&
|
||||||
|
isOktaErrorResponse(error.response.data) &&
|
||||||
|
error.response.data.errorCode === "E0000001"
|
||||||
|
) {
|
||||||
|
// If this is the last secret, we cannot revoke it
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
message: `Failed to remove client secret with secretId ${secretId} from app ${clientId}: ${createErrorMessage(error)}`
|
message: `Failed to remove client secret with secretId ${secretId} from app ${clientId}: ${createErrorMessage(error)}`
|
||||||
});
|
});
|
||||||
@@ -209,7 +222,7 @@ export const oktaClientSecretRotationFactory: TRotationFactory<
|
|||||||
|
|
||||||
for (const { secretId } of credentials) {
|
for (const { secretId } of credentials) {
|
||||||
await revokeCredential(secretId);
|
await revokeCredential(secretId);
|
||||||
await delayMs(1000);
|
await delayMs(DELAY_MS);
|
||||||
}
|
}
|
||||||
return callback();
|
return callback();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ export type TOktaApp = {
|
|||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
status: "ACTIVE" | "INACTIVE";
|
status: "ACTIVE" | "INACTIVE";
|
||||||
name: string; // "oidc_client" or other types
|
name: "oidc_client"; // "oidc_client" or other types
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user