From 2ba4b81bc4c7aa8e3585722ca86ae0ad377a2818 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 06:33:44 +0000 Subject: [PATCH 1/2] build(deps): bump github.com/Microsoft/cosesign1go from 1.7.0 to 1.9.0 Bumps [github.com/Microsoft/cosesign1go](https://github.com/Microsoft/cosesign1go) from 1.7.0 to 1.9.0. - [Release notes](https://github.com/Microsoft/cosesign1go/releases) - [Commits](https://github.com/Microsoft/cosesign1go/compare/v1.7.0...v1.9.0) --- updated-dependencies: - dependency-name: github.com/Microsoft/cosesign1go dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 +-- go.sum | 4 +-- .../cosesign1go/pkg/cosesign1/create.go | 36 +++++++++++++++++++ vendor/modules.txt | 4 +-- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 05260a712f..b9c8122f16 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Microsoft/hcsshim -go 1.26.8 +go 1.27.4 // protobuf/gRPC/ttrpc generation tool ( @@ -21,7 +21,7 @@ tool ( ) require ( - github.com/Microsoft/cosesign1go v1.7.0 + github.com/Microsoft/cosesign1go v1.9.0 github.com/Microsoft/didx509go v0.0.3 github.com/Microsoft/go-winio v0.6.4 github.com/blang/semver/v4 v4.0.0 diff --git a/go.sum b/go.sum index 4f55bb65bd..287effc8c8 100644 --- a/go.sum +++ b/go.sum @@ -362,8 +362,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapp github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0/go.mod h1:otE2jQekW/PqXk1Awf5lmfokJx4uwuqcj1ab5SpGeW0= github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= -github.com/Microsoft/cosesign1go v1.7.0 h1:uf/zRnSzfZaCjqgw9e+wwsqbe9J1sLZZEsEjs5SSLW0= -github.com/Microsoft/cosesign1go v1.7.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= +github.com/Microsoft/cosesign1go v1.9.0 h1:3eAlvGNxEVSNgWm0F9nPEsmh02iUDVnPANKDbnrnZJk= +github.com/Microsoft/cosesign1go v1.9.0/go.mod h1:2aLQc7Pc5pZQyfV2B0tqPCWMgLjN8NOab7/9xVJsN1w= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= github.com/Microsoft/go-winio v0.6.4 h1:kJF2pamtYCWXf0xAT8sAkwKC0pMl2HYBrRPHAqyUc+g= diff --git a/vendor/github.com/Microsoft/cosesign1go/pkg/cosesign1/create.go b/vendor/github.com/Microsoft/cosesign1go/pkg/cosesign1/create.go index aadb6ec308..c60d9ed989 100644 --- a/vendor/github.com/Microsoft/cosesign1go/pkg/cosesign1/create.go +++ b/vendor/github.com/Microsoft/cosesign1go/pkg/cosesign1/create.go @@ -2,6 +2,7 @@ package cosesign1 import ( "crypto" + "crypto/ecdsa" "crypto/rand" "crypto/x509" "encoding/pem" @@ -13,6 +14,31 @@ import ( "github.com/veraison/go-cose" ) +type deterministicECDSASigner struct { + *ecdsa.PrivateKey + hash crypto.Hash +} + +func (s deterministicECDSASigner) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error) { + // A nil reader selects RFC 6979 instead of Go's randomized ECDSA signing. + return s.PrivateKey.Sign(nil, digest, s.hash) +} + +func newDeterministicECDSASigner(key *ecdsa.PrivateKey, algo cose.Algorithm) (crypto.Signer, error) { + var hash crypto.Hash + switch algo { + case cose.AlgorithmES256: + hash = crypto.SHA256 + case cose.AlgorithmES384: + hash = crypto.SHA384 + case cose.AlgorithmES512: + hash = crypto.SHA512 + default: + return nil, fmt.Errorf("unsupported ECDSA algorithm: %v", algo) + } + return deterministicECDSASigner{PrivateKey: key, hash: hash}, nil +} + func pem2der(chainPem []byte) []byte { block, rest := pem.Decode(chainPem) if block != nil && block.Bytes != nil { @@ -108,6 +134,16 @@ func CreateCoseSign1(payloadBlob []byte, issuer string, feed string, contentType return nil, fmt.Errorf("signingKey must be of type crypto.Signer") } + if key, ok := cryptoSigner.(*ecdsa.PrivateKey); ok && saltType == "zero" { + // Since Go 1.26 crypto/ecdsa.Sign() ignores saltReader. + // https://github.com/golang/go/blob/go1.27.4/src/crypto/ecdsa/ecdsa_legacy.go#L65-L68 + // We use crypto/ecdsa.PrivateKey.Sign() with a nil reader for deterministic signing. + cryptoSigner, err = newDeterministicECDSASigner(key, algo) + if err != nil { + return nil, err + } + } + var signer cose.Signer signer, err = cose.NewSigner(algo, cryptoSigner) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 3d3eafa098..974eaeecc2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,8 +4,8 @@ cyphar.com/go-pathrs cyphar.com/go-pathrs/internal/fdutils cyphar.com/go-pathrs/internal/libpathrs cyphar.com/go-pathrs/procfs -# github.com/Microsoft/cosesign1go v1.7.0 -## explicit; go 1.21 +# github.com/Microsoft/cosesign1go v1.9.0 +## explicit; go 1.27.4 github.com/Microsoft/cosesign1go/pkg/cosesign1 # github.com/Microsoft/didx509go v0.0.3 ## explicit; go 1.20 From f0c98ddd4c5ac6d3769beda0787e61d5e54a8bbe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2026 06:35:09 +0000 Subject: [PATCH 2/2] go mod tidy && go mod vendor Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/go.mod | 4 ++-- test/go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/go.mod b/test/go.mod index 25ee018421..8acba47204 100644 --- a/test/go.mod +++ b/test/go.mod @@ -1,6 +1,6 @@ module github.com/Microsoft/hcsshim/test -go 1.26.8 +go 1.27.4 require ( github.com/Microsoft/go-winio v0.6.4 @@ -33,7 +33,7 @@ require ( require ( cyphar.com/go-pathrs v0.2.5 // indirect - github.com/Microsoft/cosesign1go v1.7.0 // indirect + github.com/Microsoft/cosesign1go v1.9.0 // indirect github.com/Microsoft/didx509go v0.0.3 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect diff --git a/test/go.sum b/test/go.sum index 739ebe7261..4d625eaa8d 100644 --- a/test/go.sum +++ b/test/go.sum @@ -2,8 +2,8 @@ cyphar.com/go-pathrs v0.2.5 h1:SnX9FBvnoyn3lUs1dkMgZ52bAETpirNu3FTRh5HlRik= cyphar.com/go-pathrs v0.2.5/go.mod h1:y8f1EMG7r+hCuFf/rXsKqMJrJAUoADZGNh5/vZPKcGc= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/Microsoft/cosesign1go v1.7.0 h1:uf/zRnSzfZaCjqgw9e+wwsqbe9J1sLZZEsEjs5SSLW0= -github.com/Microsoft/cosesign1go v1.7.0/go.mod h1:7x+fdYtZ4ureEgfVtl2K+nY4MMfujMsCIb5kRuncpmg= +github.com/Microsoft/cosesign1go v1.9.0 h1:3eAlvGNxEVSNgWm0F9nPEsmh02iUDVnPANKDbnrnZJk= +github.com/Microsoft/cosesign1go v1.9.0/go.mod h1:2aLQc7Pc5pZQyfV2B0tqPCWMgLjN8NOab7/9xVJsN1w= github.com/Microsoft/didx509go v0.0.3 h1:n/owuFOXVzCEzSyzivMEolKEouBm9G0NrEDgoTekM8A= github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7rLF7yLglYbk= github.com/Microsoft/go-winio v0.6.4 h1:kJF2pamtYCWXf0xAT8sAkwKC0pMl2HYBrRPHAqyUc+g=