Documentation
¶
Overview ¶
Package platformpath provides OS-specific path safety helpers.
This package centralizes platform-specific path validation that was previously duplicated across multiple packages. It provides:
- UNC path detection for Windows
- Local path validation
- Platform-specific path safety checks
Security Properties ¶
These helpers prevent attacks that exploit platform-specific path semantics:
- UNC paths (\\server\share) could redirect operations to remote servers
- Path separators vary by platform
- Drive letters are Windows-specific
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasDriveLetter ¶
HasDriveLetter returns true if the path starts with a Windows drive letter (C:, D:, etc.).
func IsLocalWindowsPath ¶
IsLocalWindowsPath checks if a path is a local Windows path (not UNC or otherwise unsafe). Returns true for paths like "C:\Users\..." and false for UNC paths like "\\server\share".
SECURITY: UNC paths could redirect file operations to remote servers controlled by an attacker. Helps prevent SSRF-like attacks via environment variables like LOCALAPPDATA or user-provided paths.
Safe to call on any platform - checks path string format without filesystem access.
Types ¶
This section is empty.