minutes icon indicating copy to clipboard operation
minutes copied to clipboard

Windows: owner-only DACL attestation fails only in the streaming build

Open silverstein opened this issue 3 months ago • 2 comments

policy_fs::tests::restricted_override_audit_child_process_entry fails on Windows when minutes-core is built with the streaming feature, and passes on the same runner without it.

Surfaced by #797, which adds the missing CI step that runs the core unit tests with streaming enabled. It is not caused by that PR. Until it landed, default = ["whisper"] plus --no-default-features meant this configuration had never been executed in CI at all.

Evidence

Same job, same Windows runner, one run:

19:35:19  cargo test -p minutes-core --no-default-features --lib
          restricted_override_audit_child_process_entry ... ok      (13 passes)

19:44:38  cargo test -p minutes-core --no-default-features --features streaming --lib
          restricted_override_audit_child_process_entry ... FAILED  (4 failures)

The failure, from crates/core/src/overlays.rs:472:

called `Result::unwrap()` on an `Err` value: Custom { kind: Other,
  error: "private correction store DACL is not owner-only" }

Both steps pass --test-threads=1, so this is not concurrency between tests.

What the check is asserting

The owner-only attestation in overlays.rs requires all of: the object owner SID equals the current user, a non-null DACL, SE_DACL_PROTECTED set so nothing is inherited, and exactly one ACE. Any of those failing produces this error.

That test is a child-process entry point: it returns early unless MINUTES_TEST_AUDIT_DIR is set, and it is spawned by restricted_override_audit_serializes_across_processes through current_exe(). So the failing code path is a real child process attesting a real store, not test scaffolding.

Why this is not a silent security hole

It fails closed. The attestation returns an error rather than accepting a store whose DACL it could not verify as owner-only, so the production consequence is a visible failure, not a private store that is quietly world-readable. That is the right direction to fail in, and it is why this is a bug to fix rather than an incident.

What is not yet known

Why the streaming feature changes the outcome at all. policy_fs and overlays do not obviously depend on it. Candidates worth checking, in rough order of likelihood:

  • the spawned child inherits something different from the streaming test binary (working directory, environment, or the filter it runs under)
  • a dependency pulled in only by streaming changes process or handle inheritance on Windows
  • the store path resolves differently in that build

Reproducing needs a Windows machine, not CI: run the two commands above and compare the actual DACL on the audit directory between the two builds.

Unblocking in the meantime

#797 is a correct fix for a separate bug and should not be held behind this. Suggest skipping this one test in the new Windows streaming step, with a comment pointing here, so the rest of the newly enabled Windows coverage still runs rather than disabling the whole step.

silverstein avatar Aug 18 '26 19:08 silverstein

Update: this is intermittent, which settles the open question in the original report.

On the same branch (#797), a later run of Test (windows-latest) passed. The earlier run failed on four of eight concurrent processes. Same code, same runner image, opposite outcome.

That rules out the framing I filed this under. It is not that the streaming feature changes an ACL outcome. Enabling that feature changes the size of the test binary and therefore the timing of eight processes that deliberately race each other, and the race is sometimes lost. The feature flag is a trigger, not a cause.

What that means for the fix:

  • The bug is in concurrent creation or attestation of an owner-only directory, not in anything feature-specific. secure() does if directory && !path.exists(), which is a check followed by a create, with eight processes running it at once. Whoever loses that race takes the other branch and attests a directory another process is still setting up.
  • It will not reproduce reliably on demand, so "I ran it and it passed" is not evidence the bug is gone. Any fix needs to be argued from the code, or verified by looping the test many times, the way #799 was measured at 6 failures in 25 runs before and 0 in 25 after.
  • It still fails closed, so this remains a correctness bug rather than an exposure.

#801 carries a diagnostic that names which of the seven conditions actually trips. Given the intermittency it may need several runs to catch one, so that error-message improvement is worth landing on its own merits regardless: right now a failure here tells you nothing about which invariant was violated.

silverstein avatar Aug 18 '26 21:08 silverstein

Baseline diagnostic result at exact SHA 3dc54f0cf41b72e9d0ffbdb791c960d0b7029c21: the Windows runner completed attempts 1 through 25 and reported "#800 did not reproduce in 25 attempts"; the full job passed. This is honest non-reproduction, not disproof of the race. PR #808 removes the source-proven transient state by attaching the final owner-only protected DACL in SECURITY_ATTRIBUTES at CREATE_NEW; its fresh Windows matrix is running at c652d0cdeb368b45beab0d189c6e0d87addacde0.

silverstein avatar Aug 20 '26 18:08 silverstein