Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Point getAppsGitLab method to self-hosted GitLab instance if applicable, fix integration revocation issue related to missing metadata param partly

Tuan Dang5bf2c2f52bee
diff --git a/backend/src/helpers/integration.ts b/backend/src/helpers/integration.ts
index 2775d79c68..803c92aca3 100644
--- a/backend/src/helpers/integration.ts
+++ b/backend/src/helpers/integration.ts
@@ -160,7 +160,7 @@ export const getIntegrationAuthAccessHelper = async ({
let accessId;
let accessToken;
const integrationAuth = await IntegrationAuth.findById(integrationAuthId).select(
- "workspace integration +accessCiphertext +accessIV +accessTag +accessExpiresAt +refreshCiphertext +refreshIV +refreshTag +accessIdCiphertext +accessIdIV +accessIdTag"
+ "workspace integration +accessCiphertext +accessIV +accessTag +accessExpiresAt +refreshCiphertext +refreshIV +refreshTag +accessIdCiphertext +accessIdIV +accessIdTag metadata"
);
if (!integrationAuth)
diff --git a/backend/src/integrations/apps.ts b/backend/src/integrations/apps.ts
index 1eef252b1c..dc947f6f1a 100644
--- a/backend/src/integrations/apps.ts
+++ b/backend/src/integrations/apps.ts
@@ -120,6 +120,7 @@ const getApps = async ({
break;
case INTEGRATION_GITLAB:
apps = await getAppsGitlab({
+ integrationAuth,
accessToken,
teamId,
});
@@ -736,12 +737,16 @@ const getAppsTerraformCloud = async ({
* @returns {String} apps.name - name of GitLab site
*/
const getAppsGitlab = async ({
+ integrationAuth,
accessToken,
teamId,
}: {
+ integrationAuth: IIntegrationAuth;
accessToken: string;
teamId?: string;
}) => {
+ const gitLabApiUrl = integrationAuth.url ? `${integrationAuth.url}/api` : INTEGRATION_GITLAB_API_URL;
+
const apps: App[] = [];
let page = 1;
@@ -758,7 +763,7 @@ const getAppsGitlab = async ({
});
const { data } = await standardRequest.get(
- `${INTEGRATION_GITLAB_API_URL}/v4/groups/${teamId}/projects`,
+ `${gitLabApiUrl}/v4/groups/${teamId}/projects`,
{
params,
headers: {
@@ -785,7 +790,7 @@ const getAppsGitlab = async ({
// case: fetch projects for individual in GitLab
const { id } = (
- await standardRequest.get(`${INTEGRATION_GITLAB_API_URL}/v4/user`, {
+ await standardRequest.get(`${gitLabApiUrl}/v4/user`, {
headers: {
Authorization: `Bearer ${accessToken}`,
"Accept-Encoding": "application/json",
@@ -800,7 +805,7 @@ const getAppsGitlab = async ({
});
const { data } = await standardRequest.get(
- `${INTEGRATION_GITLAB_API_URL}/v4/users/${id}/projects`,
+ `${gitLabApiUrl}/v4/users/${id}/projects`,
{
params,
headers: {
diff --git a/backend/src/validation/integration.ts b/backend/src/validation/integration.ts
index 7ec0d08751..9058b68a25 100644
--- a/backend/src/validation/integration.ts
+++ b/backend/src/validation/integration.ts
@@ -34,9 +34,9 @@ export const validateClientForIntegration = async ({
if (!integration) throw IntegrationNotFoundError();
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth).select(
- "+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt"
+ "+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt +metadata"
);
-
+
if (!integrationAuth) throw IntegrationAuthNotFoundError();
const accessToken = (
diff --git a/backend/src/validation/integrationAuth.ts b/backend/src/validation/integrationAuth.ts
index 18ff191aff..c8c4e81051 100644
--- a/backend/src/validation/integrationAuth.ts
+++ b/backend/src/validation/integrationAuth.ts
@@ -30,9 +30,9 @@ const validateClientForIntegrationAuth = async ({
const integrationAuth = await IntegrationAuth.findById(integrationAuthId)
.populate<{ workspace: IWorkspace }>("workspace")
.select(
- "+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt"
+ "+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt +metadata"
);
-
+
if (!integrationAuth) throw IntegrationAuthNotFoundError();
let accessToken, accessId;