mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 23:04:52 +09:00
Validate messages received on the controller from hosts and control nodes before handling or forwarding them. This should prevent performing actions that are not allowed by the role system and block simple attacks such as spoofing the source address of a message.
37 lines
652 B
JavaScript
37 lines
652 B
JavaScript
"use strict";
|
|
|
|
class ChatEvent {
|
|
static type = "event";
|
|
static src = ["control", "instance"];
|
|
static dst = "instance";
|
|
static plugin = "global_chat";
|
|
static permission = null;
|
|
|
|
/** @type {string} */
|
|
instanceName;
|
|
/** @type {string} */
|
|
content;
|
|
|
|
constructor(instanceName, content) {
|
|
this.instanceName = instanceName;
|
|
this.content = content;
|
|
}
|
|
|
|
static jsonSchema = {
|
|
type: "object",
|
|
required: ["instanceName", "content"],
|
|
properties: {
|
|
instanceName: { type: "string" },
|
|
content: { type: "string" },
|
|
},
|
|
};
|
|
|
|
static fromJSON(json) {
|
|
return new this(json.instanceName, json.content);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
ChatEvent,
|
|
};
|