agent-desktop/probes/windows/scratch
Lahfir 9e0a7267a8 feat: probe windows private-file primitives for the 2.1 hardening design
Answers the four questions sub-phase 2.1 rebuilds its private-file layer
against, measured on the real OS with verbatim Win32 error codes. Three of
the four contradict the framing this work was planned under.

Rename: MoveFileEx cannot replace a target that has any open handle, and it
reports ERROR_ACCESS_DENIED rather than the sharing violation the plan
assumed -- FILE_SHARE_DELETE does not rescue it, because MoveFileEx issues
ReplaceIfExists rather than POSIX-semantics rename. ReplaceFile is the
operation that honors share-delete on the destination, but it is the one
that refuses an open handle on the replacement source. The two APIs have
opposite tolerances on opposite sides, so code treating error 32 as the
sharing case misclassifies the most likely production failure.

Ownership: new files take their owner from TokenOwner, never TokenUser, at
both High and Medium integrity. Integrity level is not the variable -- the
default follows admin-group membership, so an owner-only DACL check breaks
for any admin account regardless of elevation.

Locality: GetFileInformationByHandleEx(FileRemoteProtocolInfo) does
distinguish local from remote, but signals local by failing with
ERROR_INVALID_PARAMETER rather than succeeding with a local protocol value.
An out-of-range info class returns that same error, so the code is ambiguous
and a control call is required before reading it as a locality signal.

ACL: neither leaf carries an explicit ACE. The restriction is authored at
the nearest protected ancestor and merely propagated, so a leaf-only check
sees the effective grants but cannot tell whether they are anchored or
silently re-derivable, and cannot see FILE_DELETE_CHILD on the parent.
2026-07-26 03:21:06 -06:00
..
build-scratch.ps1 feat: add winforms and wpf scratch fixtures with explicit automation ids 2026-07-26 03:05:50 -06:00
PrivateFileProbe.cs feat: probe windows private-file primitives for the 2.1 hardening design 2026-07-26 03:21:06 -06:00
ScratchForms.cs feat: add winforms and wpf scratch fixtures with explicit automation ids 2026-07-26 03:05:50 -06:00
ScratchWpf.ps1 feat: add winforms and wpf scratch fixtures with explicit automation ids 2026-07-26 03:05:50 -06:00