Prevent bypassing command permission with leading whitespace

This commit is contained in:
Daniel authored and Daniel committed 2024-11-21 08:46:22 -08:00
1 parent c5841b17a0
commit 41d76ff757
1 file changed
+2 -1
+2 -1
View File
@@ -377,9 +377,10 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
}
async sendRcon(message: string, expectEmpty = false, plugin = "") {
const trimmedMessage = message.trim();
if (
!this.config.get("factorio.enable_script_commands")
&& scriptCommands.find(cmd => message.startsWith(cmd))
&& scriptCommands.find(cmd => trimmedMessage.startsWith(cmd))
) {
throw new Error(
"Attempted to use script command while disabled. See config factorio.enable_script_commands.\n" +