Skip to content

Commit 57a273a

Browse files
committed
fix: JWKS leak issue
1 parent 74ab7b5 commit 57a273a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

recipe/thirdparty/providers/apple.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ func verifyAndGetClaimsAppleIdToken(idToken string, clientId string) (jwt.MapCla
178178
jwksURL := "https://appleid.apple.com/auth/keys"
179179

180180
// Create the keyfunc options. Refresh the JWKS every hour and log errors.
181-
refreshInterval := time.Hour
182181
options := keyfunc.Options{
183-
RefreshInterval: refreshInterval,
182+
// RefreshInterval: time.Hour, // This causes a leak as the pointer to JWKS would be held in the goroutine
184183
}
185184

186185
// Create the JWKS from the resource at the given URL.

recipe/thirdparty/providers/googleWorkspaces.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package providers
1818
import (
1919
"errors"
2020
"strings"
21-
"time"
2221

2322
"github.com/MicahParks/keyfunc"
2423
"github.com/golang-jwt/jwt/v4"
@@ -141,9 +140,8 @@ func verifyAndGetClaims(idToken string, clientId string) (jwt.MapClaims, error)
141140
jwksURL := "https://www.googleapis.com/oauth2/v3/certs"
142141

143142
// Create the keyfunc options. Refresh the JWKS every hour and log errors.
144-
refreshInterval := time.Hour
145143
options := keyfunc.Options{
146-
RefreshInterval: refreshInterval,
144+
// RefreshInterval: time.Hour, // This causes a leak as the pointer to JWKS would be held in the goroutine
147145
}
148146

149147
// Create the JWKS from the resource at the given URL.

0 commit comments

Comments
 (0)