From 3e92caf52ff8eec59be24554e3e4dbc5e7e893af Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Fri, 16 Aug 2024 18:05:08 +0200 Subject: [PATCH] Add check to avoid crashes when a claim element's value is nil --- internal/handlers/consent.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/handlers/consent.go b/internal/handlers/consent.go index b9b37b0..cf734de 100644 --- a/internal/handlers/consent.go +++ b/internal/handlers/consent.go @@ -450,6 +450,12 @@ func (h *ConsentHandler) mapRequestedClaims( for _, claimElement := range []*models.ClaimElement{claims.GetUserInfo(), claims.GetIDToken()} { if claimElement != nil { for k, v := range *claimElement { + if v == nil { + h.logger.Warn("claim element is nil", "key", k) + + continue + } + if _, ok := supportedClaims[k]; !ok { h.logger.Warn("ignoring unsupported claim", "claim", k)