checkBashCommand method

PermissionDecision checkBashCommand(
  1. String command
)

Check a bash command string for dangerous patterns.

Implementation

PermissionDecision checkBashCommand(String command) {
  final (isDangerous, reason) = _checkBashDangers(command);

  final request = PermissionRequest(
    scope: PermissionScope.tool,
    action: 'bash',
    resource: command.length > 80
        ? '${command.substring(0, 80)}...'
        : command,
    toolName: 'Bash',
    detail: isDangerous
        ? 'Bash command (WARNING: $reason): $command'
        : 'Bash command: $command',
    riskLevel: isDangerous ? RiskLevel.critical : RiskLevel.high,
    metadata: {'fullCommand': command},
  );

  return _ruleSet.evaluateWithCache(request, _cache);
}