feat: Improve execute terminal commands tool

This commit is contained in:
Petr Mironychev
2025-11-27 01:12:21 +01:00
parent 85a7bba90e
commit 9b0ae98f02
7 changed files with 378 additions and 70 deletions

View File

@ -40,7 +40,18 @@ public:
private:
bool isCommandAllowed(const QString &command) const;
bool isCommandSafe(const QString &command) const;
bool areArgumentsSafe(const QString &args) const;
QStringList getAllowedCommands() const;
QString getCommandDescription() const;
QString sanitizeOutput(const QString &output, qint64 maxSize) const;
// Constants for production safety
static constexpr int COMMAND_TIMEOUT_MS = 30000; // 30 seconds
static constexpr qint64 MAX_OUTPUT_SIZE = 10 * 1024 * 1024; // 10 MB
static constexpr int MAX_COMMAND_LENGTH = 1024;
static constexpr int MAX_ARGS_LENGTH = 4096;
static constexpr int PROCESS_START_TIMEOUT_MS = 3000;
};
} // namespace QodeAssist::Tools