Skip to content

fix(permissions): preserve Windows ACL verification diagnostics - #152

Merged
steipete merged 1 commit into
mainfrom
fix/windows-acl-diagnostics
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/windows-acl-diagnostics

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Problem

Windows ACL verification flattened an underlying command failure into a generic permission-unverified error, discarding the stderr, exit status, and timing needed to diagnose it. The flaky first-run CI job from PR #149 illustrates the diagnostic gap on contended Windows runners.

PR #99 raised the built-in deadline to 30 seconds per subprocess. This change preserves evidence when a command still fails, making those failures diagnosable and giving any future retry condition real diagnostics to inspect.

Change

  • Add a typed PermissionCommandError with command timing in permission-exec; propagate a structured PermissionCommandFailure containing command, durationMs, timedOut, exitCode, signal, and sanitized, bounded stderr.
  • Thread errorDetail and errorCause through inspectWindowsOwner, inspectWindowsAcl, and PermissionCheck.
  • Attach the diagnostics to FsSafeError details and cause, and enrich its message in secure-file.
  • Sanitize diagnostics with formatErrorDetail and a 400-character cap. Capture stderr only, never stdout or file contents.
  • Preserve command attribution so failures distinguish powershell.exe from icacls.exe, including failures reached through whoami.
  • Export PermissionCommandFailure through the /permissions and /advanced package subpaths.
  • Update the permission and secure-file documentation and changelog.

Unchanged

Security assertion semantics, error codes, throw conditions, and fail-closed behavior remain unchanged. No retries are added.

Proof

Completed verification for the prepared change:

  • Focused Vitest run covering six permission, secure-file, API, and documentation test files: 125 passed.
  • TypeScript (tsc), file-size and filesystem-boundary lints, documentation checks, and package/public-API checks: all green.
  • Full local pnpm test has pre-existing native PAX failures caused by a stale prebuilt native binary. These are unrelated to this change and fail identically on clean main.

Refs #99.

Windows ACL verification subprocess failures from the PowerShell owner
query, icacls, and whoami were flattened to a generic
permission-unverified FsSafeError, discarding stderr, exit status, and
timing.

Propagate structured PermissionCommandFailure diagnostics from
executePermissionCommand through the owner and ACL inspectors onto
FsSafeError details and cause. The failure records command, durationMs,
timedOut, exitCode, signal, and sanitized, bounded stderr so CI flakes on
contended runners are diagnosable and a future retry condition can key on
real diagnostics.

Verification semantics, error codes, and fail-closed behavior are
unchanged. No retries are added.

Refs #99.
@steipete
steipete requested a review from a team as a code owner August 28, 2026 04:36
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(permissions): preserve Windows ACL verification diagnostics This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 9603da1 into main Aug 28, 2026
25 checks passed
@steipete
steipete deleted the fix/windows-acl-diagnostics branch August 28, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant