mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 07:26:11 +00:00
fix: address unhandled promise rejects causing 502s
This commit is contained in:
@@ -114,20 +114,27 @@ export const integrationAuthServiceFactory = ({
|
|||||||
const listOrgIntegrationAuth = async ({ actorId, actor, actorOrgId, actorAuthMethod }: TGenericPermission) => {
|
const listOrgIntegrationAuth = async ({ actorId, actor, actorOrgId, actorAuthMethod }: TGenericPermission) => {
|
||||||
const authorizations = await integrationAuthDAL.getByOrg(actorOrgId as string);
|
const authorizations = await integrationAuthDAL.getByOrg(actorOrgId as string);
|
||||||
|
|
||||||
return Promise.all(
|
const filteredAuthorizations = await Promise.all(
|
||||||
authorizations.filter(async (auth) => {
|
authorizations.map(async (auth) => {
|
||||||
const { permission } = await permissionService.getProjectPermission({
|
try {
|
||||||
actor,
|
const { permission } = await permissionService.getProjectPermission({
|
||||||
actorId,
|
actor,
|
||||||
projectId: auth.projectId,
|
actorId,
|
||||||
actorAuthMethod,
|
projectId: auth.projectId,
|
||||||
actorOrgId,
|
actorAuthMethod,
|
||||||
actionProjectType: ActionProjectType.SecretManager
|
actorOrgId,
|
||||||
});
|
actionProjectType: ActionProjectType.SecretManager
|
||||||
|
});
|
||||||
|
|
||||||
return permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations);
|
return permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Integrations) ? auth : null;
|
||||||
|
} catch (error) {
|
||||||
|
// user does not belong to the project that the integration auth belongs to
|
||||||
|
return null;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return filteredAuthorizations.filter((auth) => auth !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getIntegrationAuth = async ({ actor, id, actorId, actorAuthMethod, actorOrgId }: TGetIntegrationAuthDTO) => {
|
const getIntegrationAuth = async ({ actor, id, actorId, actorAuthMethod, actorOrgId }: TGetIntegrationAuthDTO) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user