| 373 | } |
| 374 | |
| 375 | bool ExecuteTerminalCommandTool::isCommandSafe(const QString &command) const |
| 376 | { |
| 377 | #ifdef Q_OS_WIN |
| 378 | static const QRegularExpression safePattern("^[a-zA-Z0-9._/\\\\:-]+$"); |
| 379 | #else |
| 380 | static const QRegularExpression safePattern("^[a-zA-Z0-9._/-]+$"); |
| 381 | #endif |
| 382 | |
| 383 | const bool isSafe = safePattern.match(command).hasMatch(); |
| 384 | if (!isSafe) { |
| 385 | LOG_MESSAGE(QString("ExecuteTerminalCommandTool: Command '%1' failed safety check") |
| 386 | .arg(command)); |
| 387 | } |
| 388 | return isSafe; |
| 389 | } |
| 390 | |
| 391 | bool ExecuteTerminalCommandTool::areArgumentsSafe(const QString &args) const |
| 392 | { |
nothing calls this directly
no outgoing calls
no test coverage detected