AppSurface Search
API Reference

CoverageArtifacts

Type

CoverageRunArtifactReader

Source

Opens collector artifacts without following symbolic links or accepting non-regular files.

Method

OpenRegularFile

FileStream OpenRegularFile(string projectOutputDirectory, string rawResultsDirectory, string candidate, Action? beforeWindowsCandidateOpen = null) Source

Opens candidate for reading and validates the opened object itself.

Parameters

  • projectOutputDirectoryThe trusted project output root.
  • rawResultsDirectoryThe unique raw-results directory for this invocation.
  • candidateThe enumerated collector artifact path.
  • beforeWindowsCandidateOpenAn optional test seam invoked after Windows parent handles are held.

Remarks

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.

Method

EnsureWindowsDirectoryIdentityUnchanged

void EnsureWindowsDirectoryIdentityUnchanged(WindowsDirectoryIdentity expected, WindowsDirectoryIdentity actual) Source

Rejects a Windows directory that no longer names the same opened file-system object.

Parameters

  • expectedThe path and identity captured before opening the artifact.
  • actualThe path and identity captured after opening the artifact.
Method

ValidateUnixRelativeArtifactPath

string[] ValidateUnixRelativeArtifactPath(string relativePath) Source

Splits a Unix artifact path only after proving that it is a relative descent with no navigation components.

Property

WindowsDirectoryShareMode

uint WindowsDirectoryShareMode { get; } Source

Gets the Windows sharing policy used while holding an artifact parent directory open.

Type

WindowsFileIdentity

Source

Identifies one Windows file-system object independently of its path.

Parameters

  • VolumeSerialNumberThe serial number of the volume containing the object.
  • FileIdThe file identifier reported for the opened object.
Type

WindowsDirectoryIdentity

Source

Associates a Windows directory path with the identity of its opened file-system object.

Parameters

  • PathThe normalized directory path.
  • IdentityThe identity captured from the opened directory handle.
Type

CoverageFileSystemInterop

Source

Provides the native file-system primitives shared by secure coverage path traversal.

Remarks

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.

Method

UnixOpen

int UnixOpen(string path, int flags) Source

Opens a Unix path with the supplied native flags.

Parameters

  • pathThe UTF-8 path to open.
  • flagsThe platform-specific native open flags.

Returns

A nonnegative file descriptor on success; otherwise -1.

Method

UnixOpenAt

2 overloads
int UnixOpenAt(int directoryDescriptor, string path, int flags) Source

Opens a Unix path relative to an existing directory descriptor.

Parameters

  • directoryDescriptorThe descriptor of the directory from which traversal starts.
  • pathThe UTF-8 relative path to open.
  • flagsThe platform-specific native open flags.

Returns

A nonnegative file descriptor on success; otherwise -1.

int UnixOpenAt(int directoryDescriptor, string path, int flags, uint mode) Source

Opens or creates a Unix path relative to an existing directory descriptor.

Parameters

  • directoryDescriptorThe descriptor of the directory from which traversal starts.
  • pathThe UTF-8 relative path to open or create.
  • flagsThe platform-specific native open flags.
  • modeThe permissions applied when the flags create a new object.

Returns

A nonnegative file descriptor on success; otherwise -1.

Method

UnixFStat

int UnixFStat(int descriptor, nint buffer) Source

Reads native metadata for an open Unix descriptor into a caller-owned buffer.

Parameters

  • descriptorThe open descriptor to inspect.
  • bufferA caller-owned buffer large enough for the platform's native stat structure.

Returns

Zero on success; otherwise -1.

Method

UnixFChmod

int UnixFChmod(int descriptor, uint mode) Source

Changes the permissions of an open Unix descriptor.

Parameters

  • descriptorThe open descriptor whose permissions should be changed.
  • modeThe requested Unix permission bits.

Returns

Zero on success; otherwise -1.

Method

WindowsCreateFile

SafeFileHandle WindowsCreateFile(string fileName, uint desiredAccess, uint shareMode, nint securityAttributes, uint creationDisposition, uint flagsAndAttributes, nint templateFile) Source

Opens or creates a Windows file-system object without applying managed path traversal.

Parameters

  • fileNameThe UTF-16 path to open.
  • desiredAccessThe requested native access mask.
  • shareModeThe native sharing mask retained for the handle lifetime.
  • securityAttributesAn optional native security-attributes pointer.
  • creationDispositionThe native create-or-open disposition.
  • flagsAndAttributesThe native file flags and attributes.
  • templateFileAn optional template-file handle.

Returns

A handle that is invalid when the native open fails.

Method

WindowsGetFileInformationByHandleEx

bool WindowsGetFileInformationByHandleEx(SafeFileHandle handle, int fileInformationClass, out WindowsFileAttributeTagInformation fileInformation, uint bufferSize) Source

Reads the attribute and reparse-tag metadata for an open Windows handle.

Parameters

  • handleThe open handle to inspect.
  • fileInformationClassThe native information-class identifier.
  • fileInformationReceives the file attributes and reparse tag.
  • bufferSizeThe size of fileInformation in bytes.

Returns

true on success; otherwise false.

Method

WindowsGetFileInformationByHandle

bool WindowsGetFileInformationByHandle(SafeFileHandle handle, out WindowsByHandleFileInformation fileInformation) Source

Reads stable file-system identity metadata for an open Windows handle.

Parameters

  • handleThe open handle to inspect.
  • fileInformationReceives the native identity and size metadata.

Returns

true on success; otherwise false.

Method

WindowsGetFileType

uint WindowsGetFileType(SafeFileHandle handle) Source

Gets the Windows object type associated with an open handle.

Parameters

  • handleThe open handle to classify.

Returns

The native file-type constant, or zero when the call fails.

Method

WindowsGetFinalPathNameByHandle

uint WindowsGetFinalPathNameByHandle(SafeFileHandle handle, Span<char> path, uint flags) Source

Resolves the final Windows path for an open handle into the supplied buffer.

Parameters

  • handleThe open file-system handle.
  • pathThe destination buffer, including space for the terminator.
  • flagsThe native volume-name formatting flags.

Returns

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.

Type

WindowsFileAttributeTagInformation

Source

Contains Windows file attributes and the reparse tag for an open handle.

Type

WindowsByHandleFileInformation

Source

Contains stable identity and size metadata for an open Windows handle.

Type

WindowsFileTime

Source

Represents the blittable two-word layout of a native Windows FILETIME.