Class PathGuard
Guards file-system operations against accessing protected user data directories. Any path that resolves into a protected directory is rejected.
public static class PathGuard
- Inheritance
-
PathGuard
- Inherited Members
Methods
ContainsProtectedPath(string)
Returns true if the command string contains references to any protected directory.
Used by ShellTools to reject commands that target protected paths.
Known limitation: This is a best-effort heuristic based on substring matching. It can be bypassed via shell variable expansion, backtick substitution, or encoding. The primary security boundary is IsProtected(string) on direct file operations.
public static bool ContainsProtectedPath(string commandText)
Parameters
commandTextstring
Returns
EnsureAllowed(string)
Throws PathGuardException if path resolves
into a protected directory.
public static void EnsureAllowed(string path)
Parameters
pathstring
IsProtected(string)
Returns true if the given path resolves into a protected directory.
public static bool IsProtected(string path)
Parameters
pathstring