Compare commits
1 Commits
fix/csrf-d
...
feat/proje
| Author | SHA1 | Date | |
|---|---|---|---|
| 572e0592b1 |
@@ -1,7 +1,7 @@
|
|||||||
import { Controller, Get, Query, Param, UseGuards } from "@nestjs/common";
|
import { Controller, Get, Query, Param, UseGuards } from "@nestjs/common";
|
||||||
import { ActivityService } from "./activity.service";
|
import { ActivityService } from "./activity.service";
|
||||||
import { EntityType } from "@prisma/client";
|
import { EntityType } from "@prisma/client";
|
||||||
import { QueryActivityLogDto } from "./dto";
|
import type { QueryActivityLogDto } from "./dto";
|
||||||
import { AuthGuard } from "../auth/guards/auth.guard";
|
import { AuthGuard } from "../auth/guards/auth.guard";
|
||||||
import { WorkspaceGuard, PermissionGuard } from "../common/guards";
|
import { WorkspaceGuard, PermissionGuard } from "../common/guards";
|
||||||
import { Workspace, Permission, RequirePermission } from "../common/decorators";
|
import { Workspace, Permission, RequirePermission } from "../common/decorators";
|
||||||
|
|||||||
@@ -111,9 +111,14 @@ export class CsrfGuard implements CanActivate {
|
|||||||
|
|
||||||
throw new ForbiddenException("CSRF token not bound to session");
|
throw new ForbiddenException("CSRF token not bound to session");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.logger.debug({
|
||||||
|
event: "CSRF_SKIP_SESSION_BINDING",
|
||||||
|
method: request.method,
|
||||||
|
path: request.path,
|
||||||
|
reason: "User context not yet available (global guard runs before AuthGuard)",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// Note: when userId is absent, the double-submit cookie check above is
|
|
||||||
// sufficient CSRF protection. AuthGuard populates request.user afterward.
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { DashboardService } from "./dashboard.service";
|
|||||||
import { AuthGuard } from "../auth/guards/auth.guard";
|
import { AuthGuard } from "../auth/guards/auth.guard";
|
||||||
import { WorkspaceGuard, PermissionGuard } from "../common/guards";
|
import { WorkspaceGuard, PermissionGuard } from "../common/guards";
|
||||||
import { Workspace, Permission, RequirePermission } from "../common/decorators";
|
import { Workspace, Permission, RequirePermission } from "../common/decorators";
|
||||||
import { DashboardSummaryDto } from "./dto";
|
import type { DashboardSummaryDto } from "./dto";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for dashboard endpoints.
|
* Controller for dashboard endpoints.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import type { AuthUser } from "@mosaic/shared";
|
|||||||
import { CurrentUser } from "../auth/decorators/current-user.decorator";
|
import { CurrentUser } from "../auth/decorators/current-user.decorator";
|
||||||
import { AdminGuard } from "../auth/guards/admin.guard";
|
import { AdminGuard } from "../auth/guards/admin.guard";
|
||||||
import { AuthGuard } from "../auth/guards/auth.guard";
|
import { AuthGuard } from "../auth/guards/auth.guard";
|
||||||
import {
|
import type {
|
||||||
CreateProviderDto,
|
CreateProviderDto,
|
||||||
ResetPasswordDto,
|
ResetPasswordDto,
|
||||||
UpdateAgentConfigDto,
|
UpdateAgentConfigDto,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Controller, Get, Param, Query } from "@nestjs/common";
|
import { Controller, Get, Param, Query } from "@nestjs/common";
|
||||||
import type { LlmUsageLog } from "@prisma/client";
|
import type { LlmUsageLog } from "@prisma/client";
|
||||||
import { LlmUsageService } from "./llm-usage.service";
|
import { LlmUsageService } from "./llm-usage.service";
|
||||||
import { UsageAnalyticsQueryDto, UsageAnalyticsResponseDto } from "./dto";
|
import type { UsageAnalyticsQueryDto, UsageAnalyticsResponseDto } from "./dto";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LLM Usage Controller
|
* LLM Usage Controller
|
||||||
|
|||||||
@@ -66,9 +66,7 @@ interface StartTranscriptionPayload {
|
|||||||
@WSGateway({
|
@WSGateway({
|
||||||
namespace: "/speech",
|
namespace: "/speech",
|
||||||
cors: {
|
cors: {
|
||||||
origin: (process.env.TRUSTED_ORIGINS ?? process.env.WEB_URL ?? "http://localhost:3000")
|
origin: process.env.WEB_URL ?? "http://localhost:3000",
|
||||||
.split(",")
|
|
||||||
.map((s) => s.trim()),
|
|
||||||
credentials: true,
|
credentials: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -63,9 +63,7 @@ interface AuthenticatedSocket extends Socket {
|
|||||||
@WSGateway({
|
@WSGateway({
|
||||||
namespace: "/terminal",
|
namespace: "/terminal",
|
||||||
cors: {
|
cors: {
|
||||||
origin: (process.env.TRUSTED_ORIGINS ?? process.env.WEB_URL ?? "http://localhost:3000")
|
origin: process.env.WEB_URL ?? "http://localhost:3000",
|
||||||
.split(",")
|
|
||||||
.map((s) => s.trim()),
|
|
||||||
credentials: true,
|
credentials: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { WidgetsService } from "./widgets.service";
|
|||||||
import { WidgetDataService } from "./widget-data.service";
|
import { WidgetDataService } from "./widget-data.service";
|
||||||
import { AuthGuard } from "../auth/guards/auth.guard";
|
import { AuthGuard } from "../auth/guards/auth.guard";
|
||||||
import { WorkspaceGuard } from "../common/guards/workspace.guard";
|
import { WorkspaceGuard } from "../common/guards/workspace.guard";
|
||||||
import { StatCardQueryDto, ChartQueryDto, ListQueryDto, CalendarPreviewQueryDto } from "./dto";
|
import type { StatCardQueryDto, ChartQueryDto, ListQueryDto, CalendarPreviewQueryDto } from "./dto";
|
||||||
import type { RequestWithWorkspace } from "../common/types/user.types";
|
import type { RequestWithWorkspace } from "../common/types/user.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { WorkspaceGuard, PermissionGuard } from "../common/guards";
|
|||||||
import { Permission, RequirePermission } from "../common/decorators";
|
import { Permission, RequirePermission } from "../common/decorators";
|
||||||
import type { WorkspaceMember } from "@prisma/client";
|
import type { WorkspaceMember } from "@prisma/client";
|
||||||
import type { AuthenticatedUser } from "../common/types/user.types";
|
import type { AuthenticatedUser } from "../common/types/user.types";
|
||||||
import { AddMemberDto, UpdateMemberRoleDto, WorkspaceResponseDto } from "./dto";
|
import type { AddMemberDto, UpdateMemberRoleDto, WorkspaceResponseDto } from "./dto";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User-scoped workspace operations.
|
* User-scoped workspace operations.
|
||||||
|
|||||||
@@ -46,21 +46,3 @@ export async function updateTask(
|
|||||||
const res = await apiPatch<ApiResponse<Task>>(`/api/tasks/${id}`, data, workspaceId);
|
const res = await apiPatch<ApiResponse<Task>>(`/api/tasks/${id}`, data, workspaceId);
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateTaskInput {
|
|
||||||
title: string;
|
|
||||||
description?: string;
|
|
||||||
status?: TaskStatus;
|
|
||||||
priority?: TaskPriority;
|
|
||||||
dueDate?: string;
|
|
||||||
projectId?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new task
|
|
||||||
*/
|
|
||||||
export async function createTask(data: CreateTaskInput, workspaceId?: string): Promise<Task> {
|
|
||||||
const { apiPost } = await import("./client");
|
|
||||||
const res = await apiPost<ApiResponse<Task>>("/api/tasks", data, workspaceId);
|
|
||||||
return res.data;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ services:
|
|||||||
# Matrix bridge (optional — configure after Synapse is running)
|
# Matrix bridge (optional — configure after Synapse is running)
|
||||||
MATRIX_HOMESERVER_URL: ${MATRIX_HOMESERVER_URL:-http://synapse:8008}
|
MATRIX_HOMESERVER_URL: ${MATRIX_HOMESERVER_URL:-http://synapse:8008}
|
||||||
MATRIX_ACCESS_TOKEN: ${MATRIX_ACCESS_TOKEN:-}
|
MATRIX_ACCESS_TOKEN: ${MATRIX_ACCESS_TOKEN:-}
|
||||||
# System admin IDs (comma-separated user UUIDs) for auth settings access
|
|
||||||
SYSTEM_ADMIN_IDS: ${SYSTEM_ADMIN_IDS:-}
|
|
||||||
MATRIX_BOT_USER_ID: ${MATRIX_BOT_USER_ID:-}
|
MATRIX_BOT_USER_ID: ${MATRIX_BOT_USER_ID:-}
|
||||||
MATRIX_CONTROL_ROOM_ID: ${MATRIX_CONTROL_ROOM_ID:-}
|
MATRIX_CONTROL_ROOM_ID: ${MATRIX_CONTROL_ROOM_ID:-}
|
||||||
MATRIX_WORKSPACE_ID: ${MATRIX_WORKSPACE_ID:-}
|
MATRIX_WORKSPACE_ID: ${MATRIX_WORKSPACE_ID:-}
|
||||||
|
|||||||
Reference in New Issue
Block a user