From 7df1fe5f03d84216d2836107fc3267d98315e1ad Mon Sep 17 00:00:00 2001 From: dbuechel Date: Thu, 6 Feb 2020 09:56:32 +0100 Subject: [PATCH] SEBWIN-309: Corrected implementation of configuration key. --- .../Handlers/ResourceHandler.cs | 2 +- .../ConfigurationData/DataProcessorTests.cs | 55 ++++++++++++++++++ .../ConfigurationData/TestDictionary1.bin | Bin 0 -> 12067 bytes .../ConfigurationData/TestDictionary2.bin | Bin 0 -> 13543 bytes .../ConfigurationData/TestDictionary3.bin | Bin 0 -> 13664 bytes ...ExamBrowser.Configuration.UnitTests.csproj | 4 ++ .../ConfigurationData/DataProcessor.cs | 12 ++-- 7 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 SafeExamBrowser.Configuration.UnitTests/ConfigurationData/DataProcessorTests.cs create mode 100644 SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary1.bin create mode 100644 SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary2.bin create mode 100644 SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary3.bin diff --git a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs index 477810d5..bafa5a09 100644 --- a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs +++ b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs @@ -107,7 +107,7 @@ namespace SafeExamBrowser.Browser.Handlers var headers = new NameValueCollection(request.Headers); var urlWithoutFragment = request.Url.Split('#')[0]; var hash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(urlWithoutFragment + settings.HashValue)); - var configurationKey = BitConverter.ToString(hash).Replace("-", string.Empty); + var configurationKey = BitConverter.ToString(hash).ToLower().Replace("-", string.Empty); // TODO: Implement Browser Exam Key calculation. // headers["X-SafeExamBrowser-RequestHash"] = ...; diff --git a/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/DataProcessorTests.cs b/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/DataProcessorTests.cs new file mode 100644 index 00000000..e06ca6ae --- /dev/null +++ b/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/DataProcessorTests.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2020 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.Serialization.Formatters.Binary; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SafeExamBrowser.Configuration.ConfigurationData; +using SafeExamBrowser.Settings; + +namespace SafeExamBrowser.Configuration.UnitTests.ConfigurationData +{ + [TestClass] + public class DataProcessorTests + { + private DataProcessor sut; + + [TestInitialize] + public void Initialize() + { + sut = new DataProcessor(); + } + + [TestMethod] + public void MustCalculateCorrectHashValue() + { + var formatter = new BinaryFormatter(); + var path1 = $"{nameof(SafeExamBrowser)}.{nameof(Configuration)}.{nameof(UnitTests)}.{nameof(ConfigurationData)}.TestDictionary1.bin"; + var path2 = $"{nameof(SafeExamBrowser)}.{nameof(Configuration)}.{nameof(UnitTests)}.{nameof(ConfigurationData)}.TestDictionary2.bin"; + var path3 = $"{nameof(SafeExamBrowser)}.{nameof(Configuration)}.{nameof(UnitTests)}.{nameof(ConfigurationData)}.TestDictionary3.bin"; + var stream1 = Assembly.GetAssembly(GetType()).GetManifestResourceStream(path1); + var stream2 = Assembly.GetAssembly(GetType()).GetManifestResourceStream(path2); + var stream3 = Assembly.GetAssembly(GetType()).GetManifestResourceStream(path3); + var data1 = formatter.Deserialize(stream1) as IDictionary; + var data2 = formatter.Deserialize(stream2) as IDictionary; + var data3 = formatter.Deserialize(stream3) as IDictionary; + var settings1 = new AppSettings(); + var settings2 = new AppSettings(); + var settings3 = new AppSettings(); + + sut.Process(data1, settings1); + sut.Process(data2, settings2); + sut.Process(data3, settings3); + + Assert.AreEqual("6063c3351ed1ac878c05072598d5079e30ca763c957d8e04bd45131c08f88d1a", settings1.Browser.HashValue); + Assert.AreEqual("4fc002d2ae4faf994a14bede54d95ac58a1a2cb9b59bc5b4277ff29559b46e3d", settings2.Browser.HashValue); + Assert.AreEqual("ab426e25b795c917f1fb40f7ef8e5757ef97d7c7ad6792e655c4421d47329d7a", settings3.Browser.HashValue); + } + } +} diff --git a/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary1.bin b/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary1.bin new file mode 100644 index 0000000000000000000000000000000000000000..a95d7e5a69e99fb646fdb9083764b308c371fdaf GIT binary patch literal 12067 zcmd^_dvqMteaH9O@@m(z-m>LaY=LpW!Ird=Ru2c)(K9xdEa8O0=eRQ0+;16%Ou4#c zI?eBvrnL1`^MI}jG<)tu+tH&wm~d^~%xrJUIVsCF^yK!YL(+C&x2vPMmHusS>Ms~> z!IryBS#WL5*xoc&NE&)-pPU=Frlh$m+0~`RQ}NDNPkV=K?e00Yohu(rUJWPycPl?u zhJKd&PDc8zTwb%K9oeHf*@S*dR>G}Ano*Ernr=Ix<)P(~kDV(hesBg)7BoY5=eWKT zu|H^pjzyk5ms7z${J$QnqsKmr(TXm^pZn;;a{MWytN)8*0=Git&W@hRhoOtr{vsYo^b(W*lrDeTdnRWzT4Kn(BL&$qm%3B1=2Zuw_jZ@`OFj z*xLe_lQ*=v5#6>e+LZ`%!@8NaW@rc>WA0*bQN>+R&|Q*# z%+fYUbxKO8_7ho+yYnbBmx8JGn7lNM{;W(*k)LN6*a2Xj2h8YhDm!lV=JVKgHMOZz zdyg>MQf%*_BkhF3RrrK>n3))udR5&a-FC6rjcBQ?ZmLQA5JT;NygnTs?%hxBJjhZU zk~f$#J)o;`>MP)$(Gfi%9$>5sm^V9$m@}fy?l0t$*rZV-rqcZk_u#57$+ui_f_f9~ zKBg`MRhu-d)YO=jKbZH1LXG?n82KY0RY{tT(jJ`Ea@aq;N=`G;3u3KLc=r(kG=|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AaafA*ia zC#snE2v=)CSb3yq%`9HU@4^QeHdY&z_lPj}F}TQJBBq~0bH9?MPav&;L{Wn|t)h?R ztbGctD$wS$*-Kdd9C9VeIFN_K4QfQOCa^b#NkjY*FjvR#D%4Mn}H2nfVgf~+UUhwtTsVa^^O;{ z?3=7^g4&>*FIK?U89TmEhJ~&BDg!3~P%XGnf0^~KP$|X}@uC6sW7bY4ThbQR?*-Od zpof*NTK^PWisxBu#Z^R!^R53Q7NZc?khoaoe#q1|Q0n;$%YKCQF6dS9vA*3!z4J7S z-4ItPabfBIiGkAqL^Pm^-;GsO{3EMpKwY8L`SL%`>RC`5l)6|29%HPxP=*CHsH7EL zt=Y7Ye_7V-zvosNK&z}Ya%N%03=QH=y$aQ~;(lA2ms0UC+w20dBBkD&jA9814dHqj zKE?3G4;a}^ZZ#5@`0~XM4HuvX7#hW`D!i1z2RM0JibG?#A)K8q~27dao7;tm!sR3i3$6{ORN>ANgl1gR=5J@xqm zx>&pYHp?l~<*$L9jlw%LsbW%~D$p~?Xo)_iEoG1e^^%H!u!B;3SxEY9Fg1HRtD bM^L-)UI6d4Cb1LI>s{Ss)Z%3Wzv_Pgz1yZ| literal 0 HcmV?d00001 diff --git a/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary3.bin b/SafeExamBrowser.Configuration.UnitTests/ConfigurationData/TestDictionary3.bin new file mode 100644 index 0000000000000000000000000000000000000000..d65333fbe2e1edca77ec439215b6af06c506d693 GIT binary patch literal 13664 zcmd^_3v?XSdB=7Akaqo$WZANfag1S92%06l%}C6rFk7n35P>MNGTzZP!d82A(WB?0tp-llu}-CC<%v#l2AgR|L@-U zR;!ilL(XZ=NskSNo%#R1?>^?(Nr3H^T*`W!f}cbVqWz^+^E~Pw?A%Lo^)b)W7LuXQ6=6)mr%D< z*8o^s0YvS*C-a`RA^HubgP@m}=$)Co?Z|%9^@58ah}Rigf~)!xHXvQs$jCqdcdNu} z4AtVQwgl}hTG9>H5%DS$%W$>aNT*E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L1=ZT+|E3mHDnySm{$qS z4Gf$QV3F%Nc0RKUuS%&ezQEcrw1uAOS+e>Ne$K~6IVr?^;w W=xw&@vO1bR^k<%+zMmCw7XL4FK8Lda literal 0 HcmV?d00001 diff --git a/SafeExamBrowser.Configuration.UnitTests/SafeExamBrowser.Configuration.UnitTests.csproj b/SafeExamBrowser.Configuration.UnitTests/SafeExamBrowser.Configuration.UnitTests.csproj index 72b9a974..ad3a996a 100644 --- a/SafeExamBrowser.Configuration.UnitTests/SafeExamBrowser.Configuration.UnitTests.csproj +++ b/SafeExamBrowser.Configuration.UnitTests/SafeExamBrowser.Configuration.UnitTests.csproj @@ -87,6 +87,7 @@ + @@ -106,6 +107,9 @@ + + + Designer diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs index b76c3b2d..1a4c0a6d 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataProcessor.cs @@ -12,7 +12,6 @@ using System.Globalization; using System.IO; using System.Linq; using System.Security.Cryptography; -using System.Text; using SafeExamBrowser.Settings; namespace SafeExamBrowser.Configuration.ConfigurationData @@ -28,22 +27,23 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { using (var algorithm = new SHA256Managed()) using (var stream = new MemoryStream()) - using (var writer = new StreamWriter(stream, Encoding.UTF8)) + using (var writer = new StreamWriter(stream)) { Serialize(rawData, writer); + writer.Flush(); stream.Seek(0, SeekOrigin.Begin); - var hash = algorithm.ComputeHash(stream); - var hashString = BitConverter.ToString(hash).Replace("-", string.Empty); + var hashBytes = algorithm.ComputeHash(stream); + var hashValue = BitConverter.ToString(hashBytes).ToLower().Replace("-", string.Empty); - settings.Browser.HashValue = hashString; + settings.Browser.HashValue = hashValue; } } private void Serialize(IDictionary dictionary, StreamWriter stream) { - var orderedByKey = dictionary.OrderBy(d => d.Key, StringComparer.OrdinalIgnoreCase).ToList(); + var orderedByKey = dictionary.OrderBy(d => d.Key, StringComparer.InvariantCulture).ToList(); stream.Write('{');