Skip to content

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

fix: server redirects to new routing

Piyush Gupta16df96ac60b1
diff --git a/backend/src/ee/services/access-approval-request/access-approval-request-service.ts b/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
index 4b2608c249..6d97e3b9eb 100644
--- a/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
+++ b/backend/src/ee/services/access-approval-request/access-approval-request-service.ts
@@ -243,7 +243,7 @@ export const accessApprovalRequestServiceFactory = ({
);
const requesterFullName = `${requestedByUser.firstName} ${requestedByUser.lastName}`;
- const projectPath = `/projects/secret-management/${project.id}`;
+ const projectPath = `/organizations/${project.orgId}/projects/secret-management/${project.id}`;
const approvalPath = `${projectPath}/approval`;
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
@@ -399,7 +399,7 @@ export const accessApprovalRequestServiceFactory = ({
const requesterFullName = `${requestedByUser.firstName} ${requestedByUser.lastName}`;
const editorFullName = `${editedByUser.firstName} ${editedByUser.lastName}`;
- const projectPath = `/projects/secret-management/${project.id}`;
+ const projectPath = `/organizations/${project.orgId}/projects/secret-management/${project.id}`;
const approvalPath = `${projectPath}/approval`;
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
@@ -766,7 +766,7 @@ export const accessApprovalRequestServiceFactory = ({
.map((appUser) => appUser.email)
.filter((email): email is string => !!email);
- const approvalPath = `/projects/secret-management/${project.id}/approval`;
+ const approvalPath = `/organizations/${project.orgId}/projects/secret-management/${project.id}/approval`;
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
await notificationService.createUserNotifications(
diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts
index bbd6147ed3..93770ce648 100644
--- a/backend/src/ee/services/license/license-service.ts
+++ b/backend/src/ee/services/license/license-service.ts
@@ -445,8 +445,8 @@ export const licenseServiceFactory = ({
} = await licenseServerCloudApi.request.post(
`/api/license-server/v1/customers/${organization.customerId}/billing-details/payment-methods`,
{
- success_url: `${envConfig.SITE_URL}/organization/billing`,
- cancel_url: `${envConfig.SITE_URL}/organization/billing`
+ success_url: `${envConfig.SITE_URL}/organizations/${orgId}/billing`,
+ cancel_url: `${envConfig.SITE_URL}/organizations/${orgId}/billing`
}
);
@@ -459,7 +459,7 @@ export const licenseServiceFactory = ({
} = await licenseServerCloudApi.request.post(
`/api/license-server/v1/customers/${organization.customerId}/billing-details/billing-portal`,
{
- return_url: `${envConfig.SITE_URL}/organization/billing`
+ return_url: `${envConfig.SITE_URL}/organizations/${orgId}/billing`
}
);
diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-fns.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-fns.ts
index 8f1c3d060a..69d36e66f7 100644
--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-fns.ts
+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-fns.ts
@@ -37,7 +37,7 @@ export const sendApprovalEmailsFn = async ({
type: NotificationType.SECRET_CHANGE_REQUEST,
title: "Secret Change Request",
body: `You have a new secret change request pending your review for the project **${project.name}** in the organization **${project.organization.name}**.`,
- link: `/projects/secret-management/${project.id}/approval`
+ link: `/organizations/${project.orgId}/projects/secret-management/${project.id}/approval`
}))
);
@@ -51,7 +51,7 @@ export const sendApprovalEmailsFn = async ({
firstName: reviewerUser.firstName,
projectName: project.name,
organizationName: project.organization.name,
- approvalUrl: `${cfg.SITE_URL}/projects/secret-management/${project.id}/approval}`
+ approvalUrl: `${cfg.SITE_URL}/organizations/${project.orgId}/projects/secret-management/${project.id}/approval}`
},
template: SmtpTemplates.SecretApprovalRequestNeedsReview
});
diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
index e6455c113d..6b0f7e0ede 100644
--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
@@ -1037,7 +1037,7 @@ export const secretApprovalRequestServiceFactory = ({
bypassReason,
secretPath: policy.secretPath,
environment: env.name,
- approvalUrl: `${cfg.SITE_URL}/projects/secret-management/${project.id}/approval`
+ approvalUrl: `${cfg.SITE_URL}/organizations/${project.orgId}/projects/secret-management/${project.id}/approval`
},
template: SmtpTemplates.AccessSecretRequestBypassed
});
@@ -1416,7 +1416,7 @@ export const secretApprovalRequestServiceFactory = ({
const env = await projectEnvDAL.findOne({ id: policy.envId });
const user = await userDAL.findById(actorId);
- const projectPath = `/projects/secret-management/${projectId}`;
+ const projectPath = `/organizations/${actorOrgId}/projects/secret-management/${projectId}`;
const approvalPath = `${projectPath}/approval`;
const cfg = getConfig();
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
@@ -1792,7 +1792,7 @@ export const secretApprovalRequestServiceFactory = ({
const user = await userDAL.findById(actorId);
const env = await projectEnvDAL.findOne({ id: policy.envId });
- const projectPath = `/projects/secret-management/${project.id}`;
+ const projectPath = `/organizations/${actorOrgId}/projects/secret-management/${project.id}`;
const approvalPath = `${projectPath}/approval`;
const cfg = getConfig();
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts
index f653802b68..3c902e1126 100644
--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts
+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-queue.ts
@@ -156,7 +156,7 @@ export const secretRotationV2QueueServiceFactory = async ({
const rotationType = SECRET_ROTATION_NAME_MAP[type as SecretRotation];
- const rotationPath = `/projects/secret-management/${projectId}/secrets/${environment.slug}`;
+ const rotationPath = `/organizations/${project.orgId}/projects/secret-management/${projectId}/secrets/${environment.slug}`;
await notificationService.createUserNotifications(
projectAdmins.map((admin) => ({
diff --git a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-queue.ts b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-queue.ts
index 406c25e037..2b6ab6a207 100644
--- a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-queue.ts
+++ b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-queue.ts
@@ -637,7 +637,7 @@ export const secretScanningV2QueueServiceFactory = async ({
numberOfSecrets: payload.numberOfSecrets,
isDiffScan: payload.isDiffScan,
url: encodeURI(
- `${appCfg.SITE_URL}/projects/secret-scanning/${projectId}/findings?search=scanId:${payload.scanId}`
+ `${appCfg.SITE_URL}/organizations/${project.orgId}/projects/secret-scanning/${projectId}/findings?search=scanId:${payload.scanId}`
),
timestamp
}
@@ -648,7 +648,7 @@ export const secretScanningV2QueueServiceFactory = async ({
timestamp,
errorMessage: payload.errorMessage,
url: encodeURI(
- `${appCfg.SITE_URL}/projects/secret-scanning/${projectId}/data-sources/${dataSource.type}/${dataSource.id}`
+ `${appCfg.SITE_URL}/organizations/${project.orgId}/projects/secret-scanning/${projectId}/data-sources/${dataSource.type}/${dataSource.id}`
)
}
});
diff --git a/backend/src/services/membership-user/org/org-membership-user-factory.ts b/backend/src/services/membership-user/org/org-membership-user-factory.ts
index d21b27b698..deb819c7a8 100644
--- a/backend/src/services/membership-user/org/org-membership-user-factory.ts
+++ b/backend/src/services/membership-user/org/org-membership-user-factory.ts
@@ -129,7 +129,7 @@ export const newOrgMembershipUserFactory = ({
recipients: emails as string[],
substitutions: {
subOrganizationName: orgDetails.slug,
- callback_url: `${appCfg.SITE_URL}/organization/projects?subOrganization=${orgDetails.slug}`
+ callback_url: `${appCfg.SITE_URL}/organizations/${dto.permission.orgId}/projects?subOrganization=${orgDetails.slug}`
}
});
} else {
diff --git a/backend/src/services/microsoft-teams/microsoft-teams-fns.ts b/backend/src/services/microsoft-teams/microsoft-teams-fns.ts
index e940fda544..0fcfbbe01c 100644
--- a/backend/src/services/microsoft-teams/microsoft-teams-fns.ts
+++ b/backend/src/services/microsoft-teams/microsoft-teams-fns.ts
@@ -357,7 +357,7 @@ export const isBotInstalledInTenant = async (
}
};
-export const buildTeamsPayload = (notification: TNotification) => {
+export const buildTeamsPayload = (orgId: string, notification: TNotification) => {
const appCfg = getConfig();
switch (notification.type) {
@@ -402,7 +402,7 @@ export const buildTeamsPayload = (notification: TNotification) => {
{
type: "Action.OpenUrl",
title: "View request in Infisical",
- url: `${appCfg.SITE_URL}/projects/secret-management/${payload.projectId}/approval?requestId=${payload.requestId}`
+ url: `${appCfg.SITE_URL}/organizations/${orgId}/projects/secret-management/${payload.projectId}/approval?requestId=${payload.requestId}`
}
]
};
@@ -590,10 +590,11 @@ export class TeamsBot extends TeamsActivityHandler {
tenantId: string,
channelId: string,
teamId: string,
+ orgId: string,
notification: TNotification
) {
try {
- const { adaptiveCard } = buildTeamsPayload(notification);
+ const { adaptiveCard } = buildTeamsPayload(orgId, notification);
const adaptiveCardActivity = {
type: "message",
diff --git a/backend/src/services/microsoft-teams/microsoft-teams-service.ts b/backend/src/services/microsoft-teams/microsoft-teams-service.ts
index ff17daa755..a9d1af8404 100644
--- a/backend/src/services/microsoft-teams/microsoft-teams-service.ts
+++ b/backend/src/services/microsoft-teams/microsoft-teams-service.ts
@@ -759,7 +759,7 @@ export const microsoftTeamsServiceFactory = ({
});
for await (const channelId of target.channelIds) {
- await teamsBot.sendMessageToChannel(botAccessToken, tenantId, channelId, target.teamId, notification);
+ await teamsBot.sendMessageToChannel(botAccessToken, tenantId, channelId, target.teamId, orgId, notification);
}
};
diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts
index 188c985fb7..d30462e9b3 100644
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@ -1984,7 +1984,7 @@ export const projectServiceFactory = ({
projectTypeUrl = "cert-management";
}
- const callbackPath = `/projects/${projectTypeUrl}/${project.id}/access-management?selectedTab=members&requesterEmail=${userDetails.email}`;
+ const callbackPath = `/organizations/${project.orgId}/projects/${projectTypeUrl}/${project.id}/access-management?selectedTab=members&requesterEmail=${userDetails.email}`;
await notificationService.createUserNotifications(
projectMembers
diff --git a/backend/src/services/secret-sharing/secret-sharing-service.ts b/backend/src/services/secret-sharing/secret-sharing-service.ts
index 87dd207f13..67170e5f66 100644
--- a/backend/src/services/secret-sharing/secret-sharing-service.ts
+++ b/backend/src/services/secret-sharing/secret-sharing-service.ts
@@ -391,7 +391,7 @@ export const secretSharingServiceFactory = ({
substitutions: {
name: secretRequest.name,
respondentUsername,
- secretRequestUrl: `${appCfg.SITE_URL}/organization/secret-sharing?selectedTab=request-secret`
+ secretRequestUrl: `${appCfg.SITE_URL}/organizations/${secretRequest.orgId}/secret-sharing?selectedTab=request-secret`
},
template: SmtpTemplates.SecretRequestCompleted
});
diff --git a/backend/src/services/secret-sync/secret-sync-queue.ts b/backend/src/services/secret-sync/secret-sync-queue.ts
index f6e23ddedd..fd15dc0299 100644
--- a/backend/src/services/secret-sync/secret-sync-queue.ts
+++ b/backend/src/services/secret-sync/secret-sync-queue.ts
@@ -932,7 +932,7 @@ export const secretSyncQueueFactory = ({
break;
}
- const baseProjectPath = `/projects/secret-management/${projectId}`;
+ const baseProjectPath = `/organizations/${project.orgId}/projects/secret-management/${projectId}`;
const overviewPath = `${baseProjectPath}/overview`;
const syncPath = `${baseProjectPath}/integrations/secret-syncs/${destination}/${secretSync.id}`;
diff --git a/backend/src/services/secret/secret-queue.ts b/backend/src/services/secret/secret-queue.ts
index 61507d1275..eefa0764f3 100644
--- a/backend/src/services/secret/secret-queue.ts
+++ b/backend/src/services/secret/secret-queue.ts
@@ -742,7 +742,7 @@ export const secretQueueFactory = ({
environment: jobPayload.environmentName,
count: jobPayload.count,
projectName: project.name,
- integrationUrl: `${appCfg.SITE_URL}/projects/secret-management/${project.id}/integrations?selectedTab=native-integrations`
+ integrationUrl: `${appCfg.SITE_URL}/organizations/${project.orgId}/projects/secret-management/${project.id}/integrations?selectedTab=native-integrations`
}
});
}
diff --git a/backend/src/services/service-token/service-token-dal.ts b/backend/src/services/service-token/service-token-dal.ts
index adb2f325a3..ae2cd35747 100644
--- a/backend/src/services/service-token/service-token-dal.ts
+++ b/backend/src/services/service-token/service-token-dal.ts
@@ -30,28 +30,35 @@ export const serviceTokenDALFactory = (db: TDbClient) => {
const findExpiringTokens = async (tx?: Knex, batchSize = 500, offset = 0) => {
try {
- const batch: { name: string; projectName: string; createdByEmail: string; id: string; projectId: string }[] =
- await (tx || db.replicaNode())(TableName.ServiceToken)
- .leftJoin<TUsers>(
- TableName.Users,
- `${TableName.Users}.id`,
- db.raw(`${TableName.ServiceToken}."createdBy"::uuid`)
- )
- .join(TableName.Project, `${TableName.Project}.id`, `${TableName.ServiceToken}.projectId`)
- .whereRaw(
- `${TableName.ServiceToken}."expiresAt" < NOW() + INTERVAL '1 day' AND ${TableName.ServiceToken}."expiryNotificationSent" = false`
- )
- .whereNotNull(`${TableName.Users}.email`)
- .select(
- db.ref("id").withSchema(TableName.ServiceToken),
- db.ref("name").withSchema(TableName.ServiceToken),
- db.ref("projectId").withSchema(TableName.ServiceToken),
- db.ref("createdBy").withSchema(TableName.ServiceToken),
- db.ref("email").withSchema(TableName.Users).as("createdByEmail"),
- db.ref("name").withSchema(TableName.Project).as("projectName")
- )
- .limit(batchSize)
- .offset(offset);
+ const batch: {
+ name: string;
+ projectName: string;
+ createdByEmail: string;
+ id: string;
+ projectId: string;
+ orgId: string;
+ }[] = await (tx || db.replicaNode())(TableName.ServiceToken)
+ .leftJoin<TUsers>(
+ TableName.Users,
+ `${TableName.Users}.id`,
+ db.raw(`${TableName.ServiceToken}."createdBy"::uuid`)
+ )
+ .join(TableName.Project, `${TableName.Project}.id`, `${TableName.ServiceToken}.projectId`)
+ .whereRaw(
+ `${TableName.ServiceToken}."expiresAt" < NOW() + INTERVAL '1 day' AND ${TableName.ServiceToken}."expiryNotificationSent" = false`
+ )
+ .whereNotNull(`${TableName.Users}.email`)
+ .select(
+ db.ref("id").withSchema(TableName.ServiceToken),
+ db.ref("name").withSchema(TableName.ServiceToken),
+ db.ref("projectId").withSchema(TableName.ServiceToken),
+ db.ref("createdBy").withSchema(TableName.ServiceToken),
+ db.ref("email").withSchema(TableName.Users).as("createdByEmail"),
+ db.ref("name").withSchema(TableName.Project).as("projectName"),
+ db.ref("orgId").withSchema(TableName.Project).as("orgId")
+ )
+ .limit(batchSize)
+ .offset(offset);
return batch;
} catch (err) {
diff --git a/backend/src/services/service-token/service-token-service.ts b/backend/src/services/service-token/service-token-service.ts
index 081b99208f..de759eb9af 100644
--- a/backend/src/services/service-token/service-token-service.ts
+++ b/backend/src/services/service-token/service-token-service.ts
@@ -225,7 +225,7 @@ export const serviceTokenServiceFactory = ({
substitutions: {
tokenName: token.name,
projectName: token.projectName,
- url: `${appCfg.SITE_URL}/projects/secret-management/${token.projectId}/access-management?selectedTab=service-tokens`
+ url: `${appCfg.SITE_URL}/organizations/${token.orgId}/projects/secret-management/${token.projectId}/access-management?selectedTab=service-tokens`
}
});
await serviceTokenDAL.update({ id: token.id }, { expiryNotificationSent: true });