hasRestrictedFds function

bool hasRestrictedFds(
  1. String command
)

Check if a command uses restricted file descriptors.

Implementation

bool hasRestrictedFds(String command) {
  final fdPattern = RegExp(r'(\d+)([<>])');
  for (final match in fdPattern.allMatches(command)) {
    final fd = int.tryParse(match.group(1)!);
    if (fd != null && !_allowedFds.contains(fd)) {
      return true;
    }
  }

  // Check /dev/fd/N access
  if (RegExp(r'/dev/fd/[3-9]').hasMatch(command)) return true;

  return false;
}