setupchecksSpec.js 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333
  1. /**
  2. * Copyright (c) 2015 Lukas Reschke <lukas@owncloud.com>
  3. *
  4. * This file is licensed under the Affero General Public License version 3
  5. * or later.
  6. *
  7. * See the COPYING-README file.
  8. *
  9. */
  10. describe('OC.SetupChecks tests', function() {
  11. var suite = this;
  12. var protocolStub;
  13. beforeEach( function(){
  14. protocolStub = sinon.stub(OC, 'getProtocol');
  15. suite.server = sinon.fakeServer.create();
  16. });
  17. afterEach( function(){
  18. suite.server.restore();
  19. protocolStub.restore();
  20. });
  21. describe('checkWebDAV', function() {
  22. it('should fail with another response status code than 201 or 207', function(done) {
  23. var async = OC.SetupChecks.checkWebDAV();
  24. suite.server.requests[0].respond(200);
  25. async.done(function( data, s, x ){
  26. expect(data).toEqual([{
  27. msg: 'Your web server is not yet properly set up to allow file synchronization, because the WebDAV interface seems to be broken.',
  28. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  29. }]);
  30. done();
  31. });
  32. });
  33. it('should return no error with a response status code of 207', function(done) {
  34. var async = OC.SetupChecks.checkWebDAV();
  35. suite.server.requests[0].respond(207);
  36. async.done(function( data, s, x ){
  37. expect(data).toEqual([]);
  38. done();
  39. });
  40. });
  41. it('should return no error with a response status code of 401', function(done) {
  42. var async = OC.SetupChecks.checkWebDAV();
  43. suite.server.requests[0].respond(401);
  44. async.done(function( data, s, x ){
  45. expect(data).toEqual([]);
  46. done();
  47. });
  48. });
  49. });
  50. describe('checkWellKnownUrl', function() {
  51. it('should fail with another response status code than the expected one', function(done) {
  52. var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true, 207);
  53. suite.server.requests[0].respond(200);
  54. async.done(function( data, s, x ){
  55. expect(data).toEqual([{
  56. msg: 'Your web server is not properly set up to resolve "/.well-known/caldav". Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-setup-well-known-URL">documentation ↗</a>.',
  57. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  58. }]);
  59. done();
  60. });
  61. });
  62. it('should return no error with the expected response status code', function(done) {
  63. var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true, 207);
  64. suite.server.requests[0].respond(207);
  65. async.done(function( data, s, x ){
  66. expect(data).toEqual([]);
  67. done();
  68. });
  69. });
  70. it('should return no error with the default expected response status code', function(done) {
  71. var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', true);
  72. suite.server.requests[0].respond(207);
  73. async.done(function( data, s, x ){
  74. expect(data).toEqual([]);
  75. done();
  76. });
  77. });
  78. it('should return no error when no check should be run', function(done) {
  79. var async = OC.SetupChecks.checkWellKnownUrl('PROPFIND', '/.well-known/caldav', 'http://example.org/PLACEHOLDER', false);
  80. async.done(function( data, s, x ){
  81. expect(data).toEqual([]);
  82. done();
  83. });
  84. });
  85. });
  86. describe('checkProviderUrl', function() {
  87. it('should fail with another response status code than the expected one', function(done) {
  88. var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true);
  89. suite.server.requests[0].respond(302);
  90. async.done(function( data, s, x ){
  91. expect(data).toEqual([{
  92. msg: 'Your web server is not properly set up to resolve "/ocm-provider/". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-nginx">documentation page ↗</a>. On Nginx those are typically the lines starting with "location ~" that need an update.',
  93. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  94. }]);
  95. done();
  96. });
  97. });
  98. it('should return no error with the expected response status code', function(done) {
  99. var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true);
  100. suite.server.requests[0].respond(200);
  101. async.done(function( data, s, x ){
  102. expect(data).toEqual([]);
  103. done();
  104. });
  105. });
  106. it('should return no error when no check should be run', function(done) {
  107. var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', false);
  108. async.done(function( data, s, x ){
  109. expect(data).toEqual([]);
  110. done();
  111. });
  112. });
  113. });
  114. describe('checkWOFF2Loading', function() {
  115. it('should fail with another response status code than the expected one', function(done) {
  116. var async = OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), 'http://example.org/PLACEHOLDER');
  117. suite.server.requests[0].respond(302);
  118. async.done(function( data, s, x ){
  119. expect(data).toEqual([{
  120. msg: 'Your web server is not properly set up to deliver .woff2 files. This is typically an issue with the Nginx configuration. For Nextcloud 15 it needs an adjustement to also deliver .woff2 files. Compare your Nginx configuration to the recommended configuration in our <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-nginx">documentation ↗</a>.',
  121. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  122. }]);
  123. done();
  124. });
  125. });
  126. it('should return no error with the expected response status code', function(done) {
  127. var async = OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/NotoSans-Regular-latin.woff2'), 'http://example.org/PLACEHOLDER');
  128. suite.server.requests[0].respond(200);
  129. async.done(function( data, s, x ){
  130. expect(data).toEqual([]);
  131. done();
  132. });
  133. });
  134. });
  135. describe('checkDataProtected', function() {
  136. oc_dataURL = "data";
  137. it('should return an error if data directory is not protected', function(done) {
  138. var async = OC.SetupChecks.checkDataProtected();
  139. suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, '');
  140. async.done(function( data, s, x ){
  141. expect(data).toEqual([
  142. {
  143. msg: 'Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.',
  144. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  145. }]);
  146. done();
  147. });
  148. });
  149. it('should not return an error if data directory is protected', function(done) {
  150. var async = OC.SetupChecks.checkDataProtected();
  151. suite.server.requests[0].respond(403);
  152. async.done(function( data, s, x ){
  153. expect(data).toEqual([]);
  154. done();
  155. });
  156. });
  157. it('should return an error if data directory is a boolean', function(done) {
  158. oc_dataURL = false;
  159. var async = OC.SetupChecks.checkDataProtected();
  160. async.done(function( data, s, x ){
  161. expect(data).toEqual([]);
  162. done();
  163. });
  164. });
  165. });
  166. describe('checkSetup', function() {
  167. it('should return an error if server has no internet connection', function(done) {
  168. var async = OC.SetupChecks.checkSetup();
  169. suite.server.requests[0].respond(
  170. 200,
  171. {
  172. 'Content-Type': 'application/json'
  173. },
  174. JSON.stringify({
  175. hasFileinfoInstalled: true,
  176. isGetenvServerWorking: true,
  177. isReadOnlyConfig: false,
  178. wasEmailTestSuccessful: true,
  179. hasWorkingFileLocking: true,
  180. hasDBFileLocking: false,
  181. hasValidTransactionIsolationLevel: true,
  182. suggestedOverwriteCliURL: '',
  183. isRandomnessSecure: true,
  184. isFairUseOfFreePushService: true,
  185. serverHasInternetConnectionProblems: true,
  186. memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance',
  187. forwardedForHeadersWorking: true,
  188. isCorrectMemcachedPHPModuleInstalled: true,
  189. hasPassedCodeIntegrityCheck: true,
  190. OpcacheSetupRecommendations: [],
  191. isSettimelimitAvailable: true,
  192. hasFreeTypeSupport: true,
  193. missingIndexes: [],
  194. missingPrimaryKeys: [],
  195. missingColumns: [],
  196. cronErrors: [],
  197. cronInfo: {
  198. diffInSeconds: 0
  199. },
  200. isMemoryLimitSufficient: true,
  201. appDirsWithDifferentOwner: [],
  202. isImagickEnabled: true,
  203. areWebauthnExtensionsEnabled: true,
  204. is64bit: true,
  205. recommendedPHPModules: [],
  206. pendingBigIntConversionColumns: [],
  207. isMysqlUsedWithoutUTF8MB4: false,
  208. isDefaultPhoneRegionSet: true,
  209. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  210. reverseProxyGeneratedURL: 'https://server',
  211. temporaryDirectoryWritable: true,
  212. })
  213. );
  214. async.done(function( data, s, x ){
  215. expect(data).toEqual([
  216. {
  217. msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
  218. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  219. }, {
  220. msg: 'No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/server/go.php?to=admin-performance">documentation ↗</a>.',
  221. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  222. }]);
  223. done();
  224. });
  225. });
  226. it('should return an error if server has no internet connection and data directory is not protected', function(done) {
  227. var async = OC.SetupChecks.checkSetup();
  228. suite.server.requests[0].respond(
  229. 200,
  230. {
  231. 'Content-Type': 'application/json'
  232. },
  233. JSON.stringify({
  234. hasFileinfoInstalled: true,
  235. isGetenvServerWorking: true,
  236. isReadOnlyConfig: false,
  237. wasEmailTestSuccessful: true,
  238. hasWorkingFileLocking: true,
  239. hasDBFileLocking: false,
  240. hasValidTransactionIsolationLevel: true,
  241. suggestedOverwriteCliURL: '',
  242. isRandomnessSecure: true,
  243. isFairUseOfFreePushService: true,
  244. serverHasInternetConnectionProblems: true,
  245. memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance',
  246. forwardedForHeadersWorking: true,
  247. isCorrectMemcachedPHPModuleInstalled: true,
  248. hasPassedCodeIntegrityCheck: true,
  249. OpcacheSetupRecommendations: [],
  250. isSettimelimitAvailable: true,
  251. hasFreeTypeSupport: true,
  252. missingIndexes: [],
  253. missingPrimaryKeys: [],
  254. missingColumns: [],
  255. cronErrors: [],
  256. cronInfo: {
  257. diffInSeconds: 0
  258. },
  259. isMemoryLimitSufficient: true,
  260. appDirsWithDifferentOwner: [],
  261. isImagickEnabled: true,
  262. areWebauthnExtensionsEnabled: true,
  263. is64bit: true,
  264. recommendedPHPModules: [],
  265. pendingBigIntConversionColumns: [],
  266. isMysqlUsedWithoutUTF8MB4: false,
  267. isDefaultPhoneRegionSet: true,
  268. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  269. reverseProxyGeneratedURL: 'https://server',
  270. temporaryDirectoryWritable: true,
  271. })
  272. );
  273. async.done(function( data, s, x ){
  274. expect(data).toEqual([
  275. {
  276. msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
  277. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  278. },
  279. {
  280. msg: 'No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/server/go.php?to=admin-performance">documentation ↗</a>.',
  281. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  282. }]);
  283. done();
  284. });
  285. });
  286. it('should return an error if server has no internet connection and data directory is not protected and memcache is available', function(done) {
  287. var async = OC.SetupChecks.checkSetup();
  288. suite.server.requests[0].respond(
  289. 200,
  290. {
  291. 'Content-Type': 'application/json',
  292. },
  293. JSON.stringify({
  294. hasFileinfoInstalled: true,
  295. isGetenvServerWorking: true,
  296. isReadOnlyConfig: false,
  297. wasEmailTestSuccessful: true,
  298. hasWorkingFileLocking: true,
  299. hasDBFileLocking: false,
  300. hasValidTransactionIsolationLevel: true,
  301. suggestedOverwriteCliURL: '',
  302. isRandomnessSecure: true,
  303. isFairUseOfFreePushService: true,
  304. serverHasInternetConnectionProblems: true,
  305. isMemcacheConfigured: true,
  306. forwardedForHeadersWorking: true,
  307. isCorrectMemcachedPHPModuleInstalled: true,
  308. hasPassedCodeIntegrityCheck: true,
  309. OpcacheSetupRecommendations: [],
  310. isSettimelimitAvailable: true,
  311. hasFreeTypeSupport: true,
  312. missingIndexes: [],
  313. missingPrimaryKeys: [],
  314. missingColumns: [],
  315. cronErrors: [],
  316. cronInfo: {
  317. diffInSeconds: 0
  318. },
  319. isMemoryLimitSufficient: true,
  320. appDirsWithDifferentOwner: [],
  321. isImagickEnabled: true,
  322. areWebauthnExtensionsEnabled: true,
  323. is64bit: true,
  324. recommendedPHPModules: [],
  325. pendingBigIntConversionColumns: [],
  326. isMysqlUsedWithoutUTF8MB4: false,
  327. isDefaultPhoneRegionSet: true,
  328. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  329. reverseProxyGeneratedURL: 'https://server',
  330. temporaryDirectoryWritable: true,
  331. })
  332. );
  333. async.done(function( data, s, x ){
  334. expect(data).toEqual([
  335. {
  336. msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
  337. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  338. }
  339. ]);
  340. done();
  341. });
  342. });
  343. it('should return an error if /dev/urandom is not accessible', function(done) {
  344. var async = OC.SetupChecks.checkSetup();
  345. suite.server.requests[0].respond(
  346. 200,
  347. {
  348. 'Content-Type': 'application/json',
  349. },
  350. JSON.stringify({
  351. hasFileinfoInstalled: true,
  352. isGetenvServerWorking: true,
  353. isReadOnlyConfig: false,
  354. wasEmailTestSuccessful: true,
  355. hasWorkingFileLocking: true,
  356. hasDBFileLocking: false,
  357. hasValidTransactionIsolationLevel: true,
  358. suggestedOverwriteCliURL: '',
  359. isRandomnessSecure: false,
  360. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  361. isFairUseOfFreePushService: true,
  362. serverHasInternetConnectionProblems: false,
  363. isMemcacheConfigured: true,
  364. forwardedForHeadersWorking: true,
  365. isCorrectMemcachedPHPModuleInstalled: true,
  366. hasPassedCodeIntegrityCheck: true,
  367. OpcacheSetupRecommendations: [],
  368. isSettimelimitAvailable: true,
  369. hasFreeTypeSupport: true,
  370. missingIndexes: [],
  371. missingPrimaryKeys: [],
  372. missingColumns: [],
  373. cronErrors: [],
  374. cronInfo: {
  375. diffInSeconds: 0
  376. },
  377. isMemoryLimitSufficient: true,
  378. appDirsWithDifferentOwner: [],
  379. isImagickEnabled: true,
  380. areWebauthnExtensionsEnabled: true,
  381. is64bit: true,
  382. recommendedPHPModules: [],
  383. pendingBigIntConversionColumns: [],
  384. isMysqlUsedWithoutUTF8MB4: false,
  385. isDefaultPhoneRegionSet: true,
  386. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  387. reverseProxyGeneratedURL: 'https://server',
  388. temporaryDirectoryWritable: true,
  389. })
  390. );
  391. async.done(function( data, s, x ){
  392. expect(data).toEqual([{
  393. msg: 'No suitable source for randomness found by PHP which is highly discouraged for security reasons. Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/myDocs.html">documentation ↗</a>.',
  394. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  395. }]);
  396. done();
  397. });
  398. });
  399. it('should return an error if the wrong memcache PHP module is installed', function(done) {
  400. var async = OC.SetupChecks.checkSetup();
  401. suite.server.requests[0].respond(
  402. 200,
  403. {
  404. 'Content-Type': 'application/json',
  405. },
  406. JSON.stringify({
  407. hasFileinfoInstalled: true,
  408. isGetenvServerWorking: true,
  409. isReadOnlyConfig: false,
  410. wasEmailTestSuccessful: true,
  411. hasWorkingFileLocking: true,
  412. hasDBFileLocking: false,
  413. hasValidTransactionIsolationLevel: true,
  414. suggestedOverwriteCliURL: '',
  415. isRandomnessSecure: true,
  416. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  417. isFairUseOfFreePushService: true,
  418. serverHasInternetConnectionProblems: false,
  419. isMemcacheConfigured: true,
  420. forwardedForHeadersWorking: true,
  421. isCorrectMemcachedPHPModuleInstalled: false,
  422. hasPassedCodeIntegrityCheck: true,
  423. OpcacheSetupRecommendations: [],
  424. isSettimelimitAvailable: true,
  425. hasFreeTypeSupport: true,
  426. missingIndexes: [],
  427. missingPrimaryKeys: [],
  428. missingColumns: [],
  429. cronErrors: [],
  430. cronInfo: {
  431. diffInSeconds: 0
  432. },
  433. isMemoryLimitSufficient: true,
  434. appDirsWithDifferentOwner: [],
  435. isImagickEnabled: true,
  436. areWebauthnExtensionsEnabled: true,
  437. is64bit: true,
  438. recommendedPHPModules: [],
  439. pendingBigIntConversionColumns: [],
  440. isMysqlUsedWithoutUTF8MB4: false,
  441. isDefaultPhoneRegionSet: true,
  442. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  443. reverseProxyGeneratedURL: 'https://server',
  444. temporaryDirectoryWritable: true,
  445. })
  446. );
  447. async.done(function( data, s, x ){
  448. expect(data).toEqual([{
  449. msg: 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://code.google.com/p/memcached/wiki/PHPClientComparison">memcached wiki about both modules ↗</a>.',
  450. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  451. }]);
  452. done();
  453. });
  454. });
  455. it('should return an info if the mail server config was not set or verified, yet', function(done) {
  456. var async = OC.SetupChecks.checkSetup();
  457. suite.server.requests[0].respond(
  458. 200,
  459. {
  460. 'Content-Type': 'application/json'
  461. },
  462. JSON.stringify({
  463. hasFileinfoInstalled: true,
  464. isGetenvServerWorking: true,
  465. isReadOnlyConfig: false,
  466. wasEmailTestSuccessful: false,
  467. hasWorkingFileLocking: true,
  468. hasDBFileLocking: false,
  469. hasValidTransactionIsolationLevel: true,
  470. suggestedOverwriteCliURL: '',
  471. isRandomnessSecure: true,
  472. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  473. isFairUseOfFreePushService: true,
  474. serverHasInternetConnectionProblems: false,
  475. isMemcacheConfigured: true,
  476. forwardedForHeadersWorking: true,
  477. isCorrectMemcachedPHPModuleInstalled: true,
  478. hasPassedCodeIntegrityCheck: true,
  479. OpcacheSetupRecommendations: [],
  480. isSettimelimitAvailable: true,
  481. hasFreeTypeSupport: true,
  482. missingIndexes: [],
  483. missingPrimaryKeys: [],
  484. missingColumns: [],
  485. cronErrors: [],
  486. cronInfo: {
  487. diffInSeconds: 0
  488. },
  489. isMemoryLimitSufficient: true,
  490. appDirsWithDifferentOwner: [],
  491. isImagickEnabled: true,
  492. areWebauthnExtensionsEnabled: true,
  493. is64bit: true,
  494. recommendedPHPModules: [],
  495. pendingBigIntConversionColumns: [],
  496. isMysqlUsedWithoutUTF8MB4: false,
  497. isDefaultPhoneRegionSet: true,
  498. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  499. reverseProxyGeneratedURL: 'https://server',
  500. temporaryDirectoryWritable: true,
  501. })
  502. );
  503. async.done(function( data, s, x ){
  504. expect(data).toEqual([{
  505. msg: 'You have not set or verified your email server configuration, yet. Please head over to the <a href="http://localhost/index.php/settings/admin">Basic settings</a> in order to set them. Afterwards, use the "Send email" button below the form to verify your settings.',
  506. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  507. }]);
  508. done();
  509. });
  510. });
  511. it('should return an info if transactional file locking is not set up', function(done) {
  512. var async = OC.SetupChecks.checkSetup();
  513. suite.server.requests[0].respond(
  514. 200,
  515. {
  516. 'Content-Type': 'application/json'
  517. },
  518. JSON.stringify({
  519. hasFileinfoInstalled: true,
  520. isGetenvServerWorking: true,
  521. isReadOnlyConfig: false,
  522. wasEmailTestSuccessful: true,
  523. hasWorkingFileLocking: false,
  524. hasDBFileLocking: false,
  525. hasValidTransactionIsolationLevel: true,
  526. suggestedOverwriteCliURL: '',
  527. isRandomnessSecure: true,
  528. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  529. isFairUseOfFreePushService: true,
  530. serverHasInternetConnectionProblems: false,
  531. isMemcacheConfigured: true,
  532. forwardedForHeadersWorking: true,
  533. isCorrectMemcachedPHPModuleInstalled: true,
  534. hasPassedCodeIntegrityCheck: true,
  535. OpcacheSetupRecommendations: [],
  536. isSettimelimitAvailable: true,
  537. hasFreeTypeSupport: true,
  538. missingIndexes: [],
  539. missingPrimaryKeys: [],
  540. missingColumns: [],
  541. cronErrors: [],
  542. cronInfo: {
  543. diffInSeconds: 0
  544. },
  545. isMemoryLimitSufficient: true,
  546. appDirsWithDifferentOwner: [],
  547. isImagickEnabled: true,
  548. areWebauthnExtensionsEnabled: true,
  549. is64bit: true,
  550. recommendedPHPModules: [],
  551. pendingBigIntConversionColumns: [],
  552. isMysqlUsedWithoutUTF8MB4: false,
  553. isDefaultPhoneRegionSet: true,
  554. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  555. reverseProxyGeneratedURL: 'https://server',
  556. temporaryDirectoryWritable: true,
  557. })
  558. );
  559. async.done(function( data, s, x ){
  560. expect(data).toEqual([{
  561. msg: 'Transactional file locking is disabled, this might lead to issues with race conditions. Enable "filelocking.enabled" in config.php to avoid these problems. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-transactional-locking">documentation ↗</a> for more information.',
  562. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  563. }]);
  564. done();
  565. });
  566. });
  567. it('should return an info if database file locking is used', function(done) {
  568. var async = OC.SetupChecks.checkSetup();
  569. suite.server.requests[0].respond(
  570. 200,
  571. {
  572. 'Content-Type': 'application/json'
  573. },
  574. JSON.stringify({
  575. hasFileinfoInstalled: true,
  576. isGetenvServerWorking: true,
  577. isReadOnlyConfig: false,
  578. wasEmailTestSuccessful: true,
  579. hasWorkingFileLocking: true,
  580. hasDBFileLocking: true,
  581. hasValidTransactionIsolationLevel: true,
  582. suggestedOverwriteCliURL: '',
  583. isRandomnessSecure: true,
  584. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  585. isFairUseOfFreePushService: true,
  586. serverHasInternetConnectionProblems: false,
  587. isMemcacheConfigured: true,
  588. forwardedForHeadersWorking: true,
  589. isCorrectMemcachedPHPModuleInstalled: true,
  590. hasPassedCodeIntegrityCheck: true,
  591. OpcacheSetupRecommendations: [],
  592. isSettimelimitAvailable: true,
  593. hasFreeTypeSupport: true,
  594. missingIndexes: [],
  595. missingPrimaryKeys: [],
  596. missingColumns: [],
  597. cronErrors: [],
  598. cronInfo: {
  599. diffInSeconds: 0
  600. },
  601. isMemoryLimitSufficient: true,
  602. appDirsWithDifferentOwner: [],
  603. isImagickEnabled: true,
  604. areWebauthnExtensionsEnabled: true,
  605. is64bit: true,
  606. recommendedPHPModules: [],
  607. pendingBigIntConversionColumns: [],
  608. isMysqlUsedWithoutUTF8MB4: false,
  609. isDefaultPhoneRegionSet: true,
  610. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  611. reverseProxyGeneratedURL: 'https://server',
  612. temporaryDirectoryWritable: true,
  613. })
  614. );
  615. async.done(function( data, s, x ){
  616. expect(data).toEqual([{
  617. msg: 'The database is used for transactional file locking. To enhance performance, please configure memcache, if available. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-transactional-locking">documentation ↗</a> for more information.',
  618. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  619. }]);
  620. done();
  621. });
  622. });
  623. it('should return a warning if there are app directories with wrong permissions', function(done) {
  624. var async = OC.SetupChecks.checkSetup();
  625. suite.server.requests[0].respond(
  626. 200,
  627. {
  628. 'Content-Type': 'application/json',
  629. },
  630. JSON.stringify({
  631. hasFileinfoInstalled: true,
  632. isGetenvServerWorking: true,
  633. isReadOnlyConfig: false,
  634. wasEmailTestSuccessful: true,
  635. hasWorkingFileLocking: true,
  636. hasDBFileLocking: false,
  637. hasValidTransactionIsolationLevel: true,
  638. suggestedOverwriteCliURL: '',
  639. isRandomnessSecure: true,
  640. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  641. isFairUseOfFreePushService: true,
  642. serverHasInternetConnectionProblems: false,
  643. isMemcacheConfigured: true,
  644. forwardedForHeadersWorking: true,
  645. isCorrectMemcachedPHPModuleInstalled: true,
  646. hasPassedCodeIntegrityCheck: true,
  647. OpcacheSetupRecommendations: [],
  648. isSettimelimitAvailable: true,
  649. hasFreeTypeSupport: true,
  650. missingIndexes: [],
  651. missingPrimaryKeys: [],
  652. missingColumns: [],
  653. cronErrors: [],
  654. cronInfo: {
  655. diffInSeconds: 0
  656. },
  657. isMemoryLimitSufficient: true,
  658. appDirsWithDifferentOwner: [
  659. '/some/path'
  660. ],
  661. isImagickEnabled: true,
  662. areWebauthnExtensionsEnabled: true,
  663. is64bit: true,
  664. recommendedPHPModules: [],
  665. pendingBigIntConversionColumns: [],
  666. isMysqlUsedWithoutUTF8MB4: false,
  667. isDefaultPhoneRegionSet: true,
  668. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  669. reverseProxyGeneratedURL: 'https://server',
  670. temporaryDirectoryWritable: true,
  671. })
  672. );
  673. async.done(function( data, s, x ){
  674. expect(data).toEqual([{
  675. msg: 'Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories:<ul><li>/some/path</li></ul>',
  676. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  677. }]);
  678. done();
  679. });
  680. });
  681. it('should return an error if the forwarded for headers are not working', function(done) {
  682. var async = OC.SetupChecks.checkSetup();
  683. suite.server.requests[0].respond(
  684. 200,
  685. {
  686. 'Content-Type': 'application/json',
  687. },
  688. JSON.stringify({
  689. hasFileinfoInstalled: true,
  690. isGetenvServerWorking: true,
  691. isReadOnlyConfig: false,
  692. wasEmailTestSuccessful: true,
  693. hasWorkingFileLocking: true,
  694. hasDBFileLocking: false,
  695. hasValidTransactionIsolationLevel: true,
  696. suggestedOverwriteCliURL: '',
  697. isRandomnessSecure: true,
  698. isFairUseOfFreePushService: true,
  699. serverHasInternetConnectionProblems: false,
  700. isMemcacheConfigured: true,
  701. forwardedForHeadersWorking: false,
  702. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  703. isCorrectMemcachedPHPModuleInstalled: true,
  704. hasPassedCodeIntegrityCheck: true,
  705. OpcacheSetupRecommendations: [],
  706. isSettimelimitAvailable: true,
  707. hasFreeTypeSupport: true,
  708. missingIndexes: [],
  709. missingPrimaryKeys: [],
  710. missingColumns: [],
  711. cronErrors: [],
  712. cronInfo: {
  713. diffInSeconds: 0
  714. },
  715. isMemoryLimitSufficient: true,
  716. appDirsWithDifferentOwner: [],
  717. isImagickEnabled: true,
  718. areWebauthnExtensionsEnabled: true,
  719. is64bit: true,
  720. recommendedPHPModules: [],
  721. pendingBigIntConversionColumns: [],
  722. isMysqlUsedWithoutUTF8MB4: false,
  723. isDefaultPhoneRegionSet: true,
  724. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  725. reverseProxyGeneratedURL: 'https://server',
  726. temporaryDirectoryWritable: true,
  727. })
  728. );
  729. async.done(function( data, s, x ){
  730. expect(data).toEqual([{
  731. msg: 'The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If not, this is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud. Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/foo/bar.html">documentation ↗</a>.',
  732. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  733. }]);
  734. done();
  735. });
  736. });
  737. it('should return an error if the admin IP is bruteforce throttled', function(done) {
  738. var async = OC.SetupChecks.checkSetup();
  739. suite.server.requests[0].respond(
  740. 200,
  741. {
  742. 'Content-Type': 'application/json',
  743. },
  744. JSON.stringify({
  745. hasFileinfoInstalled: true,
  746. isGetenvServerWorking: true,
  747. isReadOnlyConfig: false,
  748. wasEmailTestSuccessful: true,
  749. hasWorkingFileLocking: true,
  750. hasDBFileLocking: false,
  751. hasValidTransactionIsolationLevel: true,
  752. suggestedOverwriteCliURL: '',
  753. isRandomnessSecure: true,
  754. isFairUseOfFreePushService: true,
  755. isBruteforceThrottled: true,
  756. bruteforceRemoteAddress: '::1',
  757. serverHasInternetConnectionProblems: false,
  758. isMemcacheConfigured: true,
  759. forwardedForHeadersWorking: true,
  760. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  761. isCorrectMemcachedPHPModuleInstalled: true,
  762. hasPassedCodeIntegrityCheck: true,
  763. OpcacheSetupRecommendations: [],
  764. isSettimelimitAvailable: true,
  765. hasFreeTypeSupport: true,
  766. missingIndexes: [],
  767. missingPrimaryKeys: [],
  768. missingColumns: [],
  769. cronErrors: [],
  770. cronInfo: {
  771. diffInSeconds: 0
  772. },
  773. isMemoryLimitSufficient: true,
  774. appDirsWithDifferentOwner: [],
  775. isImagickEnabled: true,
  776. areWebauthnExtensionsEnabled: true,
  777. is64bit: true,
  778. recommendedPHPModules: [],
  779. pendingBigIntConversionColumns: [],
  780. isMysqlUsedWithoutUTF8MB4: false,
  781. isDefaultPhoneRegionSet: true,
  782. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  783. reverseProxyGeneratedURL: 'https://server',
  784. temporaryDirectoryWritable: true,
  785. })
  786. );
  787. async.done(function( data, s, x ){
  788. expect(data).toEqual([{
  789. msg: 'Your remote address was identified as "::1" and is brute-force throttled at the moment slowing down the performance of various requests. If the remote address is not your address this can be an indication that a proxy is not configured correctly. Further information can be found in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/foo/bar.html">documentation ↗</a>.',
  790. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  791. }]);
  792. done();
  793. });
  794. });
  795. it('should return an error if set_time_limit is unavailable', function(done) {
  796. var async = OC.SetupChecks.checkSetup();
  797. suite.server.requests[0].respond(
  798. 200,
  799. {
  800. 'Content-Type': 'application/json',
  801. },
  802. JSON.stringify({
  803. hasFileinfoInstalled: true,
  804. isGetenvServerWorking: true,
  805. isReadOnlyConfig: false,
  806. wasEmailTestSuccessful: true,
  807. hasWorkingFileLocking: true,
  808. hasDBFileLocking: false,
  809. hasValidTransactionIsolationLevel: true,
  810. suggestedOverwriteCliURL: '',
  811. isRandomnessSecure: true,
  812. isFairUseOfFreePushService: true,
  813. serverHasInternetConnectionProblems: false,
  814. isMemcacheConfigured: true,
  815. forwardedForHeadersWorking: true,
  816. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  817. isCorrectMemcachedPHPModuleInstalled: true,
  818. hasPassedCodeIntegrityCheck: true,
  819. OpcacheSetupRecommendations: [],
  820. isSettimelimitAvailable: false,
  821. hasFreeTypeSupport: true,
  822. missingIndexes: [],
  823. missingPrimaryKeys: [],
  824. missingColumns: [],
  825. cronErrors: [],
  826. cronInfo: {
  827. diffInSeconds: 0
  828. },
  829. isMemoryLimitSufficient: true,
  830. appDirsWithDifferentOwner: [],
  831. isImagickEnabled: true,
  832. areWebauthnExtensionsEnabled: true,
  833. is64bit: true,
  834. recommendedPHPModules: [],
  835. pendingBigIntConversionColumns: [],
  836. isMysqlUsedWithoutUTF8MB4: false,
  837. isDefaultPhoneRegionSet: true,
  838. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  839. reverseProxyGeneratedURL: 'https://server',
  840. temporaryDirectoryWritable: true,
  841. })
  842. );
  843. async.done(function( data, s, x ){
  844. expect(data).toEqual([{
  845. msg: 'The PHP function "set_time_limit" is not available. This could result in scripts being halted mid-execution, breaking your installation. Enabling this function is strongly recommended.',
  846. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  847. }]);
  848. done();
  849. });
  850. });
  851. it('should return a warning if the memory limit is below the recommended value', function(done) {
  852. var async = OC.SetupChecks.checkSetup();
  853. suite.server.requests[0].respond(
  854. 200,
  855. {
  856. 'Content-Type': 'application/json',
  857. },
  858. JSON.stringify({
  859. hasFileinfoInstalled: true,
  860. isGetenvServerWorking: true,
  861. isReadOnlyConfig: false,
  862. wasEmailTestSuccessful: true,
  863. hasWorkingFileLocking: true,
  864. hasDBFileLocking: false,
  865. hasValidTransactionIsolationLevel: true,
  866. suggestedOverwriteCliURL: '',
  867. isRandomnessSecure: true,
  868. isFairUseOfFreePushService: true,
  869. serverHasInternetConnectionProblems: false,
  870. isMemcacheConfigured: true,
  871. forwardedForHeadersWorking: true,
  872. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  873. isCorrectMemcachedPHPModuleInstalled: true,
  874. hasPassedCodeIntegrityCheck: true,
  875. OpcacheSetupRecommendations: [],
  876. isSettimelimitAvailable: true,
  877. hasFreeTypeSupport: true,
  878. missingIndexes: [],
  879. missingPrimaryKeys: [],
  880. missingColumns: [],
  881. cronErrors: [],
  882. cronInfo: {
  883. diffInSeconds: 0
  884. },
  885. isMemoryLimitSufficient: false,
  886. appDirsWithDifferentOwner: [],
  887. isImagickEnabled: true,
  888. areWebauthnExtensionsEnabled: true,
  889. is64bit: true,
  890. recommendedPHPModules: [],
  891. pendingBigIntConversionColumns: [],
  892. isMysqlUsedWithoutUTF8MB4: false,
  893. isDefaultPhoneRegionSet: true,
  894. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  895. reverseProxyGeneratedURL: 'https://server',
  896. temporaryDirectoryWritable: true,
  897. })
  898. );
  899. async.done(function( data, s, x ){
  900. expect(data).toEqual([{
  901. msg: 'The PHP memory limit is below the recommended value of 512MB.',
  902. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  903. }]);
  904. done();
  905. });
  906. });
  907. it('should return an error if the response has no statuscode 200', function(done) {
  908. var async = OC.SetupChecks.checkSetup();
  909. suite.server.requests[0].respond(
  910. 500,
  911. {
  912. 'Content-Type': 'application/json'
  913. },
  914. JSON.stringify({data: {serverHasInternetConnectionProblems: true}})
  915. );
  916. async.done(function( data, s, x ){
  917. expect(data).toEqual([{
  918. msg: 'Error occurred while checking server setup',
  919. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  920. }]);
  921. done();
  922. });
  923. });
  924. it('should return an error if the php version is no longer supported', function(done) {
  925. var async = OC.SetupChecks.checkSetup();
  926. suite.server.requests[0].respond(
  927. 200,
  928. {
  929. 'Content-Type': 'application/json',
  930. },
  931. JSON.stringify({
  932. hasFileinfoInstalled: true,
  933. isGetenvServerWorking: true,
  934. isReadOnlyConfig: false,
  935. wasEmailTestSuccessful: true,
  936. hasWorkingFileLocking: true,
  937. hasDBFileLocking: false,
  938. hasValidTransactionIsolationLevel: true,
  939. suggestedOverwriteCliURL: '',
  940. isRandomnessSecure: true,
  941. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  942. isFairUseOfFreePushService: true,
  943. serverHasInternetConnectionProblems: false,
  944. isMemcacheConfigured: true,
  945. forwardedForHeadersWorking: true,
  946. phpSupported: {eol: true, version: '5.4.0'},
  947. isCorrectMemcachedPHPModuleInstalled: true,
  948. hasPassedCodeIntegrityCheck: true,
  949. OpcacheSetupRecommendations: [],
  950. isSettimelimitAvailable: true,
  951. hasFreeTypeSupport: true,
  952. missingIndexes: [],
  953. missingPrimaryKeys: [],
  954. missingColumns: [],
  955. cronErrors: [],
  956. cronInfo: {
  957. diffInSeconds: 0
  958. },
  959. isMemoryLimitSufficient: true,
  960. appDirsWithDifferentOwner: [],
  961. isImagickEnabled: true,
  962. areWebauthnExtensionsEnabled: true,
  963. is64bit: true,
  964. recommendedPHPModules: [],
  965. pendingBigIntConversionColumns: [],
  966. isMysqlUsedWithoutUTF8MB4: false,
  967. isDefaultPhoneRegionSet: true,
  968. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  969. reverseProxyGeneratedURL: 'https://server',
  970. temporaryDirectoryWritable: true,
  971. })
  972. );
  973. async.done(function( data, s, x ){
  974. expect(data).toEqual([{
  975. msg: 'You are currently running PHP 5.4.0. Upgrade your PHP version to take advantage of <a target="_blank" rel="noreferrer noopener" class="external" href="https://secure.php.net/supported-versions.php">performance and security updates provided by the PHP Group ↗</a> as soon as your distribution supports it.',
  976. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  977. }]);
  978. done();
  979. });
  980. });
  981. it('should return an info if server has no proper opcache', function(done) {
  982. var async = OC.SetupChecks.checkSetup();
  983. suite.server.requests[0].respond(
  984. 200,
  985. {
  986. 'Content-Type': 'application/json'
  987. },
  988. JSON.stringify({
  989. hasFileinfoInstalled: true,
  990. isGetenvServerWorking: true,
  991. isReadOnlyConfig: false,
  992. wasEmailTestSuccessful: true,
  993. hasWorkingFileLocking: true,
  994. hasDBFileLocking: false,
  995. hasValidTransactionIsolationLevel: true,
  996. suggestedOverwriteCliURL: '',
  997. isRandomnessSecure: true,
  998. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  999. isFairUseOfFreePushService: true,
  1000. serverHasInternetConnectionProblems: false,
  1001. isMemcacheConfigured: true,
  1002. forwardedForHeadersWorking: true,
  1003. isCorrectMemcachedPHPModuleInstalled: true,
  1004. hasPassedCodeIntegrityCheck: true,
  1005. OpcacheSetupRecommendations: ['recommendation1', 'recommendation2'],
  1006. isSettimelimitAvailable: true,
  1007. hasFreeTypeSupport: true,
  1008. missingIndexes: [],
  1009. missingPrimaryKeys: [],
  1010. missingColumns: [],
  1011. cronErrors: [],
  1012. cronInfo: {
  1013. diffInSeconds: 0
  1014. },
  1015. isMemoryLimitSufficient: true,
  1016. appDirsWithDifferentOwner: [],
  1017. isImagickEnabled: true,
  1018. areWebauthnExtensionsEnabled: true,
  1019. is64bit: true,
  1020. recommendedPHPModules: [],
  1021. pendingBigIntConversionColumns: [],
  1022. isMysqlUsedWithoutUTF8MB4: false,
  1023. isDefaultPhoneRegionSet: true,
  1024. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1025. reverseProxyGeneratedURL: 'https://server',
  1026. temporaryDirectoryWritable: true,
  1027. })
  1028. );
  1029. async.done(function( data, s, x ){
  1030. expect(data).toEqual([{
  1031. msg: 'The PHP OPcache module is not properly configured. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-php-opcache">documentation ↗</a> for more information.<ul><li>recommendation1</li><li>recommendation2</li></ul>',
  1032. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1033. }]);
  1034. done();
  1035. });
  1036. });
  1037. it('should return an info if server has no FreeType support', function(done) {
  1038. var async = OC.SetupChecks.checkSetup();
  1039. suite.server.requests[0].respond(
  1040. 200,
  1041. {
  1042. 'Content-Type': 'application/json'
  1043. },
  1044. JSON.stringify({
  1045. hasFileinfoInstalled: true,
  1046. isGetenvServerWorking: true,
  1047. isReadOnlyConfig: false,
  1048. wasEmailTestSuccessful: true,
  1049. hasWorkingFileLocking: true,
  1050. hasDBFileLocking: false,
  1051. hasValidTransactionIsolationLevel: true,
  1052. suggestedOverwriteCliURL: '',
  1053. isRandomnessSecure: true,
  1054. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1055. isFairUseOfFreePushService: true,
  1056. serverHasInternetConnectionProblems: false,
  1057. isMemcacheConfigured: true,
  1058. forwardedForHeadersWorking: true,
  1059. isCorrectMemcachedPHPModuleInstalled: true,
  1060. hasPassedCodeIntegrityCheck: true,
  1061. OpcacheSetupRecommendations: [],
  1062. isSettimelimitAvailable: true,
  1063. hasFreeTypeSupport: false,
  1064. missingIndexes: [],
  1065. missingPrimaryKeys: [],
  1066. missingColumns: [],
  1067. cronErrors: [],
  1068. cronInfo: {
  1069. diffInSeconds: 0
  1070. },
  1071. isMemoryLimitSufficient: true,
  1072. appDirsWithDifferentOwner: [],
  1073. isImagickEnabled: true,
  1074. areWebauthnExtensionsEnabled: true,
  1075. is64bit: true,
  1076. recommendedPHPModules: [],
  1077. pendingBigIntConversionColumns: [],
  1078. isMysqlUsedWithoutUTF8MB4: false,
  1079. isDefaultPhoneRegionSet: true,
  1080. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1081. reverseProxyGeneratedURL: 'https://server',
  1082. temporaryDirectoryWritable: true,
  1083. })
  1084. );
  1085. async.done(function( data, s, x ){
  1086. expect(data).toEqual([{
  1087. msg: 'Your PHP does not have FreeType support, resulting in breakage of profile pictures and the settings interface.',
  1088. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1089. }]);
  1090. done();
  1091. });
  1092. });
  1093. it('should return an error if the php version is no longer supported', function(done) {
  1094. var async = OC.SetupChecks.checkSetup();
  1095. suite.server.requests[0].respond(
  1096. 200,
  1097. {
  1098. 'Content-Type': 'application/json',
  1099. },
  1100. JSON.stringify({
  1101. hasFileinfoInstalled: true,
  1102. isGetenvServerWorking: true,
  1103. isReadOnlyConfig: false,
  1104. wasEmailTestSuccessful: true,
  1105. hasWorkingFileLocking: true,
  1106. hasDBFileLocking: false,
  1107. hasValidTransactionIsolationLevel: true,
  1108. suggestedOverwriteCliURL: '',
  1109. isRandomnessSecure: true,
  1110. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1111. isFairUseOfFreePushService: true,
  1112. serverHasInternetConnectionProblems: false,
  1113. isMemcacheConfigured: true,
  1114. forwardedForHeadersWorking: true,
  1115. isCorrectMemcachedPHPModuleInstalled: true,
  1116. hasPassedCodeIntegrityCheck: true,
  1117. OpcacheSetupRecommendations: [],
  1118. isSettimelimitAvailable: true,
  1119. hasFreeTypeSupport: true,
  1120. missingIndexes: [],
  1121. missingPrimaryKeys: [],
  1122. missingColumns: [],
  1123. cronErrors: [],
  1124. cronInfo: {
  1125. diffInSeconds: 0
  1126. },
  1127. isMemoryLimitSufficient: true,
  1128. appDirsWithDifferentOwner: [],
  1129. isImagickEnabled: true,
  1130. areWebauthnExtensionsEnabled: true,
  1131. is64bit: true,
  1132. recommendedPHPModules: [],
  1133. pendingBigIntConversionColumns: [],
  1134. isMysqlUsedWithoutUTF8MB4: true,
  1135. isDefaultPhoneRegionSet: true,
  1136. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1137. reverseProxyGeneratedURL: 'https://server',
  1138. temporaryDirectoryWritable: true,
  1139. })
  1140. );
  1141. async.done(function( data, s, x ){
  1142. expect(data).toEqual([{
  1143. msg: 'MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-mysql-utf8mb4">the documentation page about this ↗</a>.',
  1144. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1145. }]);
  1146. done();
  1147. });
  1148. });
  1149. // THe following test is invalid as the code in core/js/setupchecks.js is calling
  1150. // window.location.protocol which always return http during tests
  1151. // if there is a way to trick window.location.protocol during test, then we could re-activate it
  1152. /*
  1153. it('should return an error if the protocol is https but the server generates http links', function(done) {
  1154. var async = OC.SetupChecks.checkSetup();
  1155. suite.server.requests[0].respond(
  1156. 200,
  1157. {
  1158. 'Content-Type': 'application/json',
  1159. },
  1160. JSON.stringify({
  1161. hasFileinfoInstalled: true,
  1162. isGetenvServerWorking: true,
  1163. isReadOnlyConfig: false,
  1164. wasEmailTestSuccessful: true,
  1165. hasWorkingFileLocking: true,
  1166. hasDBFileLocking: false,
  1167. hasValidTransactionIsolationLevel: true,
  1168. suggestedOverwriteCliURL: '',
  1169. isRandomnessSecure: true,
  1170. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1171. isFairUseOfFreePushService: true,
  1172. serverHasInternetConnectionProblems: false,
  1173. isMemcacheConfigured: true,
  1174. forwardedForHeadersWorking: true,
  1175. isCorrectMemcachedPHPModuleInstalled: true,
  1176. hasPassedCodeIntegrityCheck: true,
  1177. OpcacheSetupRecommendations: [],
  1178. isSettimelimitAvailable: true,
  1179. hasFreeTypeSupport: true,
  1180. missingIndexes: [],
  1181. missingPrimaryKeys: [],
  1182. missingColumns: [],
  1183. cronErrors: [],
  1184. cronInfo: {
  1185. diffInSeconds: 0
  1186. },
  1187. isMemoryLimitSufficient: true,
  1188. appDirsWithDifferentOwner: [],
  1189. isImagickEnabled: true,
  1190. areWebauthnExtensionsEnabled: true,
  1191. is64bit: true,
  1192. recommendedPHPModules: [],
  1193. pendingBigIntConversionColumns: [],
  1194. isMysqlUsedWithoutUTF8MB4: false,
  1195. isDefaultPhoneRegionSet: true,
  1196. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1197. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  1198. reverseProxyGeneratedURL: 'http://server',
  1199. temporaryDirectoryWritable: true,
  1200. })
  1201. );
  1202. async.done(function( data, s, x ){
  1203. expect(data).toEqual([{
  1204. msg: 'You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly. Please read <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.nextcloud.com/foo/bar.html">the documentation page about this ↗</a>.',
  1205. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1206. }]);
  1207. done();
  1208. });
  1209. });
  1210. */
  1211. it('should not return an error if the protocol is http and the server generates http links', function(done) {
  1212. var async = OC.SetupChecks.checkSetup();
  1213. suite.server.requests[0].respond(
  1214. 200,
  1215. {
  1216. 'Content-Type': 'application/json',
  1217. },
  1218. JSON.stringify({
  1219. hasFileinfoInstalled: true,
  1220. isGetenvServerWorking: true,
  1221. isReadOnlyConfig: false,
  1222. wasEmailTestSuccessful: true,
  1223. hasWorkingFileLocking: true,
  1224. hasDBFileLocking: false,
  1225. hasValidTransactionIsolationLevel: true,
  1226. suggestedOverwriteCliURL: '',
  1227. isRandomnessSecure: true,
  1228. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1229. isFairUseOfFreePushService: true,
  1230. serverHasInternetConnectionProblems: false,
  1231. isMemcacheConfigured: true,
  1232. forwardedForHeadersWorking: true,
  1233. isCorrectMemcachedPHPModuleInstalled: true,
  1234. hasPassedCodeIntegrityCheck: true,
  1235. OpcacheSetupRecommendations: [],
  1236. isSettimelimitAvailable: true,
  1237. hasFreeTypeSupport: true,
  1238. missingIndexes: [],
  1239. missingPrimaryKeys: [],
  1240. missingColumns: [],
  1241. cronErrors: [],
  1242. cronInfo: {
  1243. diffInSeconds: 0
  1244. },
  1245. isMemoryLimitSufficient: true,
  1246. appDirsWithDifferentOwner: [],
  1247. isImagickEnabled: true,
  1248. areWebauthnExtensionsEnabled: true,
  1249. is64bit: true,
  1250. recommendedPHPModules: [],
  1251. pendingBigIntConversionColumns: [],
  1252. isMysqlUsedWithoutUTF8MB4: false,
  1253. isDefaultPhoneRegionSet: true,
  1254. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1255. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  1256. reverseProxyGeneratedURL: 'http://server',
  1257. temporaryDirectoryWritable: true,
  1258. })
  1259. );
  1260. async.done(function( data, s, x ){
  1261. expect(data).toEqual([]);
  1262. done();
  1263. });
  1264. });
  1265. it('should return an error if there is not enough free space in the temp directory', function(done) {
  1266. var async = OC.SetupChecks.checkSetup();
  1267. suite.server.requests[0].respond(
  1268. 200,
  1269. {
  1270. 'Content-Type': 'application/json',
  1271. },
  1272. JSON.stringify({
  1273. hasFileinfoInstalled: true,
  1274. isGetenvServerWorking: true,
  1275. isReadOnlyConfig: false,
  1276. wasEmailTestSuccessful: true,
  1277. hasWorkingFileLocking: true,
  1278. hasDBFileLocking: false,
  1279. hasValidTransactionIsolationLevel: true,
  1280. suggestedOverwriteCliURL: '',
  1281. isRandomnessSecure: true,
  1282. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1283. isFairUseOfFreePushService: true,
  1284. serverHasInternetConnectionProblems: false,
  1285. isMemcacheConfigured: true,
  1286. forwardedForHeadersWorking: true,
  1287. isCorrectMemcachedPHPModuleInstalled: true,
  1288. hasPassedCodeIntegrityCheck: true,
  1289. OpcacheSetupRecommendations: [],
  1290. isSettimelimitAvailable: true,
  1291. hasFreeTypeSupport: true,
  1292. missingIndexes: [],
  1293. missingPrimaryKeys: [],
  1294. missingColumns: [],
  1295. cronErrors: [],
  1296. cronInfo: {
  1297. diffInSeconds: 0
  1298. },
  1299. isMemoryLimitSufficient: true,
  1300. appDirsWithDifferentOwner: [],
  1301. isImagickEnabled: true,
  1302. areWebauthnExtensionsEnabled: true,
  1303. is64bit: true,
  1304. recommendedPHPModules: [],
  1305. pendingBigIntConversionColumns: [],
  1306. isMysqlUsedWithoutUTF8MB4: false,
  1307. isDefaultPhoneRegionSet: true,
  1308. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false,
  1309. reverseProxyGeneratedURL: 'https://server',
  1310. temporaryDirectoryWritable: true,
  1311. })
  1312. );
  1313. async.done(function( data, s, x ){
  1314. expect(data).toEqual([{
  1315. msg: 'This instance uses an S3 based object store as primary storage. The uploaded files are stored temporarily on the server and thus it is recommended to have 50 GB of free space available in the temp directory of PHP. Check the logs for full details about the path and the available space. To improve this please change the temporary directory in the php.ini or make more space available in that path.',
  1316. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1317. }]);
  1318. done();
  1319. });
  1320. });
  1321. it('should return an error if imagick is not enabled', function(done) {
  1322. var async = OC.SetupChecks.checkSetup();
  1323. suite.server.requests[0].respond(
  1324. 200,
  1325. {
  1326. 'Content-Type': 'application/json',
  1327. },
  1328. JSON.stringify({
  1329. hasFileinfoInstalled: true,
  1330. isGetenvServerWorking: true,
  1331. isReadOnlyConfig: false,
  1332. wasEmailTestSuccessful: true,
  1333. hasWorkingFileLocking: true,
  1334. hasDBFileLocking: false,
  1335. hasValidTransactionIsolationLevel: true,
  1336. suggestedOverwriteCliURL: '',
  1337. isRandomnessSecure: true,
  1338. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1339. isFairUseOfFreePushService: true,
  1340. serverHasInternetConnectionProblems: false,
  1341. isMemcacheConfigured: true,
  1342. forwardedForHeadersWorking: true,
  1343. isCorrectMemcachedPHPModuleInstalled: true,
  1344. hasPassedCodeIntegrityCheck: true,
  1345. OpcacheSetupRecommendations: [],
  1346. isSettimelimitAvailable: true,
  1347. hasFreeTypeSupport: true,
  1348. missingIndexes: [],
  1349. missingPrimaryKeys: [],
  1350. missingColumns: [],
  1351. cronErrors: [],
  1352. cronInfo: {
  1353. diffInSeconds: 0
  1354. },
  1355. isMemoryLimitSufficient: true,
  1356. appDirsWithDifferentOwner: [],
  1357. isImagickEnabled: false,
  1358. areWebauthnExtensionsEnabled: true,
  1359. is64bit: true,
  1360. recommendedPHPModules: [],
  1361. pendingBigIntConversionColumns: [],
  1362. isMysqlUsedWithoutUTF8MB4: false,
  1363. isDefaultPhoneRegionSet: true,
  1364. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1365. reverseProxyGeneratedURL: 'https://server',
  1366. temporaryDirectoryWritable: true,
  1367. })
  1368. );
  1369. async.done(function( data, s, x ){
  1370. expect(data).toEqual([{
  1371. msg: 'The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.',
  1372. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1373. }]);
  1374. done();
  1375. });
  1376. });
  1377. it('should return an error if gmp or bcmath are not enabled', function(done) {
  1378. var async = OC.SetupChecks.checkSetup();
  1379. suite.server.requests[0].respond(
  1380. 200,
  1381. {
  1382. 'Content-Type': 'application/json',
  1383. },
  1384. JSON.stringify({
  1385. hasFileinfoInstalled: true,
  1386. isGetenvServerWorking: true,
  1387. isReadOnlyConfig: false,
  1388. wasEmailTestSuccessful: true,
  1389. hasWorkingFileLocking: true,
  1390. hasDBFileLocking: false,
  1391. hasValidTransactionIsolationLevel: true,
  1392. suggestedOverwriteCliURL: '',
  1393. isRandomnessSecure: true,
  1394. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1395. isFairUseOfFreePushService: true,
  1396. serverHasInternetConnectionProblems: false,
  1397. isMemcacheConfigured: true,
  1398. forwardedForHeadersWorking: true,
  1399. isCorrectMemcachedPHPModuleInstalled: true,
  1400. hasPassedCodeIntegrityCheck: true,
  1401. OpcacheSetupRecommendations: [],
  1402. isSettimelimitAvailable: true,
  1403. hasFreeTypeSupport: true,
  1404. missingIndexes: [],
  1405. missingPrimaryKeys: [],
  1406. missingColumns: [],
  1407. cronErrors: [],
  1408. cronInfo: {
  1409. diffInSeconds: 0
  1410. },
  1411. isMemoryLimitSufficient: true,
  1412. appDirsWithDifferentOwner: [],
  1413. isImagickEnabled: true,
  1414. areWebauthnExtensionsEnabled: false,
  1415. is64bit: true,
  1416. recommendedPHPModules: [],
  1417. pendingBigIntConversionColumns: [],
  1418. isMysqlUsedWithoutUTF8MB4: false,
  1419. isDefaultPhoneRegionSet: true,
  1420. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1421. reverseProxyGeneratedURL: 'https://server',
  1422. temporaryDirectoryWritable: true,
  1423. })
  1424. );
  1425. async.done(function( data, s, x ){
  1426. expect(data).toEqual([{
  1427. msg: 'The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.',
  1428. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1429. }]);
  1430. done();
  1431. });
  1432. });
  1433. it('should return an error for 32bit instances', function(done) {
  1434. var async = OC.SetupChecks.checkSetup();
  1435. suite.server.requests[0].respond(
  1436. 200,
  1437. {
  1438. 'Content-Type': 'application/json',
  1439. },
  1440. JSON.stringify({
  1441. hasFileinfoInstalled: true,
  1442. isGetenvServerWorking: true,
  1443. isReadOnlyConfig: false,
  1444. wasEmailTestSuccessful: true,
  1445. hasWorkingFileLocking: true,
  1446. hasDBFileLocking: false,
  1447. hasValidTransactionIsolationLevel: true,
  1448. suggestedOverwriteCliURL: '',
  1449. isRandomnessSecure: true,
  1450. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1451. isFairUseOfFreePushService: true,
  1452. serverHasInternetConnectionProblems: false,
  1453. isMemcacheConfigured: true,
  1454. forwardedForHeadersWorking: true,
  1455. isCorrectMemcachedPHPModuleInstalled: true,
  1456. hasPassedCodeIntegrityCheck: true,
  1457. OpcacheSetupRecommendations: [],
  1458. isSettimelimitAvailable: true,
  1459. hasFreeTypeSupport: true,
  1460. missingIndexes: [],
  1461. missingPrimaryKeys: [],
  1462. missingColumns: [],
  1463. cronErrors: [],
  1464. cronInfo: {
  1465. diffInSeconds: 0
  1466. },
  1467. isMemoryLimitSufficient: true,
  1468. appDirsWithDifferentOwner: [],
  1469. isImagickEnabled: true,
  1470. areWebauthnExtensionsEnabled: true,
  1471. is64bit: false,
  1472. recommendedPHPModules: [],
  1473. pendingBigIntConversionColumns: [],
  1474. isMysqlUsedWithoutUTF8MB4: false,
  1475. isDefaultPhoneRegionSet: true,
  1476. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1477. reverseProxyGeneratedURL: 'https://server',
  1478. temporaryDirectoryWritable: true,
  1479. })
  1480. );
  1481. async.done(function( data, s, x ){
  1482. expect(data).toEqual([{
  1483. msg: 'It seems like you are running a 32-bit PHP version. Nextcloud needs 64-bit to run well. Please upgrade your OS and PHP to 64-bit! For further details read <a href="https://docs.example.org/admin-system-requirements" class="external" rel="noreferrer noopener">the documentation page ↗</a> about this.',
  1484. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1485. }]);
  1486. done();
  1487. });
  1488. });
  1489. it('should return an info if there is no default phone region', function(done) {
  1490. var async = OC.SetupChecks.checkSetup();
  1491. suite.server.requests[0].respond(
  1492. 200,
  1493. {
  1494. 'Content-Type': 'application/json',
  1495. },
  1496. JSON.stringify({
  1497. hasFileinfoInstalled: true,
  1498. isGetenvServerWorking: true,
  1499. isReadOnlyConfig: false,
  1500. wasEmailTestSuccessful: true,
  1501. hasWorkingFileLocking: true,
  1502. hasDBFileLocking: false,
  1503. hasValidTransactionIsolationLevel: true,
  1504. suggestedOverwriteCliURL: '',
  1505. isRandomnessSecure: true,
  1506. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1507. isFairUseOfFreePushService: true,
  1508. serverHasInternetConnectionProblems: false,
  1509. isMemcacheConfigured: true,
  1510. forwardedForHeadersWorking: true,
  1511. isCorrectMemcachedPHPModuleInstalled: true,
  1512. hasPassedCodeIntegrityCheck: true,
  1513. OpcacheSetupRecommendations: [],
  1514. isSettimelimitAvailable: true,
  1515. hasFreeTypeSupport: true,
  1516. missingIndexes: [],
  1517. missingPrimaryKeys: [],
  1518. missingColumns: [],
  1519. cronErrors: [],
  1520. cronInfo: {
  1521. diffInSeconds: 0
  1522. },
  1523. isMemoryLimitSufficient: true,
  1524. appDirsWithDifferentOwner: [],
  1525. isImagickEnabled: true,
  1526. areWebauthnExtensionsEnabled: true,
  1527. is64bit: true,
  1528. recommendedPHPModules: [],
  1529. pendingBigIntConversionColumns: [],
  1530. isMysqlUsedWithoutUTF8MB4: false,
  1531. isDefaultPhoneRegionSet: false,
  1532. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1533. reverseProxyGeneratedURL: 'https://server',
  1534. temporaryDirectoryWritable: true,
  1535. })
  1536. );
  1537. async.done(function( data, s, x ){
  1538. expect(data).toEqual([{
  1539. msg: 'Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add "default_phone_region" with the respective <a target="_blank" rel="noreferrer noopener" class="external" href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">ISO 3166-1 code ↗</a> of the region to your config file.',
  1540. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1541. }]);
  1542. done();
  1543. });
  1544. });
  1545. it('should return an info if the temporary directory is either non-existent or non-writable', function(done) {
  1546. var async = OC.SetupChecks.checkSetup();
  1547. suite.server.requests[0].respond(
  1548. 200,
  1549. {
  1550. 'Content-Type': 'application/json',
  1551. },
  1552. JSON.stringify({
  1553. hasFileinfoInstalled: true,
  1554. isGetenvServerWorking: true,
  1555. isReadOnlyConfig: false,
  1556. wasEmailTestSuccessful: true,
  1557. hasWorkingFileLocking: true,
  1558. hasDBFileLocking: false,
  1559. hasValidTransactionIsolationLevel: true,
  1560. suggestedOverwriteCliURL: '',
  1561. isRandomnessSecure: true,
  1562. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1563. isFairUseOfFreePushService: true,
  1564. serverHasInternetConnectionProblems: false,
  1565. isMemcacheConfigured: true,
  1566. forwardedForHeadersWorking: true,
  1567. isCorrectMemcachedPHPModuleInstalled: true,
  1568. hasPassedCodeIntegrityCheck: true,
  1569. OpcacheSetupRecommendations: [],
  1570. isSettimelimitAvailable: true,
  1571. hasFreeTypeSupport: true,
  1572. missingIndexes: [],
  1573. missingPrimaryKeys: [],
  1574. missingColumns: [],
  1575. cronErrors: [],
  1576. cronInfo: {
  1577. diffInSeconds: 0
  1578. },
  1579. isMemoryLimitSufficient: true,
  1580. appDirsWithDifferentOwner: [],
  1581. isImagickEnabled: true,
  1582. areWebauthnExtensionsEnabled: true,
  1583. is64bit: true,
  1584. recommendedPHPModules: [],
  1585. pendingBigIntConversionColumns: [],
  1586. isMysqlUsedWithoutUTF8MB4: false,
  1587. isDefaultPhoneRegionSet: true,
  1588. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1589. reverseProxyGeneratedURL: 'https://server',
  1590. temporaryDirectoryWritable: false,
  1591. })
  1592. );
  1593. async.done(function( data, s, x ){
  1594. expect(data).toEqual([{
  1595. msg: 'The temporary directory of this instance points to an either non-existing or non-writable directory.',
  1596. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1597. }]);
  1598. done();
  1599. });
  1600. });
  1601. });
  1602. describe('checkGeneric', function() {
  1603. it('should return an error if the response has no statuscode 200', function(done) {
  1604. var async = OC.SetupChecks.checkGeneric();
  1605. suite.server.requests[0].respond(
  1606. 500,
  1607. {
  1608. 'Content-Type': 'application/json'
  1609. }
  1610. );
  1611. async.done(function( data, s, x ){
  1612. expect(data).toEqual([{
  1613. msg: 'Error occurred while checking server setup',
  1614. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1615. },{
  1616. msg: 'Error occurred while checking server setup',
  1617. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1618. }]);
  1619. done();
  1620. });
  1621. });
  1622. it('should return all errors if all headers are missing', function(done) {
  1623. protocolStub.returns('https');
  1624. var async = OC.SetupChecks.checkGeneric();
  1625. suite.server.requests[0].respond(
  1626. 200,
  1627. {
  1628. 'Content-Type': 'application/json',
  1629. 'Strict-Transport-Security': 'max-age=15768000'
  1630. },
  1631. '{}'
  1632. );
  1633. async.done(function( data, s, x ){
  1634. expect(data).toEqual([
  1635. {
  1636. msg: 'The "X-Content-Type-Options" HTTP header is not set to "nosniff". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1637. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1638. }, {
  1639. msg: 'The "X-Robots-Tag" HTTP header is not set to "noindex, nofollow". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1640. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1641. }, {
  1642. msg: 'The "X-Frame-Options" HTTP header is not set to "SAMEORIGIN". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1643. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1644. }, {
  1645. msg: 'The "X-Permitted-Cross-Domain-Policies" HTTP header is not set to "none". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1646. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1647. }, {
  1648. msg: 'The "X-XSS-Protection" HTTP header does not contain "1; mode=block". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1649. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1650. }, {
  1651. msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin", "strict-origin-when-cross-origin" or "same-origin". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://www.w3.org/TR/referrer-policy/">W3C Recommendation ↗</a>.',
  1652. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1653. }
  1654. ]);
  1655. done();
  1656. });
  1657. });
  1658. it('should return only some errors if just some headers are missing', function(done) {
  1659. protocolStub.returns('https');
  1660. var async = OC.SetupChecks.checkGeneric();
  1661. suite.server.requests[0].respond(
  1662. 200,
  1663. {
  1664. 'X-Robots-Tag': 'noindex, nofollow',
  1665. 'X-Frame-Options': 'SAMEORIGIN',
  1666. 'Strict-Transport-Security': 'max-age=15768000;preload',
  1667. 'X-Permitted-Cross-Domain-Policies': 'none',
  1668. 'Referrer-Policy': 'no-referrer',
  1669. }
  1670. );
  1671. async.done(function( data, s, x ){
  1672. expect(data).toEqual([
  1673. {
  1674. msg: 'The "X-Content-Type-Options" HTTP header is not set to "nosniff". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1675. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1676. }, {
  1677. msg: 'The "X-XSS-Protection" HTTP header does not contain "1; mode=block". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1678. type: OC.SetupChecks.MESSAGE_TYPE_WARNING,
  1679. }
  1680. ]);
  1681. done();
  1682. });
  1683. });
  1684. it('should return none errors if all headers are there', function(done) {
  1685. protocolStub.returns('https');
  1686. var async = OC.SetupChecks.checkGeneric();
  1687. suite.server.requests[0].respond(
  1688. 200,
  1689. {
  1690. 'X-XSS-Protection': '1; mode=block',
  1691. 'X-Content-Type-Options': 'nosniff',
  1692. 'X-Robots-Tag': 'noindex, nofollow',
  1693. 'X-Frame-Options': 'SAMEORIGIN',
  1694. 'Strict-Transport-Security': 'max-age=15768000',
  1695. 'X-Permitted-Cross-Domain-Policies': 'none',
  1696. 'Referrer-Policy': 'no-referrer'
  1697. }
  1698. );
  1699. async.done(function( data, s, x ){
  1700. expect(data).toEqual([]);
  1701. done();
  1702. });
  1703. });
  1704. describe('check X-Robots-Tag header', function() {
  1705. it('should return no message if X-Robots-Tag is set to noindex,nofollow without space', function(done) {
  1706. protocolStub.returns('https');
  1707. var result = OC.SetupChecks.checkGeneric();
  1708. suite.server.requests[0].respond(200, {
  1709. 'Strict-Transport-Security': 'max-age=15768000',
  1710. 'X-XSS-Protection': '1; mode=block',
  1711. 'X-Content-Type-Options': 'nosniff',
  1712. 'X-Robots-Tag': 'noindex,nofollow',
  1713. 'X-Frame-Options': 'SAMEORIGIN',
  1714. 'X-Permitted-Cross-Domain-Policies': 'none',
  1715. 'Referrer-Policy': 'no-referrer',
  1716. });
  1717. result.done(function( data, s, x ){
  1718. expect(data).toEqual([]);
  1719. done();
  1720. });
  1721. });
  1722. it('should return a message if X-Robots-Tag is set to none', function(done) {
  1723. protocolStub.returns('https');
  1724. var result = OC.SetupChecks.checkGeneric();
  1725. suite.server.requests[0].respond(200, {
  1726. 'Strict-Transport-Security': 'max-age=15768000',
  1727. 'X-XSS-Protection': '1; mode=block',
  1728. 'X-Content-Type-Options': 'nosniff',
  1729. 'X-Robots-Tag': 'none',
  1730. 'X-Frame-Options': 'SAMEORIGIN',
  1731. 'X-Permitted-Cross-Domain-Policies': 'none',
  1732. 'Referrer-Policy': 'no-referrer',
  1733. });
  1734. result.done(function( data, s, x ){
  1735. expect(data).toEqual([
  1736. {
  1737. msg: 'The "X-Robots-Tag" HTTP header is not set to "noindex, nofollow". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1738. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1739. }
  1740. ]);
  1741. done();
  1742. });
  1743. });
  1744. });
  1745. describe('check X-XSS-Protection header', function() {
  1746. it('should return no message if X-XSS-Protection is set to 1; mode=block; report=https://example.com', function(done) {
  1747. protocolStub.returns('https');
  1748. var result = OC.SetupChecks.checkGeneric();
  1749. suite.server.requests[0].respond(200, {
  1750. 'Strict-Transport-Security': 'max-age=15768000',
  1751. 'X-XSS-Protection': '1; mode=block; report=https://example.com',
  1752. 'X-Content-Type-Options': 'nosniff',
  1753. 'X-Robots-Tag': 'noindex, nofollow',
  1754. 'X-Frame-Options': 'SAMEORIGIN',
  1755. 'X-Permitted-Cross-Domain-Policies': 'none',
  1756. 'Referrer-Policy': 'no-referrer',
  1757. });
  1758. result.done(function( data, s, x ){
  1759. expect(data).toEqual([]);
  1760. done();
  1761. });
  1762. });
  1763. it('should return no message if X-XSS-Protection is set to 1; mode=block', function(done) {
  1764. protocolStub.returns('https');
  1765. var result = OC.SetupChecks.checkGeneric();
  1766. suite.server.requests[0].respond(200, {
  1767. 'Strict-Transport-Security': 'max-age=15768000',
  1768. 'X-XSS-Protection': '1; mode=block',
  1769. 'X-Content-Type-Options': 'nosniff',
  1770. 'X-Robots-Tag': 'noindex, nofollow',
  1771. 'X-Frame-Options': 'SAMEORIGIN',
  1772. 'X-Permitted-Cross-Domain-Policies': 'none',
  1773. 'Referrer-Policy': 'no-referrer',
  1774. });
  1775. result.done(function( data, s, x ){
  1776. expect(data).toEqual([]);
  1777. done();
  1778. });
  1779. });
  1780. it('should return a message if X-XSS-Protection is set to 1', function(done) {
  1781. protocolStub.returns('https');
  1782. var result = OC.SetupChecks.checkGeneric();
  1783. suite.server.requests[0].respond(200, {
  1784. 'Strict-Transport-Security': 'max-age=15768000',
  1785. 'X-XSS-Protection': '1',
  1786. 'X-Content-Type-Options': 'nosniff',
  1787. 'X-Robots-Tag': 'noindex, nofollow',
  1788. 'X-Frame-Options': 'SAMEORIGIN',
  1789. 'X-Permitted-Cross-Domain-Policies': 'none',
  1790. 'Referrer-Policy': 'no-referrer',
  1791. });
  1792. result.done(function( data, s, x ){
  1793. expect(data).toEqual([
  1794. {
  1795. msg: 'The "X-XSS-Protection" HTTP header does not contain "1; mode=block". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1796. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1797. }
  1798. ]);
  1799. done();
  1800. });
  1801. });
  1802. it('should return a message if X-XSS-Protection is set to 0', function(done) {
  1803. protocolStub.returns('https');
  1804. var result = OC.SetupChecks.checkGeneric();
  1805. suite.server.requests[0].respond(200, {
  1806. 'Strict-Transport-Security': 'max-age=15768000',
  1807. 'X-XSS-Protection': '0',
  1808. 'X-Content-Type-Options': 'nosniff',
  1809. 'X-Robots-Tag': 'noindex, nofollow',
  1810. 'X-Frame-Options': 'SAMEORIGIN',
  1811. 'X-Permitted-Cross-Domain-Policies': 'none',
  1812. 'Referrer-Policy': 'no-referrer',
  1813. });
  1814. result.done(function( data, s, x ){
  1815. expect(data).toEqual([
  1816. {
  1817. msg: 'The "X-XSS-Protection" HTTP header does not contain "1; mode=block". This is a potential security or privacy risk, as it is recommended to adjust this setting accordingly.',
  1818. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1819. }
  1820. ]);
  1821. done();
  1822. });
  1823. });
  1824. });
  1825. describe('check Referrer-Policy header', function() {
  1826. it('should return no message if Referrer-Policy is set to no-referrer', function(done) {
  1827. protocolStub.returns('https');
  1828. var result = OC.SetupChecks.checkGeneric();
  1829. suite.server.requests[0].respond(200, {
  1830. 'Strict-Transport-Security': 'max-age=15768000',
  1831. 'X-XSS-Protection': '1; mode=block',
  1832. 'X-Content-Type-Options': 'nosniff',
  1833. 'X-Robots-Tag': 'noindex, nofollow',
  1834. 'X-Frame-Options': 'SAMEORIGIN',
  1835. 'X-Permitted-Cross-Domain-Policies': 'none',
  1836. 'Referrer-Policy': 'no-referrer',
  1837. });
  1838. result.done(function( data, s, x ){
  1839. expect(data).toEqual([]);
  1840. done();
  1841. });
  1842. });
  1843. it('should return no message if Referrer-Policy is set to no-referrer-when-downgrade', function(done) {
  1844. protocolStub.returns('https');
  1845. var result = OC.SetupChecks.checkGeneric();
  1846. suite.server.requests[0].respond(200, {
  1847. 'Strict-Transport-Security': 'max-age=15768000',
  1848. 'X-XSS-Protection': '1; mode=block',
  1849. 'X-Content-Type-Options': 'nosniff',
  1850. 'X-Robots-Tag': 'noindex, nofollow',
  1851. 'X-Frame-Options': 'SAMEORIGIN',
  1852. 'X-Permitted-Cross-Domain-Policies': 'none',
  1853. 'Referrer-Policy': 'no-referrer-when-downgrade',
  1854. });
  1855. result.done(function( data, s, x ){
  1856. expect(data).toEqual([]);
  1857. done();
  1858. });
  1859. });
  1860. it('should return no message if Referrer-Policy is set to strict-origin', function(done) {
  1861. protocolStub.returns('https');
  1862. var result = OC.SetupChecks.checkGeneric();
  1863. suite.server.requests[0].respond(200, {
  1864. 'Strict-Transport-Security': 'max-age=15768000',
  1865. 'X-XSS-Protection': '1; mode=block',
  1866. 'X-Content-Type-Options': 'nosniff',
  1867. 'X-Robots-Tag': 'noindex, nofollow',
  1868. 'X-Frame-Options': 'SAMEORIGIN',
  1869. 'X-Permitted-Cross-Domain-Policies': 'none',
  1870. 'Referrer-Policy': 'strict-origin',
  1871. });
  1872. result.done(function( data, s, x ){
  1873. expect(data).toEqual([]);
  1874. done();
  1875. });
  1876. });
  1877. it('should return no message if Referrer-Policy is set to strict-origin-when-cross-origin', function(done) {
  1878. protocolStub.returns('https');
  1879. var result = OC.SetupChecks.checkGeneric();
  1880. suite.server.requests[0].respond(200, {
  1881. 'Strict-Transport-Security': 'max-age=15768000',
  1882. 'X-XSS-Protection': '1; mode=block',
  1883. 'X-Content-Type-Options': 'nosniff',
  1884. 'X-Robots-Tag': 'noindex, nofollow',
  1885. 'X-Frame-Options': 'SAMEORIGIN',
  1886. 'X-Permitted-Cross-Domain-Policies': 'none',
  1887. 'Referrer-Policy': 'strict-origin-when-cross-origin',
  1888. });
  1889. result.done(function( data, s, x ){
  1890. expect(data).toEqual([]);
  1891. done();
  1892. });
  1893. });
  1894. it('should return no message if Referrer-Policy is set to same-origin', function(done) {
  1895. protocolStub.returns('https');
  1896. var result = OC.SetupChecks.checkGeneric();
  1897. suite.server.requests[0].respond(200, {
  1898. 'Strict-Transport-Security': 'max-age=15768000',
  1899. 'X-XSS-Protection': '1; mode=block',
  1900. 'X-Content-Type-Options': 'nosniff',
  1901. 'X-Robots-Tag': 'noindex, nofollow',
  1902. 'X-Frame-Options': 'SAMEORIGIN',
  1903. 'X-Permitted-Cross-Domain-Policies': 'none',
  1904. 'Referrer-Policy': 'same-origin',
  1905. });
  1906. result.done(function( data, s, x ){
  1907. expect(data).toEqual([]);
  1908. done();
  1909. });
  1910. });
  1911. it('should return a message if Referrer-Policy is set to origin', function(done) {
  1912. protocolStub.returns('https');
  1913. var result = OC.SetupChecks.checkGeneric();
  1914. suite.server.requests[0].respond(200, {
  1915. 'Strict-Transport-Security': 'max-age=15768000',
  1916. 'X-XSS-Protection': '1; mode=block',
  1917. 'X-Content-Type-Options': 'nosniff',
  1918. 'X-Robots-Tag': 'noindex, nofollow',
  1919. 'X-Frame-Options': 'SAMEORIGIN',
  1920. 'X-Permitted-Cross-Domain-Policies': 'none',
  1921. 'Referrer-Policy': 'origin',
  1922. });
  1923. result.done(function( data, s, x ){
  1924. expect(data).toEqual([
  1925. {
  1926. msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin", "strict-origin-when-cross-origin" or "same-origin". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://www.w3.org/TR/referrer-policy/">W3C Recommendation ↗</a>.',
  1927. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1928. }
  1929. ]);
  1930. done();
  1931. });
  1932. });
  1933. it('should return a message if Referrer-Policy is set to origin-when-cross-origin', function(done) {
  1934. protocolStub.returns('https');
  1935. var result = OC.SetupChecks.checkGeneric();
  1936. suite.server.requests[0].respond(200, {
  1937. 'Strict-Transport-Security': 'max-age=15768000',
  1938. 'X-XSS-Protection': '1; mode=block',
  1939. 'X-Content-Type-Options': 'nosniff',
  1940. 'X-Robots-Tag': 'noindex, nofollow',
  1941. 'X-Frame-Options': 'SAMEORIGIN',
  1942. 'X-Permitted-Cross-Domain-Policies': 'none',
  1943. 'Referrer-Policy': 'origin-when-cross-origin',
  1944. });
  1945. result.done(function( data, s, x ){
  1946. expect(data).toEqual([
  1947. {
  1948. msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin", "strict-origin-when-cross-origin" or "same-origin". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://www.w3.org/TR/referrer-policy/">W3C Recommendation ↗</a>.',
  1949. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1950. }
  1951. ]);
  1952. done();
  1953. });
  1954. });
  1955. it('should return a message if Referrer-Policy is set to unsafe-url', function(done) {
  1956. protocolStub.returns('https');
  1957. var result = OC.SetupChecks.checkGeneric();
  1958. suite.server.requests[0].respond(200, {
  1959. 'Strict-Transport-Security': 'max-age=15768000',
  1960. 'X-XSS-Protection': '1; mode=block',
  1961. 'X-Content-Type-Options': 'nosniff',
  1962. 'X-Robots-Tag': 'noindex, nofollow',
  1963. 'X-Frame-Options': 'SAMEORIGIN',
  1964. 'X-Permitted-Cross-Domain-Policies': 'none',
  1965. 'Referrer-Policy': 'unsafe-url',
  1966. });
  1967. result.done(function( data, s, x ){
  1968. expect(data).toEqual([
  1969. {
  1970. msg: 'The "Referrer-Policy" HTTP header is not set to "no-referrer", "no-referrer-when-downgrade", "strict-origin", "strict-origin-when-cross-origin" or "same-origin". This can leak referer information. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://www.w3.org/TR/referrer-policy/">W3C Recommendation ↗</a>.',
  1971. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1972. }
  1973. ]);
  1974. done();
  1975. });
  1976. });
  1977. });
  1978. });
  1979. it('should return an error if the response has no statuscode 200', function(done) {
  1980. var async = OC.SetupChecks.checkGeneric();
  1981. suite.server.requests[0].respond(
  1982. 500,
  1983. {
  1984. 'Content-Type': 'application/json'
  1985. },
  1986. JSON.stringify({data: {serverHasInternetConnectionProblems: true}})
  1987. );
  1988. async.done(function( data, s, x ){
  1989. expect(data).toEqual([{
  1990. msg: 'Error occurred while checking server setup',
  1991. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1992. }, {
  1993. msg: 'Error occurred while checking server setup',
  1994. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1995. }]);
  1996. done();
  1997. });
  1998. });
  1999. it('should return a SSL warning if SSL used without Strict-Transport-Security-Header', function(done) {
  2000. protocolStub.returns('https');
  2001. var async = OC.SetupChecks.checkGeneric();
  2002. suite.server.requests[0].respond(200,
  2003. {
  2004. 'X-XSS-Protection': '1; mode=block',
  2005. 'X-Content-Type-Options': 'nosniff',
  2006. 'X-Robots-Tag': 'noindex, nofollow',
  2007. 'X-Frame-Options': 'SAMEORIGIN',
  2008. 'X-Permitted-Cross-Domain-Policies': 'none',
  2009. 'Referrer-Policy': 'no-referrer',
  2010. }
  2011. );
  2012. async.done(function( data, s, x ){
  2013. expect(data).toEqual([{
  2014. msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-security">security tips ↗</a>.',
  2015. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2016. }]);
  2017. done();
  2018. });
  2019. });
  2020. it('should return a SSL warning if SSL used with to small Strict-Transport-Security-Header', function(done) {
  2021. protocolStub.returns('https');
  2022. var async = OC.SetupChecks.checkGeneric();
  2023. suite.server.requests[0].respond(200,
  2024. {
  2025. 'Strict-Transport-Security': 'max-age=15551999',
  2026. 'X-XSS-Protection': '1; mode=block',
  2027. 'X-Content-Type-Options': 'nosniff',
  2028. 'X-Robots-Tag': 'noindex, nofollow',
  2029. 'X-Frame-Options': 'SAMEORIGIN',
  2030. 'X-Permitted-Cross-Domain-Policies': 'none',
  2031. 'Referrer-Policy': 'no-referrer',
  2032. }
  2033. );
  2034. async.done(function( data, s, x ){
  2035. expect(data).toEqual([{
  2036. msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-security">security tips ↗</a>.',
  2037. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2038. }]);
  2039. done();
  2040. });
  2041. });
  2042. it('should return a SSL warning if SSL used with to a bogus Strict-Transport-Security-Header', function(done) {
  2043. protocolStub.returns('https');
  2044. var async = OC.SetupChecks.checkGeneric();
  2045. suite.server.requests[0].respond(200,
  2046. {
  2047. 'Strict-Transport-Security': 'iAmABogusHeader342',
  2048. 'X-XSS-Protection': '1; mode=block',
  2049. 'X-Content-Type-Options': 'nosniff',
  2050. 'X-Robots-Tag': 'noindex, nofollow',
  2051. 'X-Frame-Options': 'SAMEORIGIN',
  2052. 'X-Permitted-Cross-Domain-Policies': 'none',
  2053. 'Referrer-Policy': 'no-referrer',
  2054. }
  2055. );
  2056. async.done(function( data, s, x ){
  2057. expect(data).toEqual([{
  2058. msg: 'The "Strict-Transport-Security" HTTP header is not set to at least "15552000" seconds. For enhanced security, it is recommended to enable HSTS as described in the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-security">security tips ↗</a>.',
  2059. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2060. }]);
  2061. done();
  2062. });
  2063. });
  2064. it('should return no SSL warning if SSL used with to exact the minimum Strict-Transport-Security-Header', function(done) {
  2065. protocolStub.returns('https');
  2066. var async = OC.SetupChecks.checkGeneric();
  2067. suite.server.requests[0].respond(200, {
  2068. 'Strict-Transport-Security': 'max-age=15768000',
  2069. 'X-XSS-Protection': '1; mode=block',
  2070. 'X-Content-Type-Options': 'nosniff',
  2071. 'X-Robots-Tag': 'noindex, nofollow',
  2072. 'X-Frame-Options': 'SAMEORIGIN',
  2073. 'X-Permitted-Cross-Domain-Policies': 'none',
  2074. 'Referrer-Policy': 'no-referrer',
  2075. });
  2076. async.done(function( data, s, x ){
  2077. expect(data).toEqual([]);
  2078. done();
  2079. });
  2080. });
  2081. it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header', function(done) {
  2082. protocolStub.returns('https');
  2083. var async = OC.SetupChecks.checkGeneric();
  2084. suite.server.requests[0].respond(200, {
  2085. 'Strict-Transport-Security': 'max-age=99999999',
  2086. 'X-XSS-Protection': '1; mode=block',
  2087. 'X-Content-Type-Options': 'nosniff',
  2088. 'X-Robots-Tag': 'noindex, nofollow',
  2089. 'X-Frame-Options': 'SAMEORIGIN',
  2090. 'X-Permitted-Cross-Domain-Policies': 'none',
  2091. 'Referrer-Policy': 'no-referrer',
  2092. });
  2093. async.done(function( data, s, x ){
  2094. expect(data).toEqual([]);
  2095. done();
  2096. });
  2097. });
  2098. it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header and includeSubDomains parameter', function(done) {
  2099. protocolStub.returns('https');
  2100. var async = OC.SetupChecks.checkGeneric();
  2101. suite.server.requests[0].respond(200, {
  2102. 'Strict-Transport-Security': 'max-age=99999999; includeSubDomains',
  2103. 'X-XSS-Protection': '1; mode=block',
  2104. 'X-Content-Type-Options': 'nosniff',
  2105. 'X-Robots-Tag': 'noindex, nofollow',
  2106. 'X-Frame-Options': 'SAMEORIGIN',
  2107. 'X-Permitted-Cross-Domain-Policies': 'none',
  2108. 'Referrer-Policy': 'no-referrer',
  2109. });
  2110. async.done(function( data, s, x ){
  2111. expect(data).toEqual([]);
  2112. done();
  2113. });
  2114. });
  2115. it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header and includeSubDomains and preload parameter', function(done) {
  2116. protocolStub.returns('https');
  2117. var async = OC.SetupChecks.checkGeneric();
  2118. suite.server.requests[0].respond(200, {
  2119. 'Strict-Transport-Security': 'max-age=99999999; preload; includeSubDomains',
  2120. 'X-XSS-Protection': '1; mode=block',
  2121. 'X-Content-Type-Options': 'nosniff',
  2122. 'X-Robots-Tag': 'noindex, nofollow',
  2123. 'X-Frame-Options': 'SAMEORIGIN',
  2124. 'X-Permitted-Cross-Domain-Policies': 'none',
  2125. 'Referrer-Policy': 'no-referrer',
  2126. });
  2127. async.done(function( data, s, x ){
  2128. expect(data).toEqual([]);
  2129. done();
  2130. });
  2131. });
  2132. });