mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Prevent bypassing command permission with leading whitespace
This commit is contained in:
1 parent
c5841b17a0
commit
41d76ff757
1 file changed
+2
-1
@@ -377,9 +377,10 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
|||||||
}
|
}
|
||||||
|
|
||||||
async sendRcon(message: string, expectEmpty = false, plugin = "") {
|
async sendRcon(message: string, expectEmpty = false, plugin = "") {
|
||||||
|
const trimmedMessage = message.trim();
|
||||||
if (
|
if (
|
||||||
!this.config.get("factorio.enable_script_commands")
|
!this.config.get("factorio.enable_script_commands")
|
||||||
&& scriptCommands.find(cmd => message.startsWith(cmd))
|
&& scriptCommands.find(cmd => trimmedMessage.startsWith(cmd))
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Attempted to use script command while disabled. See config factorio.enable_script_commands.\n" +
|
"Attempted to use script command while disabled. See config factorio.enable_script_commands.\n" +
|
||||||
|
|||||||
Reference in new issue
Block a user