Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package skopeo for openSUSE:Factory checked 
in at 2026-11-06 19:33:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/skopeo (Old)
 and      /work/SRC/openSUSE:Factory/.skopeo.new.3759290 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "skopeo"

Fri Nov  6 19:33:40 2026 rev:48 rq:1395073 version:1.24.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/skopeo/skopeo.changes    2026-08-18 
16:36:13.071358821 +0200
+++ /work/SRC/openSUSE:Factory/.skopeo.new.3759290/skopeo.changes       
2026-11-06 19:36:39.969666873 +0100
@@ -1,0 +2,16 @@
+Tue Nov  3 14:20:01 UTC 2026 - Valentin Lefebvre <[email protected]>
+
+- When stripping WhiteoutPrefix, make sure the result is a proper basename
+  CVE-2026-79699, bsc#1280698
+  + 0001-CVE-2026-79699-archive-When-stripping-WhiteoutPrefix.patch
+- Don't panic on empty ciphertext
+  CVE-2026-116585, bsc#1288278
+  + 0002-CVE-2026-116585-cipher-cbc_hmac-don-t-panic-on-empty.patch
+- limit stack depth
+  CVE-2026-116586, bsc#1288278
+  + 0003-CVE-2026-116586-json-limit-stack-depth.patch
+- bound RSA modulus size and reject private keys in JWK/EPK headers
+  CVE-2026-116587, bsc#1288278
+  + 0004-CVE-2026-116587-jwk-bound-RSA-modulus-size-and-rejec.patch
+
+-------------------------------------------------------------------

New:
----
  0001-CVE-2026-79699-archive-When-stripping-WhiteoutPrefix.patch
  0002-CVE-2026-116585-cipher-cbc_hmac-don-t-panic-on-empty.patch
  0003-CVE-2026-116586-json-limit-stack-depth.patch
  0004-CVE-2026-116587-jwk-bound-RSA-modulus-size-and-rejec.patch

----------(New B)----------
  New:  CVE-2026-79699, bsc#1280698
  + 0001-CVE-2026-79699-archive-When-stripping-WhiteoutPrefix.patch
- Don't panic on empty ciphertext
  New:  CVE-2026-116585, bsc#1288278
  + 0002-CVE-2026-116585-cipher-cbc_hmac-don-t-panic-on-empty.patch
- limit stack depth
  New:  CVE-2026-116586, bsc#1288278
  + 0003-CVE-2026-116586-json-limit-stack-depth.patch
- bound RSA modulus size and reject private keys in JWK/EPK headers
  New:  CVE-2026-116587, bsc#1288278
  + 0004-CVE-2026-116587-jwk-bound-RSA-modulus-size-and-rejec.patch
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ skopeo.spec ++++++
--- /var/tmp/diff_new_pack.mDyW4Y/_old  2026-11-06 19:36:41.599735058 +0100
+++ /var/tmp/diff_new_pack.mDyW4Y/_new  2026-11-06 19:36:41.601735141 +0100
@@ -27,6 +27,10 @@
 URL:            https://%{project}
 Source:         %{name}-%{version}.tar.xz
 Source1:        skopeo.rpmlintrc
+Patch0:         0001-CVE-2026-79699-archive-When-stripping-WhiteoutPrefix.patch
+Patch1:         0002-CVE-2026-116585-cipher-cbc_hmac-don-t-panic-on-empty.patch
+Patch2:         0003-CVE-2026-116586-json-limit-stack-depth.patch
+Patch3:         0004-CVE-2026-116587-jwk-bound-RSA-modulus-size-and-rejec.patch
 BuildRequires:  bash
 BuildRequires:  device-mapper-devel >= 1.2.68
 BuildRequires:  glib2-devel

++++++ 0001-CVE-2026-79699-archive-When-stripping-WhiteoutPrefix.patch ++++++
>From 5e4bbd011834dcef2167dcdc0b3a635a2d45c869 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= <[email protected]>
Date: Mon, 26 Oct 2026 17:45:40 +0100
Subject: [PATCH 1/4] CVE-2026-79699(archive): When stripping WhiteoutPrefix,
 make sure the result is a proper basename
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Otherwise, the call could affect $parent/ == $parent/. == $parent, or
$parent/.. .

Depending on the call site, that might or might not be problematic;
for consistency, add the same check in all three locations.

Backport from 
https://github.com/podman-container-tools/container-libs/commit/67d39514df76317daf8fea659195392dee1cc24a

Signed-off-by: Miloslav Trmač <[email protected]>
SUSE-Bugs: bsc#1280698 <https://bugzilla.suse.com/show_bug.cgi?id=1280698>
---
 vendor/go.podman.io/storage/pkg/archive/archive_linux.go | 4 ++++
 vendor/go.podman.io/storage/pkg/archive/changes.go       | 3 +++
 vendor/go.podman.io/storage/pkg/archive/diff.go          | 3 +++
 vendor/go.podman.io/storage/pkg/archive/whiteouts.go     | 5 +++++
 4 files changed, 15 insertions(+)

diff --git a/vendor/go.podman.io/storage/pkg/archive/archive_linux.go 
b/vendor/go.podman.io/storage/pkg/archive/archive_linux.go
index 325629713..ea16baaca 100644
--- a/vendor/go.podman.io/storage/pkg/archive/archive_linux.go
+++ b/vendor/go.podman.io/storage/pkg/archive/archive_linux.go
@@ -2,6 +2,7 @@ package archive
 
 import (
        "archive/tar"
+       "fmt"
        "os"
        "path/filepath"
        "strings"
@@ -125,6 +126,9 @@ func (overlayWhiteoutConverter) ConvertReadWithHandler(hdr 
*tar.Header, path str
 
        // if a file was deleted and we are using overlay, we need to create a 
character device
        if originalBase, ok := strings.CutPrefix(base, WhiteoutPrefix); ok {
+               if isInvalidWhiteoutTargetBaseName(originalBase) {
+                       return false, fmt.Errorf("invalid whiteout path %q", 
path)
+               }
                originalPath := filepath.Join(dir, originalBase)
 
                if err := handler.Mknod(originalPath, unix.S_IFCHR, 0); err != 
nil {
diff --git a/vendor/go.podman.io/storage/pkg/archive/changes.go 
b/vendor/go.podman.io/storage/pkg/archive/changes.go
index d433ed5ce..0bc515229 100644
--- a/vendor/go.podman.io/storage/pkg/archive/changes.go
+++ b/vendor/go.podman.io/storage/pkg/archive/changes.go
@@ -96,6 +96,9 @@ func aufsDeletedFile(root, path string, fi os.FileInfo) 
(string, error) {
 
        // If there is a whiteout, then the file was removed
        if originalFile, ok := strings.CutPrefix(f, WhiteoutPrefix); ok {
+               if isInvalidWhiteoutTargetBaseName(originalFile) {
+                       return "", fmt.Errorf("invalid whiteout path %q", path)
+               }
                return filepath.Join(filepath.Dir(path), originalFile), nil
        }
 
diff --git a/vendor/go.podman.io/storage/pkg/archive/diff.go 
b/vendor/go.podman.io/storage/pkg/archive/diff.go
index 355d65f21..ca8cfed28 100644
--- a/vendor/go.podman.io/storage/pkg/archive/diff.go
+++ b/vendor/go.podman.io/storage/pkg/archive/diff.go
@@ -156,6 +156,9 @@ func UnpackLayer(dest string, layer io.Reader, options 
*TarOptions) (size int64,
                                }
                        } else {
                                originalBase := base[len(WhiteoutPrefix):]
+                               if 
isInvalidWhiteoutTargetBaseName(originalBase) {
+                                       return 0, fmt.Errorf("invalid whiteout 
path %q", hdr.Name)
+                               }
                                originalPath := filepath.Join(dir, originalBase)
                                if err := resetImmutable(originalPath, nil); 
err != nil {
                                        return 0, err
diff --git a/vendor/go.podman.io/storage/pkg/archive/whiteouts.go 
b/vendor/go.podman.io/storage/pkg/archive/whiteouts.go
index d20478a10..f98acf1b0 100644
--- a/vendor/go.podman.io/storage/pkg/archive/whiteouts.go
+++ b/vendor/go.podman.io/storage/pkg/archive/whiteouts.go
@@ -21,3 +21,8 @@ const WhiteoutLinkDir = WhiteoutMetaPrefix + "plnk"
 // WhiteoutOpaqueDir file means directory has been made opaque - meaning
 // readdir calls to this directory do not follow to lower layers.
 const WhiteoutOpaqueDir = WhiteoutMetaPrefix + ".opq"
+
+// isInvalidWhiteoutTargetBaseName returns true a whiteout target base name 
(without WhiteoutPrefix) is invalid.
+func isInvalidWhiteoutTargetBaseName(baseName string) bool {
+       return baseName == "" || baseName == "." || baseName == ".."
+}
-- 
2.51.0


++++++ 0002-CVE-2026-116585-cipher-cbc_hmac-don-t-panic-on-empty.patch ++++++
>From 1959f7caa5e12ff03b830a2d27563d43ce105737 Mon Sep 17 00:00:00 2001
From: Jacob Hoffman-Andrews <[email protected]>
Date: Thu, 3 Sep 2026 09:14:36 -0700
Subject: [PATCH 2/4] CVE-2026-116585(cipher/cbc_hmac): don't panic on empty
 ciphertext

This was reported by Joshua Rogers of AISLE Research. Thanks!

TestOpenEmptyCiphertextContent was written by an LLM and tweaked by me.

Backported from 
https://github.com/go-jose/go-jose/commit/74114c2fa22669a2b2a296746eaa82e15566fd54

SUSE-Bugs: bsc#1288278 <https://bugzilla.suse.com/show_bug.cgi?id=1288278>
---
 vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go 
b/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go
index af029cec0..daf11eb02 100644
--- a/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go
+++ b/vendor/github.com/go-jose/go-jose/v4/cipher/cbc_hmac.go
@@ -176,7 +176,9 @@ func padBuffer(buffer []byte, blockSize int) []byte {
 
 // Remove padding
 func unpadBuffer(buffer []byte, blockSize int) ([]byte, error) {
-       if len(buffer)%blockSize != 0 {
+       // A padded buffer can't be empty because an empty input is padded with
+       // `blockSize` bytes, resulting in a non-empty ciphertext.
+       if len(buffer) == 0 || len(buffer)%blockSize != 0 {
                return nil, errors.New("go-jose/go-jose: invalid padding")
        }
 
-- 
2.51.0


++++++ 0003-CVE-2026-116586-json-limit-stack-depth.patch ++++++
>From dd0b130acb8e58ca066eae11a98b56eb91d02cc7 Mon Sep 17 00:00:00 2001
From: Jacob Hoffman-Andrews <[email protected]>
Date: Thu, 3 Sep 2026 09:14:16 -0700
Subject: [PATCH 3/4] CVE-2026-116586(json): limit stack depth

This cleanly patches in an upstream fix from Go's stdlib:

https://go-review.googlesource.com/c/go/+/199837

Original issue, preventing stack overflow:

https://github.com/golang/go/issues/31789

The need for us to backport this patch was reported independently by
Dohyun Kim (@azza999), Joshua Rogers of AISLE Research, and Sueun Cho.
Thanks!

Backported from 
https://github.com/go-jose/go-jose/commit/a31af25836222f4c45d366d6e8f9b1049dd9935a.

SUSE-Bugs: bsc#1288278 <https://bugzilla.suse.com/show_bug.cgi?id=1288278>
---
 .../go-jose/go-jose/v4/json/scanner.go        | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/vendor/github.com/go-jose/go-jose/v4/json/scanner.go 
b/vendor/github.com/go-jose/go-jose/v4/json/scanner.go
index ee6622e8c..3bd29f397 100644
--- a/vendor/github.com/go-jose/go-jose/v4/json/scanner.go
+++ b/vendor/github.com/go-jose/go-jose/v4/json/scanner.go
@@ -140,6 +140,10 @@ const (
        parseArrayValue         // parsing array value
 )
 
+// This limits the max nesting depth to prevent stack overflow.
+// This is permitted by https://tools.ietf.org/html/rfc7159#section-9
+const maxNestingDepth = 10000
+
 // reset prepares the scanner for use.
 // It must be called before calling s.step.
 func (s *scanner) reset() {
@@ -170,8 +174,13 @@ func (s *scanner) eof() int {
 }
 
 // pushParseState pushes a new parse state p onto the parse stack.
-func (s *scanner) pushParseState(p int) {
-       s.parseState = append(s.parseState, p)
+// an error state is returned if maxNestingDepth was exceeded, otherwise 
successState is returned.
+func (s *scanner) pushParseState(c byte, newParseState int, successState int) 
int {
+       s.parseState = append(s.parseState, newParseState)
+       if len(s.parseState) <= maxNestingDepth {
+               return successState
+       }
+       return s.error(c, "exceeded max depth")
 }
 
 // popParseState pops a parse state (already obtained) off the stack
@@ -211,12 +220,10 @@ func stateBeginValue(s *scanner, c byte) int {
        switch c {
        case '{':
                s.step = stateBeginStringOrEmpty
-               s.pushParseState(parseObjectKey)
-               return scanBeginObject
+               return s.pushParseState(c, parseObjectKey, scanBeginObject)
        case '[':
                s.step = stateBeginValueOrEmpty
-               s.pushParseState(parseArrayValue)
-               return scanBeginArray
+               return s.pushParseState(c, parseArrayValue, scanBeginArray)
        case '"':
                s.step = stateInString
                return scanBeginLiteral
-- 
2.51.0


++++++ 0004-CVE-2026-116587-jwk-bound-RSA-modulus-size-and-rejec.patch ++++++
>From 1c89f9950953e28f37bf035c6352e18c7c923c6b Mon Sep 17 00:00:00 2001
From: Ameer Ghani <[email protected]>
Date: Wed, 14 Oct 2026 17:46:21 -0500
Subject: [PATCH 4/4] CVE-2026-116587(jwk): bound RSA modulus size and reject
 private keys in JWK/EPK headers

* Bound RSA parameters when parsing

If we don't bound these, degenerate RSA parameters could cause us to use
excessive CPU.

This fix is not ideal. Really we should be separating RSA computation from
JSON parsing. We leave this larger-scale improvement for v5.

This is technically a breaking change, since anyone who is parsing RSA
keys greater than 4096 will break. There is no practical use for RSA keys
greater than 4096, so we don't expect this to break anyone. We leave an
escape hatch `MaxRSAModulusBits` for those who need this functionality.

* Move getJWK() to test code only

It's only used in test code, and unexported, so move it there. This lets
us avoid modifying it to care about whether it's parsing a private key or
not.

* Set unprotected header before merging in general serialization

This fixes a bug where the unprotected header was not populated before
invoking sanitized().

If we don't fix this now, the check that a JWK doesn't contain private
parameters could be bypassed.

* Check JWS and JWE algorithms before sanitizing headers

Not doing this breaks tests for the future change, where we're checking
for an invalid combination of parameters. Rather than fix those tests,
let's move the algorithm check before sanitization. The former is less
expensive than the latter, so it's cleaner to do it this way.

* Reject JWK/EPKs containing private keys in header parsing

For JWS and JWE, private material inside the JWK/EPK makes no sense and is
not allowed by the spec. Reject private parameters during parsing.

If we don't take this change, we are exposed to expensive computation,
particularly around RSA validation. For header parsing, this is not
acceptable.

This _is not_ a breaking change, because we rejected non-public keys after
parsing in the first place. We're just trying to avoid expensive parsing
steps.

* Wrap JWE header sanitization errors

Avoids hiding the new ErrEmbeddedPrivateKey error.

* Update jwk.go

Co-authored-by: Jacob Hoffman-Andrews <[email protected]>

* PR feedback

---------

Co-authored-by: Jacob Hoffman-Andrews <[email protected]>

Backported from 
https://github.com/go-jose/go-jose/commit/a0111f82742fa92bceec9ede40845e73319e6230

SUSE-Bugs: bsc#1288278 <https://bugzilla.suse.com/show_bug.cgi?id=1288278>
---
 vendor/github.com/go-jose/go-jose/v4/jwe.go   | 18 +++----
 vendor/github.com/go-jose/go-jose/v4/jwk.go   | 51 ++++++++++++++++---
 vendor/github.com/go-jose/go-jose/v4/jws.go   | 29 ++++++-----
 .../github.com/go-jose/go-jose/v4/shared.go   | 31 ++++-------
 4 files changed, 79 insertions(+), 50 deletions(-)

diff --git a/vendor/github.com/go-jose/go-jose/v4/jwe.go 
b/vendor/github.com/go-jose/go-jose/v4/jwe.go
index 6102f9100..ba8ae985f 100644
--- a/vendor/github.com/go-jose/go-jose/v4/jwe.go
+++ b/vendor/github.com/go-jose/go-jose/v4/jwe.go
@@ -198,15 +198,6 @@ func (parsed *rawJSONWebEncryption) sanitized(
                }
        }
 
-       // Note: this must be called _after_ we parse the protected header,
-       // otherwise fields from the protected header will not get picked up.
-       var err error
-       mergedHeaders := obj.mergedHeaders(nil)
-       obj.Header, err = mergedHeaders.sanitized()
-       if err != nil {
-               return nil, fmt.Errorf("go-jose/go-jose: cannot sanitize merged 
headers: %v (%v)", err, mergedHeaders)
-       }
-
        if len(parsed.Recipients) == 0 {
                obj.recipients = []recipientInfo{
                        {
@@ -260,6 +251,15 @@ func (parsed *rawJSONWebEncryption) sanitized(
                }
        }
 
+       // Note: this must be called _after_ we parse the protected header,
+       // otherwise fields from the protected header will not get picked up.
+       mergedHeaders := obj.mergedHeaders(nil)
+       var err error
+       obj.Header, err = mergedHeaders.sanitized()
+       if err != nil {
+               return nil, fmt.Errorf("go-jose/go-jose: cannot sanitize merged 
headers: %w", err)
+       }
+
        obj.iv = parsed.Iv.bytes()
        obj.ciphertext = parsed.Ciphertext.bytes()
        obj.tag = parsed.Tag.bytes()
diff --git a/vendor/github.com/go-jose/go-jose/v4/jwk.go 
b/vendor/github.com/go-jose/go-jose/v4/jwk.go
index 164d6a161..9c63ea349 100644
--- a/vendor/github.com/go-jose/go-jose/v4/jwk.go
+++ b/vendor/github.com/go-jose/go-jose/v4/jwk.go
@@ -177,13 +177,29 @@ func (k JSONWebKey) MarshalJSON() ([]byte, error) {
 // UnmarshalJSON reads a key from its JSON representation.
 //
 // Returns ErrUnsupportedKeyType for unrecognized or unsupported "kty" header 
values.
-func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) {
+//
+// Directly unmarshaling a JWK is not safe for untrusted input.
+func (k *JSONWebKey) UnmarshalJSON(data []byte) error {
+       return k.unmarshalJSON(data, true)
+}
+
+// unmarshalJSON reads a key from its JSON representation.
+//
+// If allowPrivate is false, a JWK with private key material is rejected and 
the
+// function is safe for use against untrusted input.
+func (k *JSONWebKey) unmarshalJSON(data []byte, allowPrivate bool) (err error) 
{
        var raw rawJSONWebKey
        err = json.Unmarshal(data, &raw)
        if err != nil {
                return err
        }
 
+       if !allowPrivate &&
+               (raw.K != nil || raw.D != nil || raw.P != nil || raw.Q != nil ||
+                       raw.Dp != nil || raw.Dq != nil || raw.Qi != nil) {
+               return errors.New("go-jose/go-jose: JWK contains private 
parameters")
+       }
+
        certs, err := parseCertificateChain(raw.X5c)
        if err != nil {
                return fmt.Errorf("go-jose/go-jose: failed to unmarshal x5c 
field: %s", err)
@@ -493,13 +509,25 @@ func (k *JSONWebKey) Valid() bool {
        return true
 }
 
+// MaxRSAModulusBits is the largest RSA modulus size, in bits, that will be
+// accepted when parsing a JWK. Applications that need larger keys can raise
+// this limit.
+//
+// If modifying MaxRSAModulusBits, do it before any parsing occurs.
+var MaxRSAModulusBits = 4096
+
 func (key rawJSONWebKey) rsaPublicKey() (*rsa.PublicKey, error) {
        if key.N == nil || key.E == nil {
                return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, 
missing n/e values")
        }
 
+       n := key.N.bigInt()
+       if n.BitLen() > MaxRSAModulusBits {
+               return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, 
modulus too large")
+       }
+
        return &rsa.PublicKey{
-               N: key.N.bigInt(),
+               N: n,
                E: key.E.toInt(),
        }, nil
 }
@@ -642,16 +670,23 @@ func (key rawJSONWebKey) rsaPrivateKey() 
(*rsa.PrivateKey, error) {
                return nil, fmt.Errorf("go-jose/go-jose: invalid RSA private 
key, missing %s value(s)", strings.Join(missing, ", "))
        }
 
+       n := key.N.bigInt()
+       if n.BitLen() > MaxRSAModulusBits {
+               return nil, fmt.Errorf("go-jose/go-jose: invalid RSA key, 
modulus too large")
+       }
+
+       p, q := key.P.bigInt(), key.Q.bigInt()
+       if p.BitLen()+q.BitLen() > n.BitLen()+1 || new(big.Int).Mul(p, 
q).Cmp(n) != 0 {
+               return nil, errors.New("go-jose/go-jose: invalid RSA private 
key, p * q != n")
+       }
+
        rv := &rsa.PrivateKey{
                PublicKey: rsa.PublicKey{
-                       N: key.N.bigInt(),
+                       N: n,
                        E: key.E.toInt(),
                },
-               D: key.D.bigInt(),
-               Primes: []*big.Int{
-                       key.P.bigInt(),
-                       key.Q.bigInt(),
-               },
+               D:      key.D.bigInt(),
+               Primes: []*big.Int{p, q},
        }
 
        if key.Dp != nil {
diff --git a/vendor/github.com/go-jose/go-jose/v4/jws.go 
b/vendor/github.com/go-jose/go-jose/v4/jws.go
index c40bd3ec1..08a89fe04 100644
--- a/vendor/github.com/go-jose/go-jose/v4/jws.go
+++ b/vendor/github.com/go-jose/go-jose/v4/jws.go
@@ -270,17 +270,18 @@ func (parsed *rawJSONWebSignature) 
sanitized(signatureAlgorithms []SignatureAlgo
                        Signature: parsed.Signature,
                }
 
+               mergedHeaders := signature.mergedHeaders()
+               alg := mergedHeaders.getSignatureAlgorithm()
+               if !containsSignatureAlgorithm(signatureAlgorithms, alg) {
+                       return nil, newErrUnexpectedSignatureAlgorithm(alg, 
signatureAlgorithms)
+               }
+
                var err error
-               signature.Header, err = signature.mergedHeaders().sanitized()
+               signature.Header, err = mergedHeaders.sanitized()
                if err != nil {
                        return nil, err
                }
 
-               alg := SignatureAlgorithm(signature.Header.Algorithm)
-               if !containsSignatureAlgorithm(signatureAlgorithms, alg) {
-                       return nil, newErrUnexpectedSignatureAlgorithm(alg, 
signatureAlgorithms)
-               }
-
                if signature.header != nil {
                        signature.Unprotected, err = 
signature.header.sanitized()
                        if err != nil {
@@ -318,17 +319,20 @@ func (parsed *rawJSONWebSignature) 
sanitized(signatureAlgorithms []SignatureAlgo
                        return nil, ErrUnprotectedNonce
                }
 
-               var err error
-               obj.Signatures[i].Header, err = 
obj.Signatures[i].mergedHeaders().sanitized()
-               if err != nil {
-                       return nil, err
-               }
+               obj.Signatures[i].header = sig.Header
 
-               alg := SignatureAlgorithm(obj.Signatures[i].Header.Algorithm)
+               mergedHeaders := obj.Signatures[i].mergedHeaders()
+               alg := mergedHeaders.getSignatureAlgorithm()
                if !containsSignatureAlgorithm(signatureAlgorithms, alg) {
                        return nil, newErrUnexpectedSignatureAlgorithm(alg, 
signatureAlgorithms)
                }
 
+               var err error
+               obj.Signatures[i].Header, err = mergedHeaders.sanitized()
+               if err != nil {
+                       return nil, err
+               }
+
                if obj.Signatures[i].header != nil {
                        obj.Signatures[i].Unprotected, err = 
obj.Signatures[i].header.sanitized()
                        if err != nil {
@@ -354,7 +358,6 @@ func (parsed *rawJSONWebSignature) 
sanitized(signatureAlgorithms []SignatureAlgo
                // Copy value of sig
                original := sig
 
-               obj.Signatures[i].header = sig.Header
                obj.Signatures[i].original = &original
        }
 
diff --git a/vendor/github.com/go-jose/go-jose/v4/shared.go 
b/vendor/github.com/go-jose/go-jose/v4/shared.go
index 35130b3aa..17d82d66e 100644
--- a/vendor/github.com/go-jose/go-jose/v4/shared.go
+++ b/vendor/github.com/go-jose/go-jose/v4/shared.go
@@ -291,9 +291,10 @@ func (parsed rawHeader) getEPK() (*JSONWebKey, error) {
        if v == nil {
                return nil, nil
        }
-       var epk *JSONWebKey
-       err := json.Unmarshal(*v, &epk)
-       if err != nil {
+       // RFC 7518 Section 4.6.1.1: the "epk" header is the ephemeral public 
key
+       // of the originator. Reject private key material before parsing it.
+       epk := new(JSONWebKey)
+       if err := epk.unmarshalJSON(*v, false); err != nil {
                return nil, err
        }
        return epk, nil
@@ -319,20 +320,6 @@ func (parsed rawHeader) getTag() (*byteBuffer, error) {
        return parsed.getByteBuffer(headerTag)
 }
 
-// getJWK extracts parsed "jwk" from the raw JSON.
-func (parsed rawHeader) getJWK() (*JSONWebKey, error) {
-       v := parsed[headerJWK]
-       if v == nil {
-               return nil, nil
-       }
-       var jwk *JSONWebKey
-       err := json.Unmarshal(*v, &jwk)
-       if err != nil {
-               return nil, err
-       }
-       return jwk, nil
-}
-
 // getCritical extracts parsed "crit" from the raw JSON. If omitted, it
 // returns an empty slice.
 func (parsed rawHeader) getCritical() ([]string, error) {
@@ -418,10 +405,14 @@ func (parsed rawHeader) sanitized() (h Header, err error) 
{
                }
                switch k {
                case headerJWK:
-                       var jwk *JSONWebKey
-                       err = json.Unmarshal(*v, &jwk)
+                       // RFC 7515 Section 4.1.3 and RFC 7516 Section 4.1.5: 
the "jwk"
+                       // header is the public key that corresponds to the key 
used to
+                       // sign the JWS or encrypt the JWE. Reject private key 
material
+                       // before parsing it.
+                       jwk := new(JSONWebKey)
+                       err = jwk.unmarshalJSON(*v, false)
                        if err != nil {
-                               err = fmt.Errorf("failed to unmarshal JWK: %v: 
%#v", err, string(*v))
+                               err = fmt.Errorf("failed to unmarshal JWK: %w", 
err)
                                return
                        }
                        h.JSONWebKey = jwk
-- 
2.51.0

Reply via email to