Documentation
¶
Overview ¶
Package winpath provides fail-closed, handle-derived Windows path identity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedPath = errors.New("sandbox: unsupported Windows path") // ErrReparsePoint identifies the unsupported-path subset caused by a // reparse-point component. Callers that expose policy vocabulary can map // this filesystem-mechanism error without parsing an error string. ErrReparsePoint = errors.New("sandbox: Windows reparse-point path") )
Functions ¶
func Compare ¶
Compare orders path keys with CompareStringOrdinal's case-insensitive UTF-16 semantics. It returns -1, 0, or 1.
func HasPrefix ¶
HasPrefix reports whether value begins with prefix under ordinal case-insensitive UTF-16 comparison.
func Normalize ¶
Normalize validates a path spelling without widening it and returns an absolute DOS-drive spelling suitable for CreateFileW.
func VolumeRoots ¶
VolumeRoots enumerates every supported fixed local NTFS/ReFS volume. A volume with no drive letter is represented by its ordinal-lowest DOS mount path; volume GUID paths never escape this package.
Types ¶
type Object ¶
type Object struct {
Handle windows.Handle
DOSPath string
PathKey string
VolumeSerial uint64
FileID [16]byte
Kind Kind
ReparseTag uint32
LinkCount uint32
// contains filtered or unexported fields
}
Object owns a no-follow Windows handle and the identity obtained from it.
func Open ¶
Open validates path, rejects reparse-point ancestors, and captures complete stable identity from an owned no-follow handle.
func OpenForACL ¶
OpenForACL performs the same no-follow component walk as Open, but opens the final object with the authority needed to inspect and replace its DACL. The returned handle never grants delete sharing. freezeWrites additionally denies data-write sharing while a tree is enumerated and projected.
This operation exists here, rather than being assembled by ACL callers, because handles created by NtCreateFile during the component walk cannot be safely assumed to be valid ReOpenFile inputs. The ACL-capable handle is the final result of the identity-preserving walk itself.
func OpenPinned ¶
OpenPinned is Open with delete-sharing denied. This prevents ordinary Win32 delete opens while the returned object is held, but it is only defense in depth: filesystems that support POSIX-style rename can still move a named object without honoring this sharing exclusion. Callers that rely on a path continuing to name this object must re-open and compare the complete identity before use. The retained handle itself continues to identify the original object even when its name moves.
func (*Object) SameIdentity ¶
SameIdentity compares every security-relevant identity field.