Skip to content

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

requested changes

varonixd93db3498127
diff --git a/backend/src/ee/routes/v1/insights-router.ts b/backend/src/ee/routes/v1/insights-router.ts
index 82dcf067a3..95d645a56a 100644
--- a/backend/src/ee/routes/v1/insights-router.ts
+++ b/backend/src/ee/routes/v1/insights-router.ts
@@ -749,7 +749,11 @@ export const registerInsightsRouter = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => {
- const report = await server.services.auditReport.getReportById(req.params.reportId, req.permission);
+ const report = await server.services.auditReport.getReportById(
+ req.params.reportId,
+ req.params.projectId,
+ req.permission
+ );
await server.services.auditLog.createAuditLog({
projectId: report.projectId,
event: {
diff --git a/backend/src/ee/services/audit-report/audit-report-service.ts b/backend/src/ee/services/audit-report/audit-report-service.ts
index 34f97b204c..f2bdf67535 100644
--- a/backend/src/ee/services/audit-report/audit-report-service.ts
+++ b/backend/src/ee/services/audit-report/audit-report-service.ts
@@ -10,7 +10,7 @@ import { TPermissionServiceFactory } from "@app/ee/services/permission/permissio
import { ProjectPermissionInsightsActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
import { PgSqlLock } from "@app/keystore/keystore";
import { getConfig } from "@app/lib/config/env";
-import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
import { ActorType } from "@app/services/auth/auth-type";
@@ -120,13 +120,19 @@ export const auditReportServiceFactory = ({
return emails;
}
- // Default to the requesting user's own email.
+ if (!(await canRecipientReadInsights(actor.id))) {
+ throw new ForbiddenRequestError({
+ message:
+ "You do not have permission to view insights, so this report cannot be sent to you. Add recipients who can view insights, or ask an administrator for insights access."
+ });
+ }
+
const user = await userDAL.findById(actor.id);
- if (user?.email) {
- return [user.email];
+ if (!user?.email) {
+ throw new BadRequestError({ message: "At least one email recipient is required" });
}
- throw new BadRequestError({ message: "At least one email recipient is required" });
+ return [user.email];
};
const generateReport = async (dto: TRequestAuditReportDTO, actor: TAuditReportServiceActor) => {
@@ -256,7 +262,7 @@ export const auditReportServiceFactory = ({
return { reports: reports.map(presentAuditReport), totalCount };
};
- const getReportById = async (auditReportId: string, actor: TAuditReportServiceActor) => {
+ const getReportById = async (auditReportId: string, projectId: string, actor: TAuditReportServiceActor) => {
const plan = await licenseService.getPlan(actor.orgId);
if (!plan.secretAccessInsights) {
throw new BadRequestError({
@@ -267,7 +273,7 @@ export const auditReportServiceFactory = ({
const report = await auditReportDAL.findById(auditReportId);
// An org-scoped report id presents as not found on the project endpoints (and vice versa).
- if (!report?.projectId) {
+ if (!report?.projectId || report.projectId !== projectId) {
throw new NotFoundError({ message: `Audit report with ID '${auditReportId}' not found` });
}
@@ -343,11 +349,10 @@ export const auditReportServiceFactory = ({
const reportConfigs = $buildReportConfigs(dto.reports);
- // Reports the instance cannot produce are rejected before anything is persisted, instead of
- // failing at generation time and wasting the org's concurrent-report slot.
const appCfg = getConfig();
+ const isClickhouseAuditLogEnabled = Boolean(appCfg.isClickHouseConfigured && appCfg.CLICKHOUSE_AUDIT_LOG_ENABLED);
const unsupported = reportConfigs.filter(
- (config) => ORG_AUDIT_REPORT_DEFINITIONS[config.type].requiresClickhouse && !appCfg.CLICKHOUSE_AUDIT_LOG_ENABLED
+ (config) => ORG_AUDIT_REPORT_DEFINITIONS[config.type].requiresClickhouse && !isClickhouseAuditLogEnabled
);
if (unsupported.length) {
const labels = unsupported.map((config) => `'${ORG_AUDIT_REPORT_DEFINITIONS[config.type].label}'`).join(", ");
diff --git a/backend/src/services/smtp/emails/AuditReportTemplate.tsx b/backend/src/services/smtp/emails/AuditReportTemplate.tsx
index d93a8bd702..e1b7dc022b 100644
--- a/backend/src/services/smtp/emails/AuditReportTemplate.tsx
+++ b/backend/src/services/smtp/emails/AuditReportTemplate.tsx
@@ -13,12 +13,12 @@ export const AuditReportTemplate = ({ siteUrl, targetName, targetType, reports }
return (
<BaseEmailWrapper title="Report" preview="Your requested report is ready." siteUrl={siteUrl}>
<Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">
- Your <strong>report</strong> is ready
+ Your report is ready
</Heading>
<Section className="px-[24px] mt-[36px] pt-[8px] pb-[8px] text-[14px] border border-solid border-gray-200 rounded-md bg-gray-50">
<Text className="text-[14px]">
- The report you requested for the {targetType} <strong>{targetName}</strong> has been generated. The
- following {reports.length === 1 ? "report is" : "reports are"} attached to this email
+ The report you requested for the {targetType} <strong>{targetName}</strong> has been generated. The following{" "}
+ {reports.length === 1 ? "report is" : "reports are"} attached to this email
{reports.length === 1 ? " as a CSV file" : ", each as its own CSV file"}:
</Text>
{reports.map((report) => (
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
index 6b855abf40..615dc2e8e9 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
+++ b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
@@ -545,7 +545,7 @@ export const ORG_PERMISSION_OBJECT: Record<string, TOrgPermissionConfig> = {
]
},
[OrgPermissionSubjects.ProjectTemplates]: {
- title: "Project Templates",
+ title: "Secrets Management Project Templates",
description: "Manage reusable templates applied when creating new projects",
actions: [
{
@@ -914,7 +914,7 @@ export const ORG_PERMISSION_OBJECT: Record<string, TOrgPermissionConfig> = {
]
},
[OrgPermissionSubjects.SecretShare]: {
- title: "Secret Share",
+ title: "Secrets Management Secret Sharing",
description: "Configure settings for sharing secrets externally",
actions: [
{
@@ -946,7 +946,7 @@ export const ORG_PERMISSION_OBJECT: Record<string, TOrgPermissionConfig> = {
]
},
[OrgPermissionSubjects.HoneyTokens]: {
- title: "Honey Tokens",
+ title: "Secrets Management Honey Tokens",
description: "Configure honey token setup for the organization",
actions: [
{