From 61127dc5ff80e45e148d36b7e99b648f005cbdf8 Mon Sep 17 00:00:00 2001 From: tbphp Date: Wed, 22 Jul 2026 18:10:37 +0800 Subject: [PATCH] =?UTF-8?q?test(encryption):=20=E4=BF=AE=E6=AD=A3=20Window?= =?UTF-8?q?s=20ACL=20=E6=9D=83=E9=99=90=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/platform/encryption/keyfile_windows_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/platform/encryption/keyfile_windows_test.go b/internal/platform/encryption/keyfile_windows_test.go index 25c2d050..61c5ddf9 100644 --- a/internal/platform/encryption/keyfile_windows_test.go +++ b/internal/platform/encryption/keyfile_windows_test.go @@ -12,6 +12,9 @@ import ( "golang.org/x/sys/windows" ) +// x/sys/windows does not expose FILE_ALL_ACCESS from WinNT.h. +const fileAllAccessMask windows.ACCESS_MASK = windows.STANDARD_RIGHTS_REQUIRED | windows.SYNCHRONIZE | 0x1ff + func TestGeneratedKeyFileGrantsAccessOnlyToCurrentUser(t *testing.T) { dataDir := t.TempDir() if _, err := LoadOrCreateKeyMaterial("", dataDir); err != nil { @@ -78,8 +81,8 @@ func assertCurrentUserOnlyACL(t *testing.T, path string) { if ace.Header.AceType != windows.ACCESS_ALLOWED_ACE_TYPE { t.Fatalf("ACE type = %d, want ACCESS_ALLOWED_ACE_TYPE", ace.Header.AceType) } - if ace.Mask != windows.GENERIC_ALL { - t.Fatalf("ACE mask = %#x, want GENERIC_ALL", ace.Mask) + if ace.Mask != fileAllAccessMask { + t.Fatalf("ACE mask = %#x, want FILE_ALL_ACCESS (%#x)", ace.Mask, fileAllAccessMask) } user, err := windows.GetCurrentProcessToken().GetTokenUser()