fix: Limit ws payload size
This commit is contained in:
@@ -139,6 +139,9 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
|
||||
});
|
||||
|
||||
if (debug) {
|
||||
provider.on("close", (ev: MessageEvent) =>
|
||||
Logger.debug("collaboration", "close", ev)
|
||||
);
|
||||
provider.on("message", (ev: MessageEvent) =>
|
||||
Logger.debug("collaboration", "incoming", {
|
||||
message: ev.message,
|
||||
|
||||
@@ -4,6 +4,7 @@ import url from "url";
|
||||
import { Server } from "@hocuspocus/server";
|
||||
import Koa from "koa";
|
||||
import WebSocket from "ws";
|
||||
import { DocumentValidation } from "@shared/validations";
|
||||
import Logger from "@server/logging/Logger";
|
||||
import AuthenticationExtension from "../collaboration/AuthenticationExtension";
|
||||
import LoggerExtension from "../collaboration/LoggerExtension";
|
||||
@@ -18,6 +19,7 @@ export default function init(
|
||||
const path = "/collaboration";
|
||||
const wss = new WebSocket.Server({
|
||||
noServer: true,
|
||||
maxPayload: DocumentValidation.maxStateLength,
|
||||
});
|
||||
|
||||
const hocuspocus = Server.configure({
|
||||
|
||||
@@ -32,7 +32,7 @@ export const DocumentValidation = {
|
||||
maxTitleLength: 100,
|
||||
|
||||
/** The maximum size of the collaborative document state */
|
||||
maxStateLength: 1000000,
|
||||
maxStateLength: 1500 * 1024,
|
||||
};
|
||||
|
||||
export const PinValidation = {
|
||||
|
||||
Reference in New Issue
Block a user