mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 08:28:22 +00:00
fix: server redirects to new routing
This commit is contained in:
@@ -243,7 +243,7 @@ export const accessApprovalRequestServiceFactory = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const requesterFullName = `${requestedByUser.firstName} ${requestedByUser.lastName}`;
|
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 approvalPath = `${projectPath}/approval`;
|
||||||
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ export const accessApprovalRequestServiceFactory = ({
|
|||||||
|
|
||||||
const requesterFullName = `${requestedByUser.firstName} ${requestedByUser.lastName}`;
|
const requesterFullName = `${requestedByUser.firstName} ${requestedByUser.lastName}`;
|
||||||
const editorFullName = `${editedByUser.firstName} ${editedByUser.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 approvalPath = `${projectPath}/approval`;
|
||||||
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
||||||
|
|
||||||
@@ -766,7 +766,7 @@ export const accessApprovalRequestServiceFactory = ({
|
|||||||
.map((appUser) => appUser.email)
|
.map((appUser) => appUser.email)
|
||||||
.filter((email): email is string => !!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}`;
|
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
||||||
|
|
||||||
await notificationService.createUserNotifications(
|
await notificationService.createUserNotifications(
|
||||||
|
|||||||
@@ -445,8 +445,8 @@ export const licenseServiceFactory = ({
|
|||||||
} = await licenseServerCloudApi.request.post(
|
} = await licenseServerCloudApi.request.post(
|
||||||
`/api/license-server/v1/customers/${organization.customerId}/billing-details/payment-methods`,
|
`/api/license-server/v1/customers/${organization.customerId}/billing-details/payment-methods`,
|
||||||
{
|
{
|
||||||
success_url: `${envConfig.SITE_URL}/organization/billing`,
|
success_url: `${envConfig.SITE_URL}/organizations/${orgId}/billing`,
|
||||||
cancel_url: `${envConfig.SITE_URL}/organization/billing`
|
cancel_url: `${envConfig.SITE_URL}/organizations/${orgId}/billing`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ export const licenseServiceFactory = ({
|
|||||||
} = await licenseServerCloudApi.request.post(
|
} = await licenseServerCloudApi.request.post(
|
||||||
`/api/license-server/v1/customers/${organization.customerId}/billing-details/billing-portal`,
|
`/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`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const sendApprovalEmailsFn = async ({
|
|||||||
type: NotificationType.SECRET_CHANGE_REQUEST,
|
type: NotificationType.SECRET_CHANGE_REQUEST,
|
||||||
title: "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}**.`,
|
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,
|
firstName: reviewerUser.firstName,
|
||||||
projectName: project.name,
|
projectName: project.name,
|
||||||
organizationName: project.organization.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
|
template: SmtpTemplates.SecretApprovalRequestNeedsReview
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
bypassReason,
|
bypassReason,
|
||||||
secretPath: policy.secretPath,
|
secretPath: policy.secretPath,
|
||||||
environment: env.name,
|
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
|
template: SmtpTemplates.AccessSecretRequestBypassed
|
||||||
});
|
});
|
||||||
@@ -1416,7 +1416,7 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
const env = await projectEnvDAL.findOne({ id: policy.envId });
|
const env = await projectEnvDAL.findOne({ id: policy.envId });
|
||||||
const user = await userDAL.findById(actorId);
|
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 approvalPath = `${projectPath}/approval`;
|
||||||
const cfg = getConfig();
|
const cfg = getConfig();
|
||||||
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
||||||
@@ -1792,7 +1792,7 @@ export const secretApprovalRequestServiceFactory = ({
|
|||||||
const user = await userDAL.findById(actorId);
|
const user = await userDAL.findById(actorId);
|
||||||
const env = await projectEnvDAL.findOne({ id: policy.envId });
|
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 approvalPath = `${projectPath}/approval`;
|
||||||
const cfg = getConfig();
|
const cfg = getConfig();
|
||||||
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
const approvalUrl = `${cfg.SITE_URL}${approvalPath}`;
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ export const secretRotationV2QueueServiceFactory = async ({
|
|||||||
|
|
||||||
const rotationType = SECRET_ROTATION_NAME_MAP[type as SecretRotation];
|
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(
|
await notificationService.createUserNotifications(
|
||||||
projectAdmins.map((admin) => ({
|
projectAdmins.map((admin) => ({
|
||||||
|
|||||||
@@ -637,7 +637,7 @@ export const secretScanningV2QueueServiceFactory = async ({
|
|||||||
numberOfSecrets: payload.numberOfSecrets,
|
numberOfSecrets: payload.numberOfSecrets,
|
||||||
isDiffScan: payload.isDiffScan,
|
isDiffScan: payload.isDiffScan,
|
||||||
url: encodeURI(
|
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
|
timestamp
|
||||||
}
|
}
|
||||||
@@ -648,7 +648,7 @@ export const secretScanningV2QueueServiceFactory = async ({
|
|||||||
timestamp,
|
timestamp,
|
||||||
errorMessage: payload.errorMessage,
|
errorMessage: payload.errorMessage,
|
||||||
url: encodeURI(
|
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}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export const newOrgMembershipUserFactory = ({
|
|||||||
recipients: emails as string[],
|
recipients: emails as string[],
|
||||||
substitutions: {
|
substitutions: {
|
||||||
subOrganizationName: orgDetails.slug,
|
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 {
|
} else {
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ export const isBotInstalledInTenant = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const buildTeamsPayload = (notification: TNotification) => {
|
export const buildTeamsPayload = (orgId: string, notification: TNotification) => {
|
||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
|
|
||||||
switch (notification.type) {
|
switch (notification.type) {
|
||||||
@@ -402,7 +402,7 @@ export const buildTeamsPayload = (notification: TNotification) => {
|
|||||||
{
|
{
|
||||||
type: "Action.OpenUrl",
|
type: "Action.OpenUrl",
|
||||||
title: "View request in Infisical",
|
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,
|
tenantId: string,
|
||||||
channelId: string,
|
channelId: string,
|
||||||
teamId: string,
|
teamId: string,
|
||||||
|
orgId: string,
|
||||||
notification: TNotification
|
notification: TNotification
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { adaptiveCard } = buildTeamsPayload(notification);
|
const { adaptiveCard } = buildTeamsPayload(orgId, notification);
|
||||||
|
|
||||||
const adaptiveCardActivity = {
|
const adaptiveCardActivity = {
|
||||||
type: "message",
|
type: "message",
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ export const microsoftTeamsServiceFactory = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
for await (const channelId of target.channelIds) {
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1984,7 +1984,7 @@ export const projectServiceFactory = ({
|
|||||||
projectTypeUrl = "cert-management";
|
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(
|
await notificationService.createUserNotifications(
|
||||||
projectMembers
|
projectMembers
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ export const secretSharingServiceFactory = ({
|
|||||||
substitutions: {
|
substitutions: {
|
||||||
name: secretRequest.name,
|
name: secretRequest.name,
|
||||||
respondentUsername,
|
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
|
template: SmtpTemplates.SecretRequestCompleted
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -932,7 +932,7 @@ export const secretSyncQueueFactory = ({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseProjectPath = `/projects/secret-management/${projectId}`;
|
const baseProjectPath = `/organizations/${project.orgId}/projects/secret-management/${projectId}`;
|
||||||
const overviewPath = `${baseProjectPath}/overview`;
|
const overviewPath = `${baseProjectPath}/overview`;
|
||||||
const syncPath = `${baseProjectPath}/integrations/secret-syncs/${destination}/${secretSync.id}`;
|
const syncPath = `${baseProjectPath}/integrations/secret-syncs/${destination}/${secretSync.id}`;
|
||||||
|
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ export const secretQueueFactory = ({
|
|||||||
environment: jobPayload.environmentName,
|
environment: jobPayload.environmentName,
|
||||||
count: jobPayload.count,
|
count: jobPayload.count,
|
||||||
projectName: project.name,
|
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`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,14 @@ export const serviceTokenDALFactory = (db: TDbClient) => {
|
|||||||
|
|
||||||
const findExpiringTokens = async (tx?: Knex, batchSize = 500, offset = 0) => {
|
const findExpiringTokens = async (tx?: Knex, batchSize = 500, offset = 0) => {
|
||||||
try {
|
try {
|
||||||
const batch: { name: string; projectName: string; createdByEmail: string; id: string; projectId: string }[] =
|
const batch: {
|
||||||
await (tx || db.replicaNode())(TableName.ServiceToken)
|
name: string;
|
||||||
|
projectName: string;
|
||||||
|
createdByEmail: string;
|
||||||
|
id: string;
|
||||||
|
projectId: string;
|
||||||
|
orgId: string;
|
||||||
|
}[] = await (tx || db.replicaNode())(TableName.ServiceToken)
|
||||||
.leftJoin<TUsers>(
|
.leftJoin<TUsers>(
|
||||||
TableName.Users,
|
TableName.Users,
|
||||||
`${TableName.Users}.id`,
|
`${TableName.Users}.id`,
|
||||||
@@ -48,7 +54,8 @@ export const serviceTokenDALFactory = (db: TDbClient) => {
|
|||||||
db.ref("projectId").withSchema(TableName.ServiceToken),
|
db.ref("projectId").withSchema(TableName.ServiceToken),
|
||||||
db.ref("createdBy").withSchema(TableName.ServiceToken),
|
db.ref("createdBy").withSchema(TableName.ServiceToken),
|
||||||
db.ref("email").withSchema(TableName.Users).as("createdByEmail"),
|
db.ref("email").withSchema(TableName.Users).as("createdByEmail"),
|
||||||
db.ref("name").withSchema(TableName.Project).as("projectName")
|
db.ref("name").withSchema(TableName.Project).as("projectName"),
|
||||||
|
db.ref("orgId").withSchema(TableName.Project).as("orgId")
|
||||||
)
|
)
|
||||||
.limit(batchSize)
|
.limit(batchSize)
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export const serviceTokenServiceFactory = ({
|
|||||||
substitutions: {
|
substitutions: {
|
||||||
tokenName: token.name,
|
tokenName: token.name,
|
||||||
projectName: token.projectName,
|
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 });
|
await serviceTokenDAL.update({ id: token.id }, { expiryNotificationSent: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user