Repository navigation
fix(cli): honor Windows ACLs for saved credentials (0.14.3) - #37
Conversation
farhan-helmy
left a comment
There was a problem hiding this comment.
Thanks for taking this on. Native Windows can't use a saved credential at all today, and checking the ACL on the open handle is a nice way to avoid a race. POSIX behavior is unchanged, and the Linux job and the Node 20/22/24 smoke tests pass.
The new Windows job fails all four tests, though (run 46220114139). Each test stops at the first directory check with Could not enforce the Windows ACL for …. stderr is discarded, so the log doesn't say why.
My best guess is PSModulePath. Actions runs bun test from PowerShell 7. A Windows PowerShell 5.1 started from a child of pwsh inherits pwsh's module paths, then loads pwsh's copy of Microsoft.PowerShell.Security (where Get-Acl lives) and fails (PowerShell/PowerShell#18530). Add-Type (Microsoft.PowerShell.Utility) is likely hit the same way. If that's the cause, anyone running bxc from a pwsh terminal gets the same error, not just CI. Native runs from cmd or Windows PowerShell 5.1 wouldn't show it.
Before merge:
- Get the Windows job passing. The smallest fix is to drop
PSModulePathfrom the child's environment. Better is to use only .NET APIs, so no module has to load at all (inline). - Add a bounded slice of PowerShell's stderr to the generic error, so the next failure can be diagnosed from a log or a user report.
The smaller notes are inline. I'll approve CI again once you push.
farhan-helmy
left a comment
There was a problem hiding this comment.
Thanks, this covers everything. The helper now uses only .NET calls, so it works from PowerShell 7 (the CI shell), and helper errors include PowerShell's message. All five Windows tests pass, along with the Linux validation and the Node 20, 22 and 24 package tests.
What and why
Native Windows reports POSIX-style mode
0666even for a private credential file. The CLI rejected that file before commands such asbxc whoamicould authenticate.Check Windows ACLs on the open credential and configuration files. Login writes new files with private ACLs. The POSIX mode checks still apply on other platforms, and CI runs the credential tests on Windows.
How it was tested
whoamiandworkspaces, plus credential reads and writes on Node 20, 22, and 24.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.