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)

Opens candidate for reading and validates the opened object itself.

Parameters

  • projectOutputDirectory
    The trusted project output root.
  • rawResultsDirectory
    The unique raw-results directory for this invocation.
  • candidate
    The enumerated collector artifact path.
  • beforeWindowsCandidateOpen
    An 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)

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

Parameters

  • expected
    The path and identity captured before opening the artifact.
  • actual
    The path and identity captured after opening the artifact.
Method

ValidateUnixRelativeArtifactPath

string[] ValidateUnixRelativeArtifactPath(string relativePath)

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

  • VolumeSerialNumber
    The serial number of the volume containing the object.
  • FileId
    The 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

  • Path
    The normalized directory path.
  • Identity
    The 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)

Opens a Unix path with the supplied native flags.

Parameters

  • path
    The UTF-8 path to open.
  • flags
    The 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)

Opens a Unix path relative to an existing directory descriptor.

Parameters

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

Returns

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.

Parameters

  • directoryDescriptor
    The descriptor of the directory from which traversal starts.
  • path
    The UTF-8 relative path to open or create.
  • flags
    The platform-specific native open flags.
  • mode
    The 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)

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

Parameters

  • descriptor
    The open descriptor to inspect.
  • buffer
    A 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)

Changes the permissions of an open Unix descriptor.

Parameters

  • descriptor
    The open descriptor whose permissions should be changed.
  • mode
    The 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)

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

Parameters

  • fileName
    The UTF-16 path to open.
  • desiredAccess
    The requested native access mask.
  • shareMode
    The native sharing mask retained for the handle lifetime.
  • securityAttributes
    An optional native security-attributes pointer.
  • creationDisposition
    The native create-or-open disposition.
  • flagsAndAttributes
    The native file flags and attributes.
  • templateFile
    An 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)

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

Parameters

  • handle
    The open handle to inspect.
  • fileInformationClass
    The native information-class identifier.
  • fileInformation
    Receives the file attributes and reparse tag.
  • bufferSize
    The size of fileInformation in bytes.

Returns

true on success; otherwise false .

Method

WindowsGetFileInformationByHandle

bool WindowsGetFileInformationByHandle(SafeFileHandle handle, out WindowsByHandleFileInformation fileInformation)

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

Parameters

  • handle
    The open handle to inspect.
  • fileInformation
    Receives the native identity and size metadata.

Returns

true on success; otherwise false .

Method

WindowsGetFileType

uint WindowsGetFileType(SafeFileHandle handle)

Gets the Windows object type associated with an open handle.

Parameters

  • handle
    The 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)

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

Parameters

  • handle
    The open file-system handle.
  • path
    The destination buffer, including space for the terminator.
  • flags
    The 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 .