checkRead method

PermissionDecision checkRead(
  1. String path
)

Check read permission for a file path.

Implementation

PermissionDecision checkRead(String path) {
  final normalized = _normalizePath(path);

  if (isProtectedPath(normalized)) {
    return PermissionDecision(
      level: PermissionLevel.deny,
      reason: 'Path "$normalized" is a protected system path.',
    );
  }

  final risk = _isSensitiveFile(normalized) ? RiskLevel.high : RiskLevel.low;
  final request = PermissionRequest(
    scope: PermissionScope.file,
    action: 'read',
    resource: normalized,
    detail: 'Read file: $normalized',
    riskLevel: risk,
  );

  return _ruleSet.evaluateWithCache(request, _cache);
}