diff --git a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs index 8882f332bd..7e8ed9b7da 100644 --- a/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs +++ b/src/Microsoft.IdentityModel.JsonWebTokens/JsonWebToken.cs @@ -56,21 +56,11 @@ public JsonWebToken(string jwtEncodedString) if (string.IsNullOrEmpty(jwtEncodedString)) throw new ArgumentNullException(nameof(jwtEncodedString)); - int count = 1; - int next = -1; - while ((next = jwtEncodedString.IndexOf('.', next + 1)) != -1) - { - count++; - if (count >= JwtConstants.JwsSegmentCount) - break; - } - - // JWS or JWE - if (count == JwtConstants.JwsSegmentCount || count == JwtConstants.JweSegmentCount) - { - var tokenParts = jwtEncodedString.Split('.'); + // Max number of segments is set to JwtConstants.MaxJwtSegmentCount + 1 so that we know if there were more than 5 segments present. + // In the case where JwtEncodedString has greater than 5 segments, the length of tokenParts will always be 6. + var tokenParts = jwtEncodedString.Split(new char[] { '.' }, JwtConstants.MaxJwtSegmentCount + 1); + if (tokenParts.Length == JwtConstants.JwsSegmentCount || tokenParts.Length == JwtConstants.JweSegmentCount) Decode(tokenParts, jwtEncodedString); - } else throw LogHelper.LogExceptionMessage(new ArgumentException(LogHelper.FormatInvariant(LogMessages.IDX14100, jwtEncodedString))); } @@ -421,13 +411,16 @@ private void AddDefaultClaimFromJToken(List claims, string claimType, JTo /// Decodes the payload and signature from the JWE parts. /// /// Parts of the JWE including the header. - /// Assumes Header has already been set. + /// + /// Assumes Header has already been set. + /// According to the JWE documentation (https://tools.ietf.org/html/rfc7516#section-2), it is possible for the EncryptedKey, InitializationVector, and AuthenticationTag to be empty strings. + /// private void DecodeJwe(string[] tokenParts) { EncodedHeader = tokenParts[0]; EncryptedKey = tokenParts[1]; InitializationVector = tokenParts[2]; - Ciphertext = tokenParts[3]; + Ciphertext = !string.IsNullOrWhiteSpace(tokenParts[3]) ? tokenParts[3] : throw LogHelper.LogExceptionMessage(new ArgumentException(LogMessages.IDX14306)); AuthenticationTag = tokenParts[4]; } diff --git a/src/Microsoft.IdentityModel.JsonWebTokens/LogMessages.cs b/src/Microsoft.IdentityModel.JsonWebTokens/LogMessages.cs index b09da7c95b..9798e2e854 100644 --- a/src/Microsoft.IdentityModel.JsonWebTokens/LogMessages.cs +++ b/src/Microsoft.IdentityModel.JsonWebTokens/LogMessages.cs @@ -66,6 +66,7 @@ internal static class LogMessages internal const string IDX14303 = "IDX14303: Claim with name '{0}' does not exist in the header."; internal const string IDX14304 = "IDX14304: Claim with name '{0}' does not exist in the payload."; internal const string IDX14305 = "IDX14305: Unable to convert the '{0}' claim to the following type: '{1}'. Claim type was: '{2}'."; + internal const string IDX14306 = "IDX14306: JWE Ciphertext cannot be an empty string."; #pragma warning restore 1591 } } diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs index dcb34aa498..cea2db1f46 100644 --- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs +++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Globalization; using System.IdentityModel.Tokens.Jwt; +using System.IdentityModel.Tokens.Jwt.Tests; using System.Linq; using System.Security.Claims; using Microsoft.IdentityModel.Logging; @@ -512,6 +513,98 @@ public static TheoryData ParseTimeValuesTheoryData } } + // Test ensures that we only try to populate a JsonWebToken from a string if it is a properly formatted JWT. More specifically, we only want to try and decode + // a JWT token if it has the correct number of (JWE or JWS) token parts. + [Theory, MemberData(nameof(ParseTokenTheoryData))] + public void ParseToken(JwtTheoryData theoryData) + { + var context = TestUtilities.WriteHeader($"{this}.ParseToken", theoryData); + try + { + var tokenFromEncodedString = new JsonWebToken(theoryData.Token); + theoryData.ExpectedException.ProcessNoException(context); + } + catch (Exception ex) + { + theoryData.ExpectedException.ProcessException(ex, context); + } + + TestUtilities.AssertFailIfErrors(context); + } + + public static TheoryData ParseTokenTheoryData + { + get + { + var theoryData = new TheoryData(); + + JwtTestData.InvalidNumberOfSegmentsData("IDX14100:", theoryData); + JwtTestData.ValidEncodedSegmentsData(theoryData); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.InvalidHeader), + Token = EncodedJwts.InvalidHeader, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14102:", inner: typeof(JsonReaderException)) + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.InvalidPayload), + Token = EncodedJwts.InvalidPayload, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14101:", inner: typeof(JsonReaderException)) + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWSEmptyHeader), + Token = EncodedJwts.JWSEmptyHeader, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14102:", inner: typeof(JsonReaderException)) + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWSEmptyPayload), + Token = EncodedJwts.JWSEmptyPayload, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14101:", inner: typeof(JsonReaderException)) + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWEEmptyHeader), + Token = EncodedJwts.JWEEmptyHeader, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14102:", inner: typeof(JsonReaderException)) + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWEEmptyEncryptedKey), + Token = EncodedJwts.JWEEmptyEncryptedKey, + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWEEmptyIV), + Token = EncodedJwts.JWEEmptyIV, + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWEEmptyCiphertext), + Token = EncodedJwts.JWEEmptyCiphertext, + ExpectedException = ExpectedException.ArgumentException(substringExpected: "IDX14306:") + }); + + theoryData.Add(new JwtTheoryData + { + TestId = nameof(EncodedJwts.JWEEmptyAuthenticationTag), + Token = EncodedJwts.JWEEmptyAuthenticationTag, + }); + + return theoryData; + } + } + [Fact] public void DateTimeISO8061Claim() { diff --git a/test/System.IdentityModel.Tokens.Jwt.Tests/References.cs b/test/System.IdentityModel.Tokens.Jwt.Tests/References.cs index fe2a1da759..03dc22ee1f 100644 --- a/test/System.IdentityModel.Tokens.Jwt.Tests/References.cs +++ b/test/System.IdentityModel.Tokens.Jwt.Tests/References.cs @@ -474,6 +474,7 @@ public static class EncodedJwts public static string Asymmetric_1024 = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwOi8vR290Snd0LmNvbSIsImF1ZCI6Imh0dHA6Ly9Db250b3NvLmNvbSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2NvdW50cnkiOiJVU0EiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9lbWFpbGFkZHJlc3MiOiJ1c2VyQGNvbnRvc28uY29tIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvZ2l2ZW5uYW1lIjoiVG9ueSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2hvbWVwaG9uZSI6IjU1NS4xMjEyIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9yb2xlIjoiU2FsZXMiLCJzdWIiOiJib2IifQ.WlNiBiAqmS4G-Em5O-uYiWLK5CJO8B-6Hvqjv_DXpoxldGiMWzivuyJocXPIIDVbcLxovmTc5j0KKgA9foOFBS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VsdFN5bW1ldHJpY1NlY3VyaXR5S2V5XzI1NiIsInR5cCI6IkpXVCJ9..KgIILz-uysx_8sGUHw6Uig.Jzj6wn_rulSAuaADgUayVttM_h1CxzDeadddOaZ3sDzBu6Z0ffMQ9IKtjbpkLfzawFM0qBRjt1p75IUieTa7esZOWj5yoS8UQWg0e1n2pWpWEx9zpfeMsJjbwrsD4_tFxKRDjlAuDHYX2NehgT8CAiI2vI0dMgzIUR8VU6p7Srg_UpiZy_QnVcFG7hHhAK0R0affj6ViGhc7U_diMnpR5P3s8eG-GImB4iHMltlaUTcUqFDgSJBCmiQ0SK-lDTy9Q4Z3tGdhTZeofG9-fi68E234uznjdSj_Ql2t1E4nMOYc0kRcORlKJNQKUMLqW5ddwZwPqRd0HzccjLwnP20RqUbWntBidIdTTl94dT-1BrNGQMDMCTV7HQQxmf1JKbBN0DD0xkfOnO4UGEoHVhjOQhd1R1gAh7KtDNMJKPIdmGfMoy2SDJm_pPwmJ1ayw8rF4F5MoCDxUcKVfC25DAWOxVtnvvR4rJ9qkc9dWHr6sdFqZi7sRQIG9M7T2qqOktoZdoAEmduhii5_p5B456PsZlt8olRCsI8Xb_p4sR5clsEEMRatiUKvcXzNiVEK__17tGa2ALKGoutYb_8AasavGhz-sUjlLlHlCmaI9MA8s07MfhobBEepgNStymK1IBkl1wb1sidMmkNWSX4R18bA9J5tjAcUH0tsyyXzxix7DkKag-zl3pxxawS0NmjVIAnxXOFM_M8_DWQAySNO3atkHnMP__PneG3J-4vUoZhVeEQj66D-MCnCGzKi7YeEAjvLbPsQSeE6ptZ5lfiCmzmza0OkfeRnxRE8L1UA6-XydZ0Z6P1M7W-eV4OctVwIq1VNJeC461-D0ukouDWGBfVajW0k9Ws-U2l8Sp16TgEHkly1MnU7P7VkclldrIQ18yzd.j6_mHUzwEVeprRmNZMEY7A"; + public static string JWSEmptyHeader = @".eyJhIjoiYiJ9.eyJhIjoiYiJ9"; + public static string JWSEmptyPayload = @"eyJhIjoiYiJ9..eyJhIjoiYiJ9"; + public static string JWEEmptyHeader = @".eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9"; + public static string JWEEmptyEncryptedKey = @"eyJhIjoiYiJ9..eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9"; + public static string JWEEmptyIV = @"eyJhIjoiYiJ9.eyJhIjoiYiJ9..eyJhIjoiYiJ9.eyJhIjoiYiJ9"; + public static string JWEEmptyCiphertext = @"eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9..eyJhIjoiYiJ9"; + public static string JWEEmptyAuthenticationTag = @"eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9.eyJhIjoiYiJ9."; public static string JwsKidNullX5t {