uint WindowsDirectoryShareMode { get; }
Source
Gets the Windows sharing policy used while holding an artifact parent directory open.
Opens collector artifacts without following symbolic links or accepting non-regular files.
FileStream OpenRegularFile(string projectOutputDirectory, string rawResultsDirectory, string candidate, Action? beforeWindowsCandidateOpen = null)
Opens candidate
for reading and validates the opened object itself.
projectOutputDirectory
rawResultsDirectory
candidate
beforeWindowsCandidateOpen
Every untrusted path component is traversed without following links on Unix. On Windows, the opened handle is rejected when it is a reparse point or non-disk file, and its final path must remain beneath the already-open raw-results directory. Unsupported platforms fail closed.
void EnsureWindowsDirectoryIdentityUnchanged(WindowsDirectoryIdentity expected, WindowsDirectoryIdentity actual)
Rejects a Windows directory that no longer names the same opened file-system object.
expected
actual
string[] ValidateUnixRelativeArtifactPath(string relativePath)
Splits a Unix artifact path only after proving that it is a relative descent with no navigation components.
Identifies one Windows file-system object independently of its path.
VolumeSerialNumber
FileId
Associates a Windows directory path with the identity of its opened file-system object.
Path
Identity
Provides the native file-system primitives shared by secure coverage path traversal.
This type contains only the operating-system boundary. Callers remain responsible for choosing no-follow flags, validating object kinds and identities, and retaining handles for the lifetime of each security-sensitive operation.
int UnixOpen(string path, int flags)
Opens a Unix path with the supplied native flags.
path
flags
A nonnegative file descriptor on success; otherwise -1
.
int UnixOpenAt(int directoryDescriptor, string path, int flags)
Opens a Unix path relative to an existing directory descriptor.
directoryDescriptor
path
flags
A nonnegative file descriptor on success; otherwise -1
.
int UnixOpenAt(int directoryDescriptor, string path, int flags, uint mode)
Opens or creates a Unix path relative to an existing directory descriptor.
directoryDescriptor
path
flags
mode
A nonnegative file descriptor on success; otherwise -1
.
int UnixFStat(int descriptor, nint buffer)
Reads native metadata for an open Unix descriptor into a caller-owned buffer.
descriptor
buffer
Zero on success; otherwise -1
.
int UnixFChmod(int descriptor, uint mode)
Changes the permissions of an open Unix descriptor.
descriptor
mode
Zero on success; otherwise -1
.
SafeFileHandle WindowsCreateFile(string fileName, uint desiredAccess, uint shareMode, nint securityAttributes, uint creationDisposition, uint flagsAndAttributes, nint templateFile)
Opens or creates a Windows file-system object without applying managed path traversal.
fileName
desiredAccess
shareMode
securityAttributes
creationDisposition
flagsAndAttributes
templateFile
A handle that is invalid when the native open fails.
bool WindowsGetFileInformationByHandleEx(SafeFileHandle handle, int fileInformationClass, out WindowsFileAttributeTagInformation fileInformation, uint bufferSize)
Reads the attribute and reparse-tag metadata for an open Windows handle.
handle
fileInformationClass
fileInformation
bufferSize
fileInformation
in bytes.
true
on success; otherwise false
.
bool WindowsGetFileInformationByHandle(SafeFileHandle handle, out WindowsByHandleFileInformation fileInformation)
Reads stable file-system identity metadata for an open Windows handle.
handle
fileInformation
true
on success; otherwise false
.
uint WindowsGetFileType(SafeFileHandle handle)
Gets the Windows object type associated with an open handle.
handle
The native file-type constant, or zero when the call fails.
uint WindowsGetFinalPathNameByHandle(SafeFileHandle handle, Span<char> path, uint flags)
Resolves the final Windows path for an open handle into the supplied buffer.
handle
path
flags
The path length excluding the terminator, or the required buffer length when the buffer is too small; zero indicates failure and leaves the native error available to the caller.
Contains Windows file attributes and the reparse tag for an open handle.
Contains stable identity and size metadata for an open Windows handle.
Represents the blittable two-word layout of a native Windows FILETIME
.