Skip to content

Commit 78c2d01

Browse files
committed
Safer content type check
1 parent f0149e3 commit 78c2d01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Pages/Home/JwtDecoder/JwtDecoder.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "~/jwt-decoder"
1+
@page "~/jwt-decoder"
22
@model IdentityServerHost.Pages.Home.JwtDecoder
33

44
<div class="jwt-decoder-page">
@@ -664,7 +664,8 @@
664664
return null;
665665
}
666666
667-
if (!response.headers.get('Content-Type').startsWith('application/json')) {
667+
const contentType = response.headers.get('Content-Type');
668+
if (!contentType || !contentType.startsWith('application/json')) {
668669
if (url.toLowerCase().indexOf('.well-known') !== -1 || url.toLowerCase().endsWith('.json')) {
669670
showError('The provided JWKs URL does not return a valid JSON response.');
670671
return null;

0 commit comments

Comments
 (0)