From d8a39aa77105f27f1eb8dd7c45e4365292488f3f Mon Sep 17 00:00:00 2001 From: alsanmsft Date: Thu, 5 Mar 2026 14:07:58 -0800 Subject: [PATCH 1/5] Update Go version in workflow to 1.24 --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bf3c7f6..8441006 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.24 - name: Build run: go build -v ./... @@ -32,7 +32,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.24 - name: Build run: go build -v ./... From 332ccb474cf26368b4ea3b1fc36ed0a95b421a37 Mon Sep 17 00:00:00 2001 From: alsanmsft Date: Thu, 5 Mar 2026 15:38:59 -0800 Subject: [PATCH 2/5] Downgrade Go version from 1.24 to 1.23 --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8441006..dc774e8 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.24 + go-version: 1.23 - name: Build run: go build -v ./... @@ -32,7 +32,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.24 + go-version: 1.23 - name: Build run: go build -v ./... From 144812cef5aa94ad0d954dcb1e51b1fec80360db Mon Sep 17 00:00:00 2001 From: Bhaskar Brahma Date: Fri, 6 Mar 2026 11:26:15 -0800 Subject: [PATCH 3/5] fix unit tests in decrypt_windows_test.go --- .github/workflows/go.yml | 4 ++++ .gitignore | 1 + pkg/encrypt/encrypt_windows.go | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dc774e8..9ce1904 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -23,6 +23,8 @@ jobs: - name: Test run: go test -v ./... + env: + CGO_ENABLED: "0" build_windows: runs-on: windows-latest @@ -39,3 +41,5 @@ jobs: - name: Test run: go test -v ./... + env: + CGO_ENABLED: "0" diff --git a/.gitignore b/.gitignore index 4cb344e..95225ea 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ vmextension/testdir/ vendor/ pkg/utils/configTemp/ pkg/utils/downloadTemp/ +pkg/settings/testdir/ diff --git a/pkg/encrypt/encrypt_windows.go b/pkg/encrypt/encrypt_windows.go index e6faf95..1175189 100644 --- a/pkg/encrypt/encrypt_windows.go +++ b/pkg/encrypt/encrypt_windows.go @@ -5,10 +5,11 @@ package encrypt import ( "encoding/hex" "fmt" - "github.com/Azure/azure-extension-platform/pkg/internal/crypto" - "golang.org/x/sys/windows" "syscall" "unsafe" + + "github.com/Azure/azure-extension-platform/pkg/internal/crypto" + "golang.org/x/sys/windows" ) const ( @@ -30,7 +31,7 @@ func (cHandler *certHandler) GetThumbprint() (certThumbprint string, err error) func (cHandler *certHandler) Encrypt(bytesToEncrypt []byte) (encryptedBytes []byte, err error) { alg := szOID_RSA_RC4 - buffer := []byte(alg) + buffer := append([]byte(alg), 0) // null-terminate for the C API procCryptEncryptMessage := crypto.Modcrypt32.NewProc("CryptEncryptMessage") cai := crypto.CryptAlgorithmIdentifier{ PszObjID: uintptr(unsafe.Pointer(&buffer[0])), From 1d7bc0bf6ccd85284d8f9523f24b42ae27f77c00 Mon Sep 17 00:00:00 2001 From: Bhaskar Brahma Date: Fri, 6 Mar 2026 11:33:18 -0800 Subject: [PATCH 4/5] Added VsCode settings file to keep CGO off for running tests --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4aea389 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "go.testEnvVars": { + "CGO_ENABLED": "0" + } +} From f1eb43c4ebee147df5cc8483df059f84c2f73397 Mon Sep 17 00:00:00 2001 From: alsanmsft Date: Fri, 6 Mar 2026 21:09:20 +0000 Subject: [PATCH 5/5] changed back to 1.24 --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9ce1904..3208c99 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.23 + go-version: 1.24 - name: Build run: go build -v ./... @@ -34,7 +34,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: 1.23 + go-version: 1.24 - name: Build run: go build -v ./...