1
0
Fork 0
mirror of https://github.com/louislam/dockge.git synced 2025-04-04 23:42:20 +00:00
This commit is contained in:
zx 2025-03-29 18:53:12 +08:00 committed by GitHub
commit 5cb21ec163
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -294,11 +294,14 @@ export class MainTerminal extends InteractiveTerminal {
// Check if the command is allowed
const cmdParts = input.split(" ");
const executable = cmdParts[0].trim();
const knownOperators = ["||", "&", ";"];
log.debug("console", "Executable: " + executable);
log.debug("console", "Executable length: " + executable.length);
if (!allowedCommandList.includes(executable)) {
throw new Error("Command not allowed.");
} else if (knownOperators.some(operator => input.includes(operator))) {
throw new Error("Control operators are not allowed.");
}
super.write(input);
}