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
do not throw on code exchanged
Thiago Araujo da Silva92b9b0ba1245
diff --git a/backend/src/services/github-app/github-app-service.ts b/backend/src/services/github-app/github-app-service.tsindex 2e72145a96..ac56d900f3 100644--- a/backend/src/services/github-app/github-app-service.ts+++ b/backend/src/services/github-app/github-app-service.ts@@ -393,6 +393,7 @@ export const gitHubAppServiceFactory = ({}let created: Awaited<ReturnType<typeof gitHubAppDAL.create>>;+ let codeExchanged = false;try {const { permission } = await permissionService.getOrgPermission({actor: actorType as ActorType,@@ -448,6 +449,7 @@ export const gitHubAppServiceFactory = ({"Failed to exchange GitHub App manifest code. The code may be expired or invalid. Please try registering the GitHub App again."});}+ codeExchanged = true;const { encryptor } = await kmsService.createCipherPairWithDataKey({type: KmsDataKey.Organization,@@ -488,7 +490,9 @@ export const gitHubAppServiceFactory = ({await keyStore.deleteItem(nameLockKey).catch(() => {});}} catch (err) {- await keyStore.deleteItem(stateClaimKey).catch(() => {});+ if (!codeExchanged) {+ await keyStore.deleteItem(stateClaimKey).catch(() => {});+ }throw err;}