Hello @Branson Deeter ,
I checked each of your points against the current documentation and ran a quick test on Windows 11 25H2, and your reading is right: there is no single built-in Windows mechanism that enforces all of those limits before the fact. Below is what I found for each one.
For writable paths, NTFS ACLs with the workload running under its own SID, or an AppContainer, do prevent access at open time. The one thing to watch is inherited handles, because they keep the access they were opened with and the ACL is not checked again. I would restrict them at CreateProcess with PROC_THREAD_ATTRIBUTE_HANDLE_LIST rather than trying to police them afterwards.
For total storage, an NTFS hard quota on that SID is genuinely preventive. In my test a 40 MB write failed with ERROR_DISK_FULL exactly at the 20 MB limit, and CreateFileMapping or extending a mapped file past the limit failed too, so mmap growth is covered. It does not count bytes written though: overwriting the same 1 MB region 100 times left quota usage at 1 MB. It also cannot be applied to Administrators, and files created by an elevated process or a service are owned by Administrators or SYSTEM, so quota simply does not bind to them. If you need a ceiling that applies to every writer regardless of token, the only built-in option I know of is a fixed-size VHDX used as the workspace volume.
For cumulative bytes written, the Job Object JOB_OBJECT_LIMIT_JOB_WRITE_BYTES limit is detect-only, exactly as you suspected. The documentation says processes "continue to run and can continue to transmit read or write bytes beyond the specified limits". In my runs the notification arrived 2 to 8 seconds late, at 26 to 104 MB against a 10 MB limit, and memory-mapped writes were not counted at all. It can still be useful if a delayed TerminateJobObject is acceptable. I would not rely on SetIoRateControlInformationJobObject: it is a rate control rather than a cap, and its page states it is not supported on Windows 10 1607 and later.
For per-file size and file or directory counts, I could not find any built-in mechanism, preventive or otherwise.
On your numbered questions:
- Preventive: ACLs or AppContainer, NTFS hard quota, fixed VHDX. Detective: Job Object limits, IO_COUNTERS, the USN journal. Neither: file size and counts.
- NTFS quota needs an NTFS volume (not ReFS) and a non-admin SID; FSRM folder quotas exist but only on Windows Server. Job notification limits need Windows 8 or Server 2012 and later, and you should set neither breakaway flag so Git children stay in the job. AppContainer needs Windows 8 or later. Windows Sandbox needs Pro, Enterprise or Education. Attaching a VHDX needs admin.
- Yes, you need an additional provider for file size, counts and a hard cumulative cap, and the supported extension point for that is a file system minifilter. Windows even reserves a load-order group for it, "FSFilter Quota Management" at altitude 240000 to 249999, and a pre-operation callback can fail the operation before it reaches the file system. Memory-mapped writes do arrive at the filter as paging I/O, but the requesting process is often System, so I would attribute them through a file context captured at IRP_MJ_CREATE. The driver has to be signed through the Hardware Dev Center with an EV certificate, attestation signing for client and HLK for Server.
- Git runs fine inside a Job Object with breakaway disabled. Redirected stdio handles must be included in the handle list or the child will not get them. Quota and VHDX limits show up to Git as ERROR_DISK_FULL, which it treats as a normal write failure. TerminateJobObject leaves stale .lock files behind, and deleting the workspace clears them. I would avoid AppContainer for real Git because HOME, temp, config and credential helpers all need explicit grants.
The pages I relied on:
- JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION structure
- Job Objects
- SetIoRateControlInformationJobObject function
- Managing Disk Quotas
- CreateVirtualDisk function
- Launch an AppContainer
- UpdateProcThreadAttribute function
- Filter Manager Concepts
- Load Order Groups and Altitudes for Minifilter Drivers
- Driver Signing Policy
One note on scope: this forum does not have access to the Windows product source, internal design notes or the engineering teams, so I cannot issue an official support statement from here. The above is capability guidance from public documentation plus my own verification. If you need Microsoft to formally confirm the support boundaries, in particular for the minifilter route, a Windows developer support case is the right channel for that.
Hope these information help! If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.