MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / isCommandSafe

Method isCommandSafe

tools/ExecuteTerminalCommandTool.cpp:375–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375bool 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
391bool ExecuteTerminalCommandTool::areArgumentsSafe(const QString &args) const
392{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected