setupchecksSpec.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524
  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. memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance',
  186. forwardedForHeadersWorking: true,
  187. isCorrectMemcachedPHPModuleInstalled: true,
  188. hasPassedCodeIntegrityCheck: true,
  189. OpcacheSetupRecommendations: [],
  190. isSettimelimitAvailable: true,
  191. hasFreeTypeSupport: true,
  192. missingIndexes: [],
  193. missingPrimaryKeys: [],
  194. missingColumns: [],
  195. cronErrors: [],
  196. cronInfo: {
  197. diffInSeconds: 0
  198. },
  199. isMemoryLimitSufficient: true,
  200. appDirsWithDifferentOwner: [],
  201. isImagickEnabled: true,
  202. areWebauthnExtensionsEnabled: true,
  203. is64bit: true,
  204. recommendedPHPModules: [],
  205. pendingBigIntConversionColumns: [],
  206. isMysqlUsedWithoutUTF8MB4: false,
  207. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  208. reverseProxyGeneratedURL: 'https://server',
  209. temporaryDirectoryWritable: true,
  210. generic: {
  211. network: {
  212. "Internet connectivity": {
  213. severity: "warning",
  214. description: '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.',
  215. linkToDoc: null
  216. }
  217. },
  218. },
  219. })
  220. );
  221. async.done(function( data, s, x ){
  222. expect(data).toEqual([
  223. {
  224. 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>.',
  225. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  226. },
  227. {
  228. 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.',
  229. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  230. },
  231. ]);
  232. done();
  233. });
  234. });
  235. it('should return an error if server has no internet connection and data directory is not protected', function(done) {
  236. var async = OC.SetupChecks.checkSetup();
  237. suite.server.requests[0].respond(
  238. 200,
  239. {
  240. 'Content-Type': 'application/json'
  241. },
  242. JSON.stringify({
  243. hasFileinfoInstalled: true,
  244. isGetenvServerWorking: true,
  245. isReadOnlyConfig: false,
  246. wasEmailTestSuccessful: true,
  247. hasWorkingFileLocking: true,
  248. hasDBFileLocking: false,
  249. hasValidTransactionIsolationLevel: true,
  250. suggestedOverwriteCliURL: '',
  251. isRandomnessSecure: true,
  252. isFairUseOfFreePushService: true,
  253. memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance',
  254. forwardedForHeadersWorking: true,
  255. isCorrectMemcachedPHPModuleInstalled: true,
  256. hasPassedCodeIntegrityCheck: true,
  257. OpcacheSetupRecommendations: [],
  258. isSettimelimitAvailable: true,
  259. hasFreeTypeSupport: true,
  260. missingIndexes: [],
  261. missingPrimaryKeys: [],
  262. missingColumns: [],
  263. cronErrors: [],
  264. cronInfo: {
  265. diffInSeconds: 0
  266. },
  267. isMemoryLimitSufficient: true,
  268. appDirsWithDifferentOwner: [],
  269. isImagickEnabled: true,
  270. areWebauthnExtensionsEnabled: true,
  271. is64bit: true,
  272. recommendedPHPModules: [],
  273. pendingBigIntConversionColumns: [],
  274. isMysqlUsedWithoutUTF8MB4: false,
  275. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  276. reverseProxyGeneratedURL: 'https://server',
  277. temporaryDirectoryWritable: true,
  278. generic: {
  279. network: {
  280. "Internet connectivity": {
  281. severity: "warning",
  282. description: '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.',
  283. linkToDoc: null
  284. }
  285. },
  286. },
  287. })
  288. );
  289. async.done(function( data, s, x ){
  290. expect(data).toEqual([
  291. {
  292. 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>.',
  293. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  294. },
  295. {
  296. 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.',
  297. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  298. },
  299. ]);
  300. done();
  301. });
  302. });
  303. it('should return an error if server has no internet connection and data directory is not protected and memcache is available', function(done) {
  304. var async = OC.SetupChecks.checkSetup();
  305. suite.server.requests[0].respond(
  306. 200,
  307. {
  308. 'Content-Type': 'application/json',
  309. },
  310. JSON.stringify({
  311. hasFileinfoInstalled: true,
  312. isGetenvServerWorking: true,
  313. isReadOnlyConfig: false,
  314. wasEmailTestSuccessful: true,
  315. hasWorkingFileLocking: true,
  316. hasDBFileLocking: false,
  317. hasValidTransactionIsolationLevel: true,
  318. suggestedOverwriteCliURL: '',
  319. isRandomnessSecure: true,
  320. isFairUseOfFreePushService: true,
  321. isMemcacheConfigured: true,
  322. forwardedForHeadersWorking: true,
  323. isCorrectMemcachedPHPModuleInstalled: true,
  324. hasPassedCodeIntegrityCheck: true,
  325. OpcacheSetupRecommendations: [],
  326. isSettimelimitAvailable: true,
  327. hasFreeTypeSupport: true,
  328. missingIndexes: [],
  329. missingPrimaryKeys: [],
  330. missingColumns: [],
  331. cronErrors: [],
  332. cronInfo: {
  333. diffInSeconds: 0
  334. },
  335. isMemoryLimitSufficient: true,
  336. appDirsWithDifferentOwner: [],
  337. isImagickEnabled: true,
  338. areWebauthnExtensionsEnabled: true,
  339. is64bit: true,
  340. recommendedPHPModules: [],
  341. pendingBigIntConversionColumns: [],
  342. isMysqlUsedWithoutUTF8MB4: false,
  343. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  344. reverseProxyGeneratedURL: 'https://server',
  345. temporaryDirectoryWritable: true,
  346. generic: {
  347. network: {
  348. "Internet connectivity": {
  349. severity: "warning",
  350. description: '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.',
  351. linkToDoc: null
  352. }
  353. },
  354. },
  355. })
  356. );
  357. async.done(function( data, s, x ){
  358. expect(data).toEqual([
  359. {
  360. 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.',
  361. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  362. }
  363. ]);
  364. done();
  365. });
  366. });
  367. it('should return an error if /dev/urandom is not accessible', function(done) {
  368. var async = OC.SetupChecks.checkSetup();
  369. suite.server.requests[0].respond(
  370. 200,
  371. {
  372. 'Content-Type': 'application/json',
  373. },
  374. JSON.stringify({
  375. hasFileinfoInstalled: true,
  376. isGetenvServerWorking: true,
  377. isReadOnlyConfig: false,
  378. wasEmailTestSuccessful: true,
  379. hasWorkingFileLocking: true,
  380. hasDBFileLocking: false,
  381. hasValidTransactionIsolationLevel: true,
  382. suggestedOverwriteCliURL: '',
  383. isRandomnessSecure: false,
  384. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  385. isFairUseOfFreePushService: true,
  386. isMemcacheConfigured: true,
  387. forwardedForHeadersWorking: true,
  388. isCorrectMemcachedPHPModuleInstalled: true,
  389. hasPassedCodeIntegrityCheck: true,
  390. OpcacheSetupRecommendations: [],
  391. isSettimelimitAvailable: true,
  392. hasFreeTypeSupport: true,
  393. missingIndexes: [],
  394. missingPrimaryKeys: [],
  395. missingColumns: [],
  396. cronErrors: [],
  397. cronInfo: {
  398. diffInSeconds: 0
  399. },
  400. isMemoryLimitSufficient: true,
  401. appDirsWithDifferentOwner: [],
  402. isImagickEnabled: true,
  403. areWebauthnExtensionsEnabled: true,
  404. is64bit: true,
  405. recommendedPHPModules: [],
  406. pendingBigIntConversionColumns: [],
  407. isMysqlUsedWithoutUTF8MB4: false,
  408. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  409. reverseProxyGeneratedURL: 'https://server',
  410. temporaryDirectoryWritable: true,
  411. generic: {
  412. network: {
  413. "Internet connectivity": {
  414. severity: "success",
  415. description: null,
  416. linkToDoc: null
  417. }
  418. },
  419. },
  420. })
  421. );
  422. async.done(function( data, s, x ){
  423. expect(data).toEqual([{
  424. 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>.',
  425. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  426. }]);
  427. done();
  428. });
  429. });
  430. it('should return an error if the wrong memcache PHP module is installed', function(done) {
  431. var async = OC.SetupChecks.checkSetup();
  432. suite.server.requests[0].respond(
  433. 200,
  434. {
  435. 'Content-Type': 'application/json',
  436. },
  437. JSON.stringify({
  438. hasFileinfoInstalled: true,
  439. isGetenvServerWorking: true,
  440. isReadOnlyConfig: false,
  441. wasEmailTestSuccessful: true,
  442. hasWorkingFileLocking: true,
  443. hasDBFileLocking: false,
  444. hasValidTransactionIsolationLevel: true,
  445. suggestedOverwriteCliURL: '',
  446. isRandomnessSecure: true,
  447. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  448. isFairUseOfFreePushService: true,
  449. isMemcacheConfigured: true,
  450. forwardedForHeadersWorking: true,
  451. isCorrectMemcachedPHPModuleInstalled: false,
  452. hasPassedCodeIntegrityCheck: true,
  453. OpcacheSetupRecommendations: [],
  454. isSettimelimitAvailable: true,
  455. hasFreeTypeSupport: true,
  456. missingIndexes: [],
  457. missingPrimaryKeys: [],
  458. missingColumns: [],
  459. cronErrors: [],
  460. cronInfo: {
  461. diffInSeconds: 0
  462. },
  463. isMemoryLimitSufficient: true,
  464. appDirsWithDifferentOwner: [],
  465. isImagickEnabled: true,
  466. areWebauthnExtensionsEnabled: true,
  467. is64bit: true,
  468. recommendedPHPModules: [],
  469. pendingBigIntConversionColumns: [],
  470. isMysqlUsedWithoutUTF8MB4: false,
  471. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  472. reverseProxyGeneratedURL: 'https://server',
  473. temporaryDirectoryWritable: true,
  474. generic: {
  475. network: {
  476. "Internet connectivity": {
  477. severity: "success",
  478. description: null,
  479. linkToDoc: null
  480. }
  481. },
  482. },
  483. })
  484. );
  485. async.done(function( data, s, x ){
  486. expect(data).toEqual([{
  487. 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>.',
  488. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  489. }]);
  490. done();
  491. });
  492. });
  493. it('should return an info if the mail server config was not set or verified, yet', function(done) {
  494. var async = OC.SetupChecks.checkSetup();
  495. suite.server.requests[0].respond(
  496. 200,
  497. {
  498. 'Content-Type': 'application/json'
  499. },
  500. JSON.stringify({
  501. hasFileinfoInstalled: true,
  502. isGetenvServerWorking: true,
  503. isReadOnlyConfig: false,
  504. wasEmailTestSuccessful: false,
  505. hasWorkingFileLocking: true,
  506. hasDBFileLocking: false,
  507. hasValidTransactionIsolationLevel: true,
  508. suggestedOverwriteCliURL: '',
  509. isRandomnessSecure: true,
  510. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  511. isFairUseOfFreePushService: true,
  512. isMemcacheConfigured: true,
  513. forwardedForHeadersWorking: true,
  514. isCorrectMemcachedPHPModuleInstalled: true,
  515. hasPassedCodeIntegrityCheck: true,
  516. OpcacheSetupRecommendations: [],
  517. isSettimelimitAvailable: true,
  518. hasFreeTypeSupport: true,
  519. missingIndexes: [],
  520. missingPrimaryKeys: [],
  521. missingColumns: [],
  522. cronErrors: [],
  523. cronInfo: {
  524. diffInSeconds: 0
  525. },
  526. isMemoryLimitSufficient: true,
  527. appDirsWithDifferentOwner: [],
  528. isImagickEnabled: true,
  529. areWebauthnExtensionsEnabled: true,
  530. is64bit: true,
  531. recommendedPHPModules: [],
  532. pendingBigIntConversionColumns: [],
  533. isMysqlUsedWithoutUTF8MB4: false,
  534. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  535. reverseProxyGeneratedURL: 'https://server',
  536. temporaryDirectoryWritable: true,
  537. generic: {
  538. network: {
  539. "Internet connectivity": {
  540. severity: "success",
  541. description: null,
  542. linkToDoc: null
  543. }
  544. },
  545. },
  546. })
  547. );
  548. async.done(function( data, s, x ){
  549. expect(data).toEqual([{
  550. 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.',
  551. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  552. }]);
  553. done();
  554. });
  555. });
  556. it('should return an info if transactional file locking is not set up', function(done) {
  557. var async = OC.SetupChecks.checkSetup();
  558. suite.server.requests[0].respond(
  559. 200,
  560. {
  561. 'Content-Type': 'application/json'
  562. },
  563. JSON.stringify({
  564. hasFileinfoInstalled: true,
  565. isGetenvServerWorking: true,
  566. isReadOnlyConfig: false,
  567. wasEmailTestSuccessful: true,
  568. hasWorkingFileLocking: false,
  569. hasDBFileLocking: false,
  570. hasValidTransactionIsolationLevel: true,
  571. suggestedOverwriteCliURL: '',
  572. isRandomnessSecure: true,
  573. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  574. isFairUseOfFreePushService: true,
  575. isMemcacheConfigured: true,
  576. forwardedForHeadersWorking: true,
  577. isCorrectMemcachedPHPModuleInstalled: true,
  578. hasPassedCodeIntegrityCheck: true,
  579. OpcacheSetupRecommendations: [],
  580. isSettimelimitAvailable: true,
  581. hasFreeTypeSupport: true,
  582. missingIndexes: [],
  583. missingPrimaryKeys: [],
  584. missingColumns: [],
  585. cronErrors: [],
  586. cronInfo: {
  587. diffInSeconds: 0
  588. },
  589. isMemoryLimitSufficient: true,
  590. appDirsWithDifferentOwner: [],
  591. isImagickEnabled: true,
  592. areWebauthnExtensionsEnabled: true,
  593. is64bit: true,
  594. recommendedPHPModules: [],
  595. pendingBigIntConversionColumns: [],
  596. isMysqlUsedWithoutUTF8MB4: false,
  597. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  598. reverseProxyGeneratedURL: 'https://server',
  599. temporaryDirectoryWritable: true,
  600. generic: {
  601. network: {
  602. "Internet connectivity": {
  603. severity: "success",
  604. description: null,
  605. linkToDoc: null
  606. }
  607. },
  608. },
  609. })
  610. );
  611. async.done(function( data, s, x ){
  612. expect(data).toEqual([{
  613. 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.',
  614. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  615. }]);
  616. done();
  617. });
  618. });
  619. it('should return an info if database file locking is used', function(done) {
  620. var async = OC.SetupChecks.checkSetup();
  621. suite.server.requests[0].respond(
  622. 200,
  623. {
  624. 'Content-Type': 'application/json'
  625. },
  626. JSON.stringify({
  627. hasFileinfoInstalled: true,
  628. isGetenvServerWorking: true,
  629. isReadOnlyConfig: false,
  630. wasEmailTestSuccessful: true,
  631. hasWorkingFileLocking: true,
  632. hasDBFileLocking: true,
  633. hasValidTransactionIsolationLevel: true,
  634. suggestedOverwriteCliURL: '',
  635. isRandomnessSecure: true,
  636. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  637. isFairUseOfFreePushService: true,
  638. isMemcacheConfigured: true,
  639. forwardedForHeadersWorking: true,
  640. isCorrectMemcachedPHPModuleInstalled: true,
  641. hasPassedCodeIntegrityCheck: true,
  642. OpcacheSetupRecommendations: [],
  643. isSettimelimitAvailable: true,
  644. hasFreeTypeSupport: true,
  645. missingIndexes: [],
  646. missingPrimaryKeys: [],
  647. missingColumns: [],
  648. cronErrors: [],
  649. cronInfo: {
  650. diffInSeconds: 0
  651. },
  652. isMemoryLimitSufficient: true,
  653. appDirsWithDifferentOwner: [],
  654. isImagickEnabled: true,
  655. areWebauthnExtensionsEnabled: true,
  656. is64bit: true,
  657. recommendedPHPModules: [],
  658. pendingBigIntConversionColumns: [],
  659. isMysqlUsedWithoutUTF8MB4: false,
  660. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  661. reverseProxyGeneratedURL: 'https://server',
  662. temporaryDirectoryWritable: true,
  663. generic: {
  664. network: {
  665. "Internet connectivity": {
  666. severity: "success",
  667. description: null,
  668. linkToDoc: null
  669. }
  670. },
  671. },
  672. })
  673. );
  674. async.done(function( data, s, x ){
  675. expect(data).toEqual([{
  676. 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.',
  677. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  678. }]);
  679. done();
  680. });
  681. });
  682. it('should return a warning if there are app directories with wrong permissions', function(done) {
  683. var async = OC.SetupChecks.checkSetup();
  684. suite.server.requests[0].respond(
  685. 200,
  686. {
  687. 'Content-Type': 'application/json',
  688. },
  689. JSON.stringify({
  690. hasFileinfoInstalled: true,
  691. isGetenvServerWorking: true,
  692. isReadOnlyConfig: false,
  693. wasEmailTestSuccessful: true,
  694. hasWorkingFileLocking: true,
  695. hasDBFileLocking: false,
  696. hasValidTransactionIsolationLevel: true,
  697. suggestedOverwriteCliURL: '',
  698. isRandomnessSecure: true,
  699. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  700. isFairUseOfFreePushService: true,
  701. isMemcacheConfigured: true,
  702. forwardedForHeadersWorking: true,
  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. '/some/path'
  718. ],
  719. isImagickEnabled: true,
  720. areWebauthnExtensionsEnabled: true,
  721. is64bit: true,
  722. recommendedPHPModules: [],
  723. pendingBigIntConversionColumns: [],
  724. isMysqlUsedWithoutUTF8MB4: false,
  725. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  726. reverseProxyGeneratedURL: 'https://server',
  727. temporaryDirectoryWritable: true,
  728. generic: {
  729. network: {
  730. "Internet connectivity": {
  731. severity: "success",
  732. description: null,
  733. linkToDoc: null
  734. }
  735. },
  736. },
  737. })
  738. );
  739. async.done(function( data, s, x ){
  740. expect(data).toEqual([{
  741. 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>',
  742. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  743. }]);
  744. done();
  745. });
  746. });
  747. it('should return an error if the forwarded for headers are not working', function(done) {
  748. var async = OC.SetupChecks.checkSetup();
  749. suite.server.requests[0].respond(
  750. 200,
  751. {
  752. 'Content-Type': 'application/json',
  753. },
  754. JSON.stringify({
  755. hasFileinfoInstalled: true,
  756. isGetenvServerWorking: true,
  757. isReadOnlyConfig: false,
  758. wasEmailTestSuccessful: true,
  759. hasWorkingFileLocking: true,
  760. hasDBFileLocking: false,
  761. hasValidTransactionIsolationLevel: true,
  762. suggestedOverwriteCliURL: '',
  763. isRandomnessSecure: true,
  764. isFairUseOfFreePushService: true,
  765. isMemcacheConfigured: true,
  766. forwardedForHeadersWorking: false,
  767. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  768. isCorrectMemcachedPHPModuleInstalled: true,
  769. hasPassedCodeIntegrityCheck: true,
  770. OpcacheSetupRecommendations: [],
  771. isSettimelimitAvailable: true,
  772. hasFreeTypeSupport: true,
  773. missingIndexes: [],
  774. missingPrimaryKeys: [],
  775. missingColumns: [],
  776. cronErrors: [],
  777. cronInfo: {
  778. diffInSeconds: 0
  779. },
  780. isMemoryLimitSufficient: true,
  781. appDirsWithDifferentOwner: [],
  782. isImagickEnabled: true,
  783. areWebauthnExtensionsEnabled: true,
  784. is64bit: true,
  785. recommendedPHPModules: [],
  786. pendingBigIntConversionColumns: [],
  787. isMysqlUsedWithoutUTF8MB4: false,
  788. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  789. reverseProxyGeneratedURL: 'https://server',
  790. temporaryDirectoryWritable: true,
  791. generic: {
  792. network: {
  793. "Internet connectivity": {
  794. severity: "success",
  795. description: null,
  796. linkToDoc: null
  797. }
  798. },
  799. },
  800. })
  801. );
  802. async.done(function( data, s, x ){
  803. expect(data).toEqual([{
  804. 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>.',
  805. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  806. }]);
  807. done();
  808. });
  809. });
  810. it('should return an error if the admin IP is bruteforce throttled', function(done) {
  811. var async = OC.SetupChecks.checkSetup();
  812. suite.server.requests[0].respond(
  813. 200,
  814. {
  815. 'Content-Type': 'application/json',
  816. },
  817. JSON.stringify({
  818. hasFileinfoInstalled: true,
  819. isGetenvServerWorking: true,
  820. isReadOnlyConfig: false,
  821. wasEmailTestSuccessful: true,
  822. hasWorkingFileLocking: true,
  823. hasDBFileLocking: false,
  824. hasValidTransactionIsolationLevel: true,
  825. suggestedOverwriteCliURL: '',
  826. isRandomnessSecure: true,
  827. isFairUseOfFreePushService: true,
  828. isBruteforceThrottled: true,
  829. bruteforceRemoteAddress: '::1',
  830. isMemcacheConfigured: true,
  831. forwardedForHeadersWorking: true,
  832. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  833. isCorrectMemcachedPHPModuleInstalled: true,
  834. hasPassedCodeIntegrityCheck: true,
  835. OpcacheSetupRecommendations: [],
  836. isSettimelimitAvailable: true,
  837. hasFreeTypeSupport: true,
  838. missingIndexes: [],
  839. missingPrimaryKeys: [],
  840. missingColumns: [],
  841. cronErrors: [],
  842. cronInfo: {
  843. diffInSeconds: 0
  844. },
  845. isMemoryLimitSufficient: true,
  846. appDirsWithDifferentOwner: [],
  847. isImagickEnabled: true,
  848. areWebauthnExtensionsEnabled: true,
  849. is64bit: true,
  850. recommendedPHPModules: [],
  851. pendingBigIntConversionColumns: [],
  852. isMysqlUsedWithoutUTF8MB4: false,
  853. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  854. reverseProxyGeneratedURL: 'https://server',
  855. temporaryDirectoryWritable: true,
  856. generic: {
  857. network: {
  858. "Internet connectivity": {
  859. severity: "success",
  860. description: null,
  861. linkToDoc: null
  862. }
  863. },
  864. },
  865. })
  866. );
  867. async.done(function( data, s, x ){
  868. expect(data).toEqual([{
  869. msg: 'Your remote address was identified as "::1" and is bruteforce 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>.',
  870. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  871. }]);
  872. done();
  873. });
  874. });
  875. it('should return an error if set_time_limit is unavailable', function(done) {
  876. var async = OC.SetupChecks.checkSetup();
  877. suite.server.requests[0].respond(
  878. 200,
  879. {
  880. 'Content-Type': 'application/json',
  881. },
  882. JSON.stringify({
  883. hasFileinfoInstalled: true,
  884. isGetenvServerWorking: true,
  885. isReadOnlyConfig: false,
  886. wasEmailTestSuccessful: true,
  887. hasWorkingFileLocking: true,
  888. hasDBFileLocking: false,
  889. hasValidTransactionIsolationLevel: true,
  890. suggestedOverwriteCliURL: '',
  891. isRandomnessSecure: true,
  892. isFairUseOfFreePushService: true,
  893. isMemcacheConfigured: true,
  894. forwardedForHeadersWorking: true,
  895. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  896. isCorrectMemcachedPHPModuleInstalled: true,
  897. hasPassedCodeIntegrityCheck: true,
  898. OpcacheSetupRecommendations: [],
  899. isSettimelimitAvailable: false,
  900. hasFreeTypeSupport: true,
  901. missingIndexes: [],
  902. missingPrimaryKeys: [],
  903. missingColumns: [],
  904. cronErrors: [],
  905. cronInfo: {
  906. diffInSeconds: 0
  907. },
  908. isMemoryLimitSufficient: true,
  909. appDirsWithDifferentOwner: [],
  910. isImagickEnabled: true,
  911. areWebauthnExtensionsEnabled: true,
  912. is64bit: true,
  913. recommendedPHPModules: [],
  914. pendingBigIntConversionColumns: [],
  915. isMysqlUsedWithoutUTF8MB4: false,
  916. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  917. reverseProxyGeneratedURL: 'https://server',
  918. temporaryDirectoryWritable: true,
  919. generic: {
  920. network: {
  921. "Internet connectivity": {
  922. severity: "success",
  923. description: null,
  924. linkToDoc: null
  925. }
  926. },
  927. },
  928. })
  929. );
  930. async.done(function( data, s, x ){
  931. expect(data).toEqual([{
  932. 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.',
  933. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  934. }]);
  935. done();
  936. });
  937. });
  938. it('should return a warning if the memory limit is below the recommended value', function(done) {
  939. var async = OC.SetupChecks.checkSetup();
  940. suite.server.requests[0].respond(
  941. 200,
  942. {
  943. 'Content-Type': 'application/json',
  944. },
  945. JSON.stringify({
  946. hasFileinfoInstalled: true,
  947. isGetenvServerWorking: true,
  948. isReadOnlyConfig: false,
  949. wasEmailTestSuccessful: true,
  950. hasWorkingFileLocking: true,
  951. hasDBFileLocking: false,
  952. hasValidTransactionIsolationLevel: true,
  953. suggestedOverwriteCliURL: '',
  954. isRandomnessSecure: true,
  955. isFairUseOfFreePushService: true,
  956. isMemcacheConfigured: true,
  957. forwardedForHeadersWorking: true,
  958. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  959. isCorrectMemcachedPHPModuleInstalled: true,
  960. hasPassedCodeIntegrityCheck: true,
  961. OpcacheSetupRecommendations: [],
  962. isSettimelimitAvailable: true,
  963. hasFreeTypeSupport: true,
  964. missingIndexes: [],
  965. missingPrimaryKeys: [],
  966. missingColumns: [],
  967. cronErrors: [],
  968. cronInfo: {
  969. diffInSeconds: 0
  970. },
  971. isMemoryLimitSufficient: false,
  972. appDirsWithDifferentOwner: [],
  973. isImagickEnabled: true,
  974. areWebauthnExtensionsEnabled: true,
  975. is64bit: true,
  976. recommendedPHPModules: [],
  977. pendingBigIntConversionColumns: [],
  978. isMysqlUsedWithoutUTF8MB4: false,
  979. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  980. reverseProxyGeneratedURL: 'https://server',
  981. temporaryDirectoryWritable: true,
  982. generic: {
  983. network: {
  984. "Internet connectivity": {
  985. severity: "success",
  986. description: null,
  987. linkToDoc: null
  988. }
  989. },
  990. },
  991. })
  992. );
  993. async.done(function( data, s, x ){
  994. expect(data).toEqual([{
  995. msg: 'The PHP memory limit is below the recommended value of 512MB.',
  996. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  997. }]);
  998. done();
  999. });
  1000. });
  1001. it('should return an error if the response has no statuscode 200', function(done) {
  1002. var async = OC.SetupChecks.checkSetup();
  1003. suite.server.requests[0].respond(
  1004. 500,
  1005. {
  1006. 'Content-Type': 'application/json'
  1007. },
  1008. JSON.stringify({data: {serverHasInternetConnectionProblems: true}})
  1009. );
  1010. async.done(function( data, s, x ){
  1011. expect(data).toEqual([{
  1012. msg: 'Error occurred while checking server setup',
  1013. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1014. }]);
  1015. done();
  1016. });
  1017. });
  1018. it('should return an error if the php version is no longer supported', function(done) {
  1019. var async = OC.SetupChecks.checkSetup();
  1020. suite.server.requests[0].respond(
  1021. 200,
  1022. {
  1023. 'Content-Type': 'application/json',
  1024. },
  1025. JSON.stringify({
  1026. hasFileinfoInstalled: true,
  1027. isGetenvServerWorking: true,
  1028. isReadOnlyConfig: false,
  1029. wasEmailTestSuccessful: true,
  1030. hasWorkingFileLocking: true,
  1031. hasDBFileLocking: false,
  1032. hasValidTransactionIsolationLevel: true,
  1033. suggestedOverwriteCliURL: '',
  1034. isRandomnessSecure: true,
  1035. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1036. isFairUseOfFreePushService: true,
  1037. isMemcacheConfigured: true,
  1038. forwardedForHeadersWorking: true,
  1039. isCorrectMemcachedPHPModuleInstalled: true,
  1040. hasPassedCodeIntegrityCheck: true,
  1041. OpcacheSetupRecommendations: [],
  1042. isSettimelimitAvailable: true,
  1043. hasFreeTypeSupport: true,
  1044. missingIndexes: [],
  1045. missingPrimaryKeys: [],
  1046. missingColumns: [],
  1047. cronErrors: [],
  1048. cronInfo: {
  1049. diffInSeconds: 0
  1050. },
  1051. isMemoryLimitSufficient: true,
  1052. appDirsWithDifferentOwner: [],
  1053. isImagickEnabled: true,
  1054. areWebauthnExtensionsEnabled: true,
  1055. is64bit: true,
  1056. recommendedPHPModules: [],
  1057. pendingBigIntConversionColumns: [],
  1058. isMysqlUsedWithoutUTF8MB4: false,
  1059. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1060. reverseProxyGeneratedURL: 'https://server',
  1061. temporaryDirectoryWritable: true,
  1062. generic: {
  1063. network: {
  1064. "Internet connectivity": {
  1065. severity: "success",
  1066. description: null,
  1067. linkToDoc: null
  1068. }
  1069. },
  1070. security: {
  1071. "Checking for PHP version": {
  1072. severity: "warning",
  1073. description: "You are currently running PHP 8.0.30. PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible.",
  1074. linkToDoc: "https://secure.php.net/supported-versions.php"
  1075. }
  1076. },
  1077. },
  1078. })
  1079. );
  1080. async.done(function( data, s, x ){
  1081. expect(data).toEqual([{
  1082. msg: 'You are currently running PHP 8.0.30. PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible. For more details see the <a target="_blank" rel="noreferrer noopener" class="external" href="https://secure.php.net/supported-versions.php">documentation ↗</a>.',
  1083. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1084. }]);
  1085. done();
  1086. });
  1087. });
  1088. it('should return an info if server has no proper opcache', function(done) {
  1089. var async = OC.SetupChecks.checkSetup();
  1090. suite.server.requests[0].respond(
  1091. 200,
  1092. {
  1093. 'Content-Type': 'application/json'
  1094. },
  1095. JSON.stringify({
  1096. hasFileinfoInstalled: true,
  1097. isGetenvServerWorking: true,
  1098. isReadOnlyConfig: false,
  1099. wasEmailTestSuccessful: true,
  1100. hasWorkingFileLocking: true,
  1101. hasDBFileLocking: false,
  1102. hasValidTransactionIsolationLevel: true,
  1103. suggestedOverwriteCliURL: '',
  1104. isRandomnessSecure: true,
  1105. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1106. isFairUseOfFreePushService: true,
  1107. isMemcacheConfigured: true,
  1108. forwardedForHeadersWorking: true,
  1109. isCorrectMemcachedPHPModuleInstalled: true,
  1110. hasPassedCodeIntegrityCheck: true,
  1111. OpcacheSetupRecommendations: ['recommendation1', 'recommendation2'],
  1112. isSettimelimitAvailable: true,
  1113. hasFreeTypeSupport: true,
  1114. missingIndexes: [],
  1115. missingPrimaryKeys: [],
  1116. missingColumns: [],
  1117. cronErrors: [],
  1118. cronInfo: {
  1119. diffInSeconds: 0
  1120. },
  1121. isMemoryLimitSufficient: true,
  1122. appDirsWithDifferentOwner: [],
  1123. isImagickEnabled: true,
  1124. areWebauthnExtensionsEnabled: true,
  1125. is64bit: true,
  1126. recommendedPHPModules: [],
  1127. pendingBigIntConversionColumns: [],
  1128. isMysqlUsedWithoutUTF8MB4: false,
  1129. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1130. reverseProxyGeneratedURL: 'https://server',
  1131. temporaryDirectoryWritable: true,
  1132. generic: {
  1133. network: {
  1134. "Internet connectivity": {
  1135. severity: "success",
  1136. description: null,
  1137. linkToDoc: null
  1138. }
  1139. },
  1140. },
  1141. })
  1142. );
  1143. async.done(function( data, s, x ){
  1144. expect(data).toEqual([{
  1145. 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>',
  1146. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1147. }]);
  1148. done();
  1149. });
  1150. });
  1151. it('should return an info if server has no FreeType support', function(done) {
  1152. var async = OC.SetupChecks.checkSetup();
  1153. suite.server.requests[0].respond(
  1154. 200,
  1155. {
  1156. 'Content-Type': 'application/json'
  1157. },
  1158. JSON.stringify({
  1159. hasFileinfoInstalled: true,
  1160. isGetenvServerWorking: true,
  1161. isReadOnlyConfig: false,
  1162. wasEmailTestSuccessful: true,
  1163. hasWorkingFileLocking: true,
  1164. hasDBFileLocking: false,
  1165. hasValidTransactionIsolationLevel: true,
  1166. suggestedOverwriteCliURL: '',
  1167. isRandomnessSecure: true,
  1168. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1169. isFairUseOfFreePushService: true,
  1170. isMemcacheConfigured: true,
  1171. forwardedForHeadersWorking: true,
  1172. isCorrectMemcachedPHPModuleInstalled: true,
  1173. hasPassedCodeIntegrityCheck: true,
  1174. OpcacheSetupRecommendations: [],
  1175. isSettimelimitAvailable: true,
  1176. hasFreeTypeSupport: false,
  1177. missingIndexes: [],
  1178. missingPrimaryKeys: [],
  1179. missingColumns: [],
  1180. cronErrors: [],
  1181. cronInfo: {
  1182. diffInSeconds: 0
  1183. },
  1184. isMemoryLimitSufficient: true,
  1185. appDirsWithDifferentOwner: [],
  1186. isImagickEnabled: true,
  1187. areWebauthnExtensionsEnabled: true,
  1188. is64bit: true,
  1189. recommendedPHPModules: [],
  1190. pendingBigIntConversionColumns: [],
  1191. isMysqlUsedWithoutUTF8MB4: false,
  1192. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1193. reverseProxyGeneratedURL: 'https://server',
  1194. temporaryDirectoryWritable: true,
  1195. generic: {
  1196. network: {
  1197. "Internet connectivity": {
  1198. severity: "success",
  1199. description: null,
  1200. linkToDoc: null
  1201. }
  1202. },
  1203. },
  1204. })
  1205. );
  1206. async.done(function( data, s, x ){
  1207. expect(data).toEqual([{
  1208. msg: 'Your PHP does not have FreeType support, resulting in breakage of profile pictures and the settings interface.',
  1209. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1210. }]);
  1211. done();
  1212. });
  1213. });
  1214. it('should return an error if the php version is no longer supported', function(done) {
  1215. var async = OC.SetupChecks.checkSetup();
  1216. suite.server.requests[0].respond(
  1217. 200,
  1218. {
  1219. 'Content-Type': 'application/json',
  1220. },
  1221. JSON.stringify({
  1222. hasFileinfoInstalled: true,
  1223. isGetenvServerWorking: true,
  1224. isReadOnlyConfig: false,
  1225. wasEmailTestSuccessful: true,
  1226. hasWorkingFileLocking: true,
  1227. hasDBFileLocking: false,
  1228. hasValidTransactionIsolationLevel: true,
  1229. suggestedOverwriteCliURL: '',
  1230. isRandomnessSecure: true,
  1231. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1232. isFairUseOfFreePushService: true,
  1233. isMemcacheConfigured: true,
  1234. forwardedForHeadersWorking: true,
  1235. isCorrectMemcachedPHPModuleInstalled: true,
  1236. hasPassedCodeIntegrityCheck: true,
  1237. OpcacheSetupRecommendations: [],
  1238. isSettimelimitAvailable: true,
  1239. hasFreeTypeSupport: true,
  1240. missingIndexes: [],
  1241. missingPrimaryKeys: [],
  1242. missingColumns: [],
  1243. cronErrors: [],
  1244. cronInfo: {
  1245. diffInSeconds: 0
  1246. },
  1247. isMemoryLimitSufficient: true,
  1248. appDirsWithDifferentOwner: [],
  1249. isImagickEnabled: true,
  1250. areWebauthnExtensionsEnabled: true,
  1251. is64bit: true,
  1252. recommendedPHPModules: [],
  1253. pendingBigIntConversionColumns: [],
  1254. isMysqlUsedWithoutUTF8MB4: true,
  1255. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1256. reverseProxyGeneratedURL: 'https://server',
  1257. temporaryDirectoryWritable: true,
  1258. generic: {
  1259. network: {
  1260. "Internet connectivity": {
  1261. severity: "success",
  1262. description: null,
  1263. linkToDoc: null
  1264. }
  1265. },
  1266. },
  1267. })
  1268. );
  1269. async.done(function( data, s, x ){
  1270. expect(data).toEqual([{
  1271. 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>.',
  1272. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1273. }]);
  1274. done();
  1275. });
  1276. });
  1277. // THe following test is invalid as the code in core/js/setupchecks.js is calling
  1278. // window.location.protocol which always return http during tests
  1279. // if there is a way to trick window.location.protocol during test, then we could re-activate it
  1280. /*
  1281. it('should return an error if the protocol is https but the server generates http links', function(done) {
  1282. var async = OC.SetupChecks.checkSetup();
  1283. suite.server.requests[0].respond(
  1284. 200,
  1285. {
  1286. 'Content-Type': 'application/json',
  1287. },
  1288. JSON.stringify({
  1289. hasFileinfoInstalled: true,
  1290. isGetenvServerWorking: true,
  1291. isReadOnlyConfig: false,
  1292. wasEmailTestSuccessful: true,
  1293. hasWorkingFileLocking: true,
  1294. hasDBFileLocking: false,
  1295. hasValidTransactionIsolationLevel: true,
  1296. suggestedOverwriteCliURL: '',
  1297. isRandomnessSecure: true,
  1298. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1299. isFairUseOfFreePushService: true,
  1300. isMemcacheConfigured: true,
  1301. forwardedForHeadersWorking: true,
  1302. isCorrectMemcachedPHPModuleInstalled: true,
  1303. hasPassedCodeIntegrityCheck: true,
  1304. OpcacheSetupRecommendations: [],
  1305. isSettimelimitAvailable: true,
  1306. hasFreeTypeSupport: true,
  1307. missingIndexes: [],
  1308. missingPrimaryKeys: [],
  1309. missingColumns: [],
  1310. cronErrors: [],
  1311. cronInfo: {
  1312. diffInSeconds: 0
  1313. },
  1314. isMemoryLimitSufficient: true,
  1315. appDirsWithDifferentOwner: [],
  1316. isImagickEnabled: true,
  1317. areWebauthnExtensionsEnabled: true,
  1318. is64bit: true,
  1319. recommendedPHPModules: [],
  1320. pendingBigIntConversionColumns: [],
  1321. isMysqlUsedWithoutUTF8MB4: false,
  1322. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1323. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  1324. reverseProxyGeneratedURL: 'http://server',
  1325. temporaryDirectoryWritable: true,
  1326. generic: {
  1327. network: {
  1328. "Internet connectivity": {
  1329. severity: "success",
  1330. description: null,
  1331. linkToDoc: null
  1332. }
  1333. },
  1334. },
  1335. })
  1336. );
  1337. async.done(function( data, s, x ){
  1338. expect(data).toEqual([{
  1339. 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>.',
  1340. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1341. }]);
  1342. done();
  1343. });
  1344. });
  1345. */
  1346. it('should not return an error if the protocol is http and the server generates http links', function(done) {
  1347. var async = OC.SetupChecks.checkSetup();
  1348. suite.server.requests[0].respond(
  1349. 200,
  1350. {
  1351. 'Content-Type': 'application/json',
  1352. },
  1353. JSON.stringify({
  1354. hasFileinfoInstalled: true,
  1355. isGetenvServerWorking: true,
  1356. isReadOnlyConfig: false,
  1357. wasEmailTestSuccessful: true,
  1358. hasWorkingFileLocking: true,
  1359. hasDBFileLocking: false,
  1360. hasValidTransactionIsolationLevel: true,
  1361. suggestedOverwriteCliURL: '',
  1362. isRandomnessSecure: true,
  1363. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1364. isFairUseOfFreePushService: true,
  1365. isMemcacheConfigured: true,
  1366. forwardedForHeadersWorking: true,
  1367. isCorrectMemcachedPHPModuleInstalled: true,
  1368. hasPassedCodeIntegrityCheck: true,
  1369. OpcacheSetupRecommendations: [],
  1370. isSettimelimitAvailable: true,
  1371. hasFreeTypeSupport: true,
  1372. missingIndexes: [],
  1373. missingPrimaryKeys: [],
  1374. missingColumns: [],
  1375. cronErrors: [],
  1376. cronInfo: {
  1377. diffInSeconds: 0
  1378. },
  1379. isMemoryLimitSufficient: true,
  1380. appDirsWithDifferentOwner: [],
  1381. isImagickEnabled: true,
  1382. areWebauthnExtensionsEnabled: true,
  1383. is64bit: true,
  1384. recommendedPHPModules: [],
  1385. pendingBigIntConversionColumns: [],
  1386. isMysqlUsedWithoutUTF8MB4: false,
  1387. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1388. reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
  1389. reverseProxyGeneratedURL: 'http://server',
  1390. temporaryDirectoryWritable: true,
  1391. generic: {
  1392. network: {
  1393. "Internet connectivity": {
  1394. severity: "success",
  1395. description: null,
  1396. linkToDoc: null
  1397. }
  1398. },
  1399. },
  1400. })
  1401. );
  1402. async.done(function( data, s, x ){
  1403. expect(data).toEqual([]);
  1404. done();
  1405. });
  1406. });
  1407. it('should return an error if there is not enough free space in the temp directory', function(done) {
  1408. var async = OC.SetupChecks.checkSetup();
  1409. suite.server.requests[0].respond(
  1410. 200,
  1411. {
  1412. 'Content-Type': 'application/json',
  1413. },
  1414. JSON.stringify({
  1415. hasFileinfoInstalled: true,
  1416. isGetenvServerWorking: true,
  1417. isReadOnlyConfig: false,
  1418. wasEmailTestSuccessful: true,
  1419. hasWorkingFileLocking: true,
  1420. hasDBFileLocking: false,
  1421. hasValidTransactionIsolationLevel: true,
  1422. suggestedOverwriteCliURL: '',
  1423. isRandomnessSecure: true,
  1424. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1425. isFairUseOfFreePushService: true,
  1426. isMemcacheConfigured: true,
  1427. forwardedForHeadersWorking: true,
  1428. isCorrectMemcachedPHPModuleInstalled: true,
  1429. hasPassedCodeIntegrityCheck: true,
  1430. OpcacheSetupRecommendations: [],
  1431. isSettimelimitAvailable: true,
  1432. hasFreeTypeSupport: true,
  1433. missingIndexes: [],
  1434. missingPrimaryKeys: [],
  1435. missingColumns: [],
  1436. cronErrors: [],
  1437. cronInfo: {
  1438. diffInSeconds: 0
  1439. },
  1440. isMemoryLimitSufficient: true,
  1441. appDirsWithDifferentOwner: [],
  1442. isImagickEnabled: true,
  1443. areWebauthnExtensionsEnabled: true,
  1444. is64bit: true,
  1445. recommendedPHPModules: [],
  1446. pendingBigIntConversionColumns: [],
  1447. isMysqlUsedWithoutUTF8MB4: false,
  1448. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false,
  1449. reverseProxyGeneratedURL: 'https://server',
  1450. temporaryDirectoryWritable: true,
  1451. generic: {
  1452. network: {
  1453. "Internet connectivity": {
  1454. severity: "success",
  1455. description: null,
  1456. linkToDoc: null
  1457. }
  1458. },
  1459. },
  1460. })
  1461. );
  1462. async.done(function( data, s, x ){
  1463. expect(data).toEqual([{
  1464. 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.',
  1465. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1466. }]);
  1467. done();
  1468. });
  1469. });
  1470. it('should return an error if imagick is not enabled', function(done) {
  1471. var async = OC.SetupChecks.checkSetup();
  1472. suite.server.requests[0].respond(
  1473. 200,
  1474. {
  1475. 'Content-Type': 'application/json',
  1476. },
  1477. JSON.stringify({
  1478. hasFileinfoInstalled: true,
  1479. isGetenvServerWorking: true,
  1480. isReadOnlyConfig: false,
  1481. wasEmailTestSuccessful: true,
  1482. hasWorkingFileLocking: true,
  1483. hasDBFileLocking: false,
  1484. hasValidTransactionIsolationLevel: true,
  1485. suggestedOverwriteCliURL: '',
  1486. isRandomnessSecure: true,
  1487. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1488. isFairUseOfFreePushService: true,
  1489. isMemcacheConfigured: true,
  1490. forwardedForHeadersWorking: true,
  1491. isCorrectMemcachedPHPModuleInstalled: true,
  1492. hasPassedCodeIntegrityCheck: true,
  1493. OpcacheSetupRecommendations: [],
  1494. isSettimelimitAvailable: true,
  1495. hasFreeTypeSupport: true,
  1496. missingIndexes: [],
  1497. missingPrimaryKeys: [],
  1498. missingColumns: [],
  1499. cronErrors: [],
  1500. cronInfo: {
  1501. diffInSeconds: 0
  1502. },
  1503. isMemoryLimitSufficient: true,
  1504. appDirsWithDifferentOwner: [],
  1505. isImagickEnabled: false,
  1506. areWebauthnExtensionsEnabled: true,
  1507. is64bit: true,
  1508. recommendedPHPModules: [],
  1509. pendingBigIntConversionColumns: [],
  1510. isMysqlUsedWithoutUTF8MB4: false,
  1511. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1512. reverseProxyGeneratedURL: 'https://server',
  1513. temporaryDirectoryWritable: true,
  1514. generic: {
  1515. network: {
  1516. "Internet connectivity": {
  1517. severity: "success",
  1518. description: null,
  1519. linkToDoc: null
  1520. }
  1521. },
  1522. },
  1523. })
  1524. );
  1525. async.done(function( data, s, x ){
  1526. expect(data).toEqual([{
  1527. 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.',
  1528. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1529. }]);
  1530. done();
  1531. });
  1532. });
  1533. it('should return an error if gmp or bcmath are not enabled', function(done) {
  1534. var async = OC.SetupChecks.checkSetup();
  1535. suite.server.requests[0].respond(
  1536. 200,
  1537. {
  1538. 'Content-Type': 'application/json',
  1539. },
  1540. JSON.stringify({
  1541. hasFileinfoInstalled: true,
  1542. isGetenvServerWorking: true,
  1543. isReadOnlyConfig: false,
  1544. wasEmailTestSuccessful: true,
  1545. hasWorkingFileLocking: true,
  1546. hasDBFileLocking: false,
  1547. hasValidTransactionIsolationLevel: true,
  1548. suggestedOverwriteCliURL: '',
  1549. isRandomnessSecure: true,
  1550. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1551. isFairUseOfFreePushService: true,
  1552. isMemcacheConfigured: true,
  1553. forwardedForHeadersWorking: true,
  1554. isCorrectMemcachedPHPModuleInstalled: true,
  1555. hasPassedCodeIntegrityCheck: true,
  1556. OpcacheSetupRecommendations: [],
  1557. isSettimelimitAvailable: true,
  1558. hasFreeTypeSupport: true,
  1559. missingIndexes: [],
  1560. missingPrimaryKeys: [],
  1561. missingColumns: [],
  1562. cronErrors: [],
  1563. cronInfo: {
  1564. diffInSeconds: 0
  1565. },
  1566. isMemoryLimitSufficient: true,
  1567. appDirsWithDifferentOwner: [],
  1568. isImagickEnabled: true,
  1569. areWebauthnExtensionsEnabled: false,
  1570. is64bit: true,
  1571. recommendedPHPModules: [],
  1572. pendingBigIntConversionColumns: [],
  1573. isMysqlUsedWithoutUTF8MB4: false,
  1574. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1575. reverseProxyGeneratedURL: 'https://server',
  1576. temporaryDirectoryWritable: true,
  1577. generic: {
  1578. network: {
  1579. "Internet connectivity": {
  1580. severity: "success",
  1581. description: null,
  1582. linkToDoc: null
  1583. }
  1584. },
  1585. },
  1586. })
  1587. );
  1588. async.done(function( data, s, x ){
  1589. expect(data).toEqual([{
  1590. msg: 'The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.',
  1591. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1592. }]);
  1593. done();
  1594. });
  1595. });
  1596. it('should return an error for 32bit instances', function(done) {
  1597. var async = OC.SetupChecks.checkSetup();
  1598. suite.server.requests[0].respond(
  1599. 200,
  1600. {
  1601. 'Content-Type': 'application/json',
  1602. },
  1603. JSON.stringify({
  1604. hasFileinfoInstalled: true,
  1605. isGetenvServerWorking: true,
  1606. isReadOnlyConfig: false,
  1607. wasEmailTestSuccessful: true,
  1608. hasWorkingFileLocking: true,
  1609. hasDBFileLocking: false,
  1610. hasValidTransactionIsolationLevel: true,
  1611. suggestedOverwriteCliURL: '',
  1612. isRandomnessSecure: true,
  1613. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1614. isFairUseOfFreePushService: true,
  1615. isMemcacheConfigured: true,
  1616. forwardedForHeadersWorking: true,
  1617. isCorrectMemcachedPHPModuleInstalled: true,
  1618. hasPassedCodeIntegrityCheck: true,
  1619. OpcacheSetupRecommendations: [],
  1620. isSettimelimitAvailable: true,
  1621. hasFreeTypeSupport: true,
  1622. missingIndexes: [],
  1623. missingPrimaryKeys: [],
  1624. missingColumns: [],
  1625. cronErrors: [],
  1626. cronInfo: {
  1627. diffInSeconds: 0
  1628. },
  1629. isMemoryLimitSufficient: true,
  1630. appDirsWithDifferentOwner: [],
  1631. isImagickEnabled: true,
  1632. areWebauthnExtensionsEnabled: true,
  1633. is64bit: false,
  1634. recommendedPHPModules: [],
  1635. pendingBigIntConversionColumns: [],
  1636. isMysqlUsedWithoutUTF8MB4: false,
  1637. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1638. reverseProxyGeneratedURL: 'https://server',
  1639. temporaryDirectoryWritable: true,
  1640. generic: {
  1641. network: {
  1642. "Internet connectivity": {
  1643. severity: "success",
  1644. description: null,
  1645. linkToDoc: null
  1646. }
  1647. },
  1648. },
  1649. })
  1650. );
  1651. async.done(function( data, s, x ){
  1652. expect(data).toEqual([{
  1653. 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.',
  1654. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1655. }]);
  1656. done();
  1657. });
  1658. });
  1659. it('should return an info if there is no default phone region', function(done) {
  1660. var async = OC.SetupChecks.checkSetup();
  1661. suite.server.requests[0].respond(
  1662. 200,
  1663. {
  1664. 'Content-Type': 'application/json',
  1665. },
  1666. JSON.stringify({
  1667. hasFileinfoInstalled: true,
  1668. isGetenvServerWorking: true,
  1669. isReadOnlyConfig: false,
  1670. wasEmailTestSuccessful: true,
  1671. hasWorkingFileLocking: true,
  1672. hasDBFileLocking: false,
  1673. hasValidTransactionIsolationLevel: true,
  1674. suggestedOverwriteCliURL: '',
  1675. isRandomnessSecure: true,
  1676. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1677. isFairUseOfFreePushService: true,
  1678. isMemcacheConfigured: true,
  1679. forwardedForHeadersWorking: true,
  1680. isCorrectMemcachedPHPModuleInstalled: true,
  1681. hasPassedCodeIntegrityCheck: true,
  1682. OpcacheSetupRecommendations: [],
  1683. isSettimelimitAvailable: true,
  1684. hasFreeTypeSupport: true,
  1685. missingIndexes: [],
  1686. missingPrimaryKeys: [],
  1687. missingColumns: [],
  1688. cronErrors: [],
  1689. cronInfo: {
  1690. diffInSeconds: 0
  1691. },
  1692. isMemoryLimitSufficient: true,
  1693. appDirsWithDifferentOwner: [],
  1694. isImagickEnabled: true,
  1695. areWebauthnExtensionsEnabled: true,
  1696. is64bit: true,
  1697. recommendedPHPModules: [],
  1698. pendingBigIntConversionColumns: [],
  1699. isMysqlUsedWithoutUTF8MB4: false,
  1700. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1701. reverseProxyGeneratedURL: 'https://server',
  1702. temporaryDirectoryWritable: true,
  1703. generic: {
  1704. network: {
  1705. "Internet connectivity": {
  1706. severity: "success",
  1707. description: null,
  1708. linkToDoc: null
  1709. }
  1710. },
  1711. config: {
  1712. "Checking for default phone region": {
  1713. severity: "info",
  1714. description: "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 ISO 3166-1 code of the region to your config file.",
  1715. linkToDoc: "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
  1716. },
  1717. },
  1718. },
  1719. })
  1720. );
  1721. async.done(function( data, s, x ){
  1722. expect(data).toEqual([{
  1723. 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 ISO 3166-1 code of the region to your config file. For more details see the <a target="_blank" rel="noreferrer noopener" class="external" href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">documentation ↗</a>.',
  1724. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1725. }]);
  1726. done();
  1727. });
  1728. });
  1729. it('should return an info if the temporary directory is either non-existent or non-writable', function(done) {
  1730. var async = OC.SetupChecks.checkSetup();
  1731. suite.server.requests[0].respond(
  1732. 200,
  1733. {
  1734. 'Content-Type': 'application/json',
  1735. },
  1736. JSON.stringify({
  1737. hasFileinfoInstalled: true,
  1738. isGetenvServerWorking: true,
  1739. isReadOnlyConfig: false,
  1740. wasEmailTestSuccessful: true,
  1741. hasWorkingFileLocking: true,
  1742. hasDBFileLocking: false,
  1743. hasValidTransactionIsolationLevel: true,
  1744. suggestedOverwriteCliURL: '',
  1745. isRandomnessSecure: true,
  1746. securityDocs: 'https://docs.nextcloud.com/myDocs.html',
  1747. isFairUseOfFreePushService: true,
  1748. isMemcacheConfigured: true,
  1749. forwardedForHeadersWorking: true,
  1750. isCorrectMemcachedPHPModuleInstalled: true,
  1751. hasPassedCodeIntegrityCheck: true,
  1752. OpcacheSetupRecommendations: [],
  1753. isSettimelimitAvailable: true,
  1754. hasFreeTypeSupport: true,
  1755. missingIndexes: [],
  1756. missingPrimaryKeys: [],
  1757. missingColumns: [],
  1758. cronErrors: [],
  1759. cronInfo: {
  1760. diffInSeconds: 0
  1761. },
  1762. isMemoryLimitSufficient: true,
  1763. appDirsWithDifferentOwner: [],
  1764. isImagickEnabled: true,
  1765. areWebauthnExtensionsEnabled: true,
  1766. is64bit: true,
  1767. recommendedPHPModules: [],
  1768. pendingBigIntConversionColumns: [],
  1769. isMysqlUsedWithoutUTF8MB4: false,
  1770. isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
  1771. reverseProxyGeneratedURL: 'https://server',
  1772. temporaryDirectoryWritable: false,
  1773. generic: {
  1774. network: {
  1775. "Internet connectivity": {
  1776. severity: "success",
  1777. description: null,
  1778. linkToDoc: null
  1779. }
  1780. },
  1781. },
  1782. })
  1783. );
  1784. async.done(function( data, s, x ){
  1785. expect(data).toEqual([{
  1786. msg: 'The temporary directory of this instance points to an either non-existing or non-writable directory.',
  1787. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1788. }]);
  1789. done();
  1790. });
  1791. });
  1792. });
  1793. describe('checkGeneric', function() {
  1794. it('should return an error if the response has no statuscode 200', function(done) {
  1795. var async = OC.SetupChecks.checkGeneric();
  1796. suite.server.requests[0].respond(
  1797. 500,
  1798. {
  1799. 'Content-Type': 'application/json'
  1800. }
  1801. );
  1802. async.done(function( data, s, x ){
  1803. expect(data).toEqual([{
  1804. msg: 'Error occurred while checking server setup',
  1805. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1806. },{
  1807. msg: 'Error occurred while checking server setup',
  1808. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  1809. }]);
  1810. done();
  1811. });
  1812. });
  1813. it('should return all errors if all headers are missing', function(done) {
  1814. protocolStub.returns('https');
  1815. var async = OC.SetupChecks.checkGeneric();
  1816. suite.server.requests[0].respond(
  1817. 200,
  1818. {
  1819. 'Content-Type': 'application/json',
  1820. 'Strict-Transport-Security': 'max-age=15768000'
  1821. },
  1822. '{}'
  1823. );
  1824. async.done(function( data, s, x ){
  1825. expect(data).toEqual([
  1826. {
  1827. 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.',
  1828. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1829. }, {
  1830. 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.',
  1831. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1832. }, {
  1833. 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.',
  1834. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1835. }, {
  1836. 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.',
  1837. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1838. }, {
  1839. 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.',
  1840. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1841. }, {
  1842. 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>.',
  1843. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  1844. }
  1845. ]);
  1846. done();
  1847. });
  1848. });
  1849. it('should return only some errors if just some headers are missing', function(done) {
  1850. protocolStub.returns('https');
  1851. var async = OC.SetupChecks.checkGeneric();
  1852. suite.server.requests[0].respond(
  1853. 200,
  1854. {
  1855. 'X-Robots-Tag': 'noindex, nofollow',
  1856. 'X-Frame-Options': 'SAMEORIGIN',
  1857. 'Strict-Transport-Security': 'max-age=15768000;preload',
  1858. 'X-Permitted-Cross-Domain-Policies': 'none',
  1859. 'Referrer-Policy': 'no-referrer',
  1860. }
  1861. );
  1862. async.done(function( data, s, x ){
  1863. expect(data).toEqual([
  1864. {
  1865. 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.',
  1866. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1867. }, {
  1868. 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.',
  1869. type: OC.SetupChecks.MESSAGE_TYPE_WARNING,
  1870. }
  1871. ]);
  1872. done();
  1873. });
  1874. });
  1875. it('should return none errors if all headers are there', function(done) {
  1876. protocolStub.returns('https');
  1877. var async = OC.SetupChecks.checkGeneric();
  1878. suite.server.requests[0].respond(
  1879. 200,
  1880. {
  1881. 'X-XSS-Protection': '1; mode=block',
  1882. 'X-Content-Type-Options': 'nosniff',
  1883. 'X-Robots-Tag': 'noindex, nofollow',
  1884. 'X-Frame-Options': 'SAMEORIGIN',
  1885. 'Strict-Transport-Security': 'max-age=15768000',
  1886. 'X-Permitted-Cross-Domain-Policies': 'none',
  1887. 'Referrer-Policy': 'no-referrer'
  1888. }
  1889. );
  1890. async.done(function( data, s, x ){
  1891. expect(data).toEqual([]);
  1892. done();
  1893. });
  1894. });
  1895. describe('check X-Robots-Tag header', function() {
  1896. it('should return no message if X-Robots-Tag is set to noindex,nofollow without space', function(done) {
  1897. protocolStub.returns('https');
  1898. var result = OC.SetupChecks.checkGeneric();
  1899. suite.server.requests[0].respond(200, {
  1900. 'Strict-Transport-Security': 'max-age=15768000',
  1901. 'X-XSS-Protection': '1; mode=block',
  1902. 'X-Content-Type-Options': 'nosniff',
  1903. 'X-Robots-Tag': 'noindex,nofollow',
  1904. 'X-Frame-Options': 'SAMEORIGIN',
  1905. 'X-Permitted-Cross-Domain-Policies': 'none',
  1906. 'Referrer-Policy': 'no-referrer',
  1907. });
  1908. result.done(function( data, s, x ){
  1909. expect(data).toEqual([]);
  1910. done();
  1911. });
  1912. });
  1913. it('should return a message if X-Robots-Tag is set to none', function(done) {
  1914. protocolStub.returns('https');
  1915. var result = OC.SetupChecks.checkGeneric();
  1916. suite.server.requests[0].respond(200, {
  1917. 'Strict-Transport-Security': 'max-age=15768000',
  1918. 'X-XSS-Protection': '1; mode=block',
  1919. 'X-Content-Type-Options': 'nosniff',
  1920. 'X-Robots-Tag': 'none',
  1921. 'X-Frame-Options': 'SAMEORIGIN',
  1922. 'X-Permitted-Cross-Domain-Policies': 'none',
  1923. 'Referrer-Policy': 'no-referrer',
  1924. });
  1925. result.done(function( data, s, x ){
  1926. expect(data).toEqual([
  1927. {
  1928. 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.',
  1929. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1930. }
  1931. ]);
  1932. done();
  1933. });
  1934. });
  1935. });
  1936. describe('check X-XSS-Protection header', function() {
  1937. it('should return no message if X-XSS-Protection is set to 1; mode=block; report=https://example.com', function(done) {
  1938. protocolStub.returns('https');
  1939. var result = OC.SetupChecks.checkGeneric();
  1940. suite.server.requests[0].respond(200, {
  1941. 'Strict-Transport-Security': 'max-age=15768000',
  1942. 'X-XSS-Protection': '1; mode=block; report=https://example.com',
  1943. 'X-Content-Type-Options': 'nosniff',
  1944. 'X-Robots-Tag': 'noindex, nofollow',
  1945. 'X-Frame-Options': 'SAMEORIGIN',
  1946. 'X-Permitted-Cross-Domain-Policies': 'none',
  1947. 'Referrer-Policy': 'no-referrer',
  1948. });
  1949. result.done(function( data, s, x ){
  1950. expect(data).toEqual([]);
  1951. done();
  1952. });
  1953. });
  1954. it('should return no message if X-XSS-Protection is set to 1; mode=block', function(done) {
  1955. protocolStub.returns('https');
  1956. var result = OC.SetupChecks.checkGeneric();
  1957. suite.server.requests[0].respond(200, {
  1958. 'Strict-Transport-Security': 'max-age=15768000',
  1959. 'X-XSS-Protection': '1; mode=block',
  1960. 'X-Content-Type-Options': 'nosniff',
  1961. 'X-Robots-Tag': 'noindex, nofollow',
  1962. 'X-Frame-Options': 'SAMEORIGIN',
  1963. 'X-Permitted-Cross-Domain-Policies': 'none',
  1964. 'Referrer-Policy': 'no-referrer',
  1965. });
  1966. result.done(function( data, s, x ){
  1967. expect(data).toEqual([]);
  1968. done();
  1969. });
  1970. });
  1971. it('should return a message if X-XSS-Protection is set to 1', function(done) {
  1972. protocolStub.returns('https');
  1973. var result = OC.SetupChecks.checkGeneric();
  1974. suite.server.requests[0].respond(200, {
  1975. 'Strict-Transport-Security': 'max-age=15768000',
  1976. 'X-XSS-Protection': '1',
  1977. 'X-Content-Type-Options': 'nosniff',
  1978. 'X-Robots-Tag': 'noindex, nofollow',
  1979. 'X-Frame-Options': 'SAMEORIGIN',
  1980. 'X-Permitted-Cross-Domain-Policies': 'none',
  1981. 'Referrer-Policy': 'no-referrer',
  1982. });
  1983. result.done(function( data, s, x ){
  1984. expect(data).toEqual([
  1985. {
  1986. 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.',
  1987. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  1988. }
  1989. ]);
  1990. done();
  1991. });
  1992. });
  1993. it('should return a message if X-XSS-Protection is set to 0', function(done) {
  1994. protocolStub.returns('https');
  1995. var result = OC.SetupChecks.checkGeneric();
  1996. suite.server.requests[0].respond(200, {
  1997. 'Strict-Transport-Security': 'max-age=15768000',
  1998. 'X-XSS-Protection': '0',
  1999. 'X-Content-Type-Options': 'nosniff',
  2000. 'X-Robots-Tag': 'noindex, nofollow',
  2001. 'X-Frame-Options': 'SAMEORIGIN',
  2002. 'X-Permitted-Cross-Domain-Policies': 'none',
  2003. 'Referrer-Policy': 'no-referrer',
  2004. });
  2005. result.done(function( data, s, x ){
  2006. expect(data).toEqual([
  2007. {
  2008. 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.',
  2009. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2010. }
  2011. ]);
  2012. done();
  2013. });
  2014. });
  2015. });
  2016. describe('check Referrer-Policy header', function() {
  2017. it('should return no message if Referrer-Policy is set to no-referrer', function(done) {
  2018. protocolStub.returns('https');
  2019. var result = OC.SetupChecks.checkGeneric();
  2020. suite.server.requests[0].respond(200, {
  2021. 'Strict-Transport-Security': 'max-age=15768000',
  2022. 'X-XSS-Protection': '1; mode=block',
  2023. 'X-Content-Type-Options': 'nosniff',
  2024. 'X-Robots-Tag': 'noindex, nofollow',
  2025. 'X-Frame-Options': 'SAMEORIGIN',
  2026. 'X-Permitted-Cross-Domain-Policies': 'none',
  2027. 'Referrer-Policy': 'no-referrer',
  2028. });
  2029. result.done(function( data, s, x ){
  2030. expect(data).toEqual([]);
  2031. done();
  2032. });
  2033. });
  2034. it('should return no message if Referrer-Policy is set to no-referrer-when-downgrade', function(done) {
  2035. protocolStub.returns('https');
  2036. var result = OC.SetupChecks.checkGeneric();
  2037. suite.server.requests[0].respond(200, {
  2038. 'Strict-Transport-Security': 'max-age=15768000',
  2039. 'X-XSS-Protection': '1; mode=block',
  2040. 'X-Content-Type-Options': 'nosniff',
  2041. 'X-Robots-Tag': 'noindex, nofollow',
  2042. 'X-Frame-Options': 'SAMEORIGIN',
  2043. 'X-Permitted-Cross-Domain-Policies': 'none',
  2044. 'Referrer-Policy': 'no-referrer-when-downgrade',
  2045. });
  2046. result.done(function( data, s, x ){
  2047. expect(data).toEqual([]);
  2048. done();
  2049. });
  2050. });
  2051. it('should return no message if Referrer-Policy is set to strict-origin', function(done) {
  2052. protocolStub.returns('https');
  2053. var result = OC.SetupChecks.checkGeneric();
  2054. suite.server.requests[0].respond(200, {
  2055. 'Strict-Transport-Security': 'max-age=15768000',
  2056. 'X-XSS-Protection': '1; mode=block',
  2057. 'X-Content-Type-Options': 'nosniff',
  2058. 'X-Robots-Tag': 'noindex, nofollow',
  2059. 'X-Frame-Options': 'SAMEORIGIN',
  2060. 'X-Permitted-Cross-Domain-Policies': 'none',
  2061. 'Referrer-Policy': 'strict-origin',
  2062. });
  2063. result.done(function( data, s, x ){
  2064. expect(data).toEqual([]);
  2065. done();
  2066. });
  2067. });
  2068. it('should return no message if Referrer-Policy is set to strict-origin-when-cross-origin', function(done) {
  2069. protocolStub.returns('https');
  2070. var result = OC.SetupChecks.checkGeneric();
  2071. suite.server.requests[0].respond(200, {
  2072. 'Strict-Transport-Security': 'max-age=15768000',
  2073. 'X-XSS-Protection': '1; mode=block',
  2074. 'X-Content-Type-Options': 'nosniff',
  2075. 'X-Robots-Tag': 'noindex, nofollow',
  2076. 'X-Frame-Options': 'SAMEORIGIN',
  2077. 'X-Permitted-Cross-Domain-Policies': 'none',
  2078. 'Referrer-Policy': 'strict-origin-when-cross-origin',
  2079. });
  2080. result.done(function( data, s, x ){
  2081. expect(data).toEqual([]);
  2082. done();
  2083. });
  2084. });
  2085. it('should return no message if Referrer-Policy is set to same-origin', function(done) {
  2086. protocolStub.returns('https');
  2087. var result = OC.SetupChecks.checkGeneric();
  2088. suite.server.requests[0].respond(200, {
  2089. 'Strict-Transport-Security': 'max-age=15768000',
  2090. 'X-XSS-Protection': '1; mode=block',
  2091. 'X-Content-Type-Options': 'nosniff',
  2092. 'X-Robots-Tag': 'noindex, nofollow',
  2093. 'X-Frame-Options': 'SAMEORIGIN',
  2094. 'X-Permitted-Cross-Domain-Policies': 'none',
  2095. 'Referrer-Policy': 'same-origin',
  2096. });
  2097. result.done(function( data, s, x ){
  2098. expect(data).toEqual([]);
  2099. done();
  2100. });
  2101. });
  2102. it('should return a message if Referrer-Policy is set to origin', function(done) {
  2103. protocolStub.returns('https');
  2104. var result = OC.SetupChecks.checkGeneric();
  2105. suite.server.requests[0].respond(200, {
  2106. 'Strict-Transport-Security': 'max-age=15768000',
  2107. 'X-XSS-Protection': '1; mode=block',
  2108. 'X-Content-Type-Options': 'nosniff',
  2109. 'X-Robots-Tag': 'noindex, nofollow',
  2110. 'X-Frame-Options': 'SAMEORIGIN',
  2111. 'X-Permitted-Cross-Domain-Policies': 'none',
  2112. 'Referrer-Policy': 'origin',
  2113. });
  2114. result.done(function( data, s, x ){
  2115. expect(data).toEqual([
  2116. {
  2117. 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>.',
  2118. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  2119. }
  2120. ]);
  2121. done();
  2122. });
  2123. });
  2124. it('should return a message if Referrer-Policy is set to origin-when-cross-origin', function(done) {
  2125. protocolStub.returns('https');
  2126. var result = OC.SetupChecks.checkGeneric();
  2127. suite.server.requests[0].respond(200, {
  2128. 'Strict-Transport-Security': 'max-age=15768000',
  2129. 'X-XSS-Protection': '1; mode=block',
  2130. 'X-Content-Type-Options': 'nosniff',
  2131. 'X-Robots-Tag': 'noindex, nofollow',
  2132. 'X-Frame-Options': 'SAMEORIGIN',
  2133. 'X-Permitted-Cross-Domain-Policies': 'none',
  2134. 'Referrer-Policy': 'origin-when-cross-origin',
  2135. });
  2136. result.done(function( data, s, x ){
  2137. expect(data).toEqual([
  2138. {
  2139. 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>.',
  2140. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  2141. }
  2142. ]);
  2143. done();
  2144. });
  2145. });
  2146. it('should return a message if Referrer-Policy is set to unsafe-url', function(done) {
  2147. protocolStub.returns('https');
  2148. var result = OC.SetupChecks.checkGeneric();
  2149. suite.server.requests[0].respond(200, {
  2150. 'Strict-Transport-Security': 'max-age=15768000',
  2151. 'X-XSS-Protection': '1; mode=block',
  2152. 'X-Content-Type-Options': 'nosniff',
  2153. 'X-Robots-Tag': 'noindex, nofollow',
  2154. 'X-Frame-Options': 'SAMEORIGIN',
  2155. 'X-Permitted-Cross-Domain-Policies': 'none',
  2156. 'Referrer-Policy': 'unsafe-url',
  2157. });
  2158. result.done(function( data, s, x ){
  2159. expect(data).toEqual([
  2160. {
  2161. 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>.',
  2162. type: OC.SetupChecks.MESSAGE_TYPE_INFO
  2163. }
  2164. ]);
  2165. done();
  2166. });
  2167. });
  2168. });
  2169. });
  2170. it('should return an error if the response has no statuscode 200', function(done) {
  2171. var async = OC.SetupChecks.checkGeneric();
  2172. suite.server.requests[0].respond(
  2173. 500,
  2174. {
  2175. 'Content-Type': 'application/json'
  2176. },
  2177. JSON.stringify({data: {serverHasInternetConnectionProblems: true}})
  2178. );
  2179. async.done(function( data, s, x ){
  2180. expect(data).toEqual([{
  2181. msg: 'Error occurred while checking server setup',
  2182. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  2183. }, {
  2184. msg: 'Error occurred while checking server setup',
  2185. type: OC.SetupChecks.MESSAGE_TYPE_ERROR
  2186. }]);
  2187. done();
  2188. });
  2189. });
  2190. it('should return a SSL warning if SSL used without Strict-Transport-Security-Header', function(done) {
  2191. protocolStub.returns('https');
  2192. var async = OC.SetupChecks.checkGeneric();
  2193. suite.server.requests[0].respond(200,
  2194. {
  2195. 'X-XSS-Protection': '1; mode=block',
  2196. 'X-Content-Type-Options': 'nosniff',
  2197. 'X-Robots-Tag': 'noindex, nofollow',
  2198. 'X-Frame-Options': 'SAMEORIGIN',
  2199. 'X-Permitted-Cross-Domain-Policies': 'none',
  2200. 'Referrer-Policy': 'no-referrer',
  2201. }
  2202. );
  2203. async.done(function( data, s, x ){
  2204. expect(data).toEqual([{
  2205. 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>.',
  2206. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2207. }]);
  2208. done();
  2209. });
  2210. });
  2211. it('should return a SSL warning if SSL used with to small Strict-Transport-Security-Header', function(done) {
  2212. protocolStub.returns('https');
  2213. var async = OC.SetupChecks.checkGeneric();
  2214. suite.server.requests[0].respond(200,
  2215. {
  2216. 'Strict-Transport-Security': 'max-age=15551999',
  2217. 'X-XSS-Protection': '1; mode=block',
  2218. 'X-Content-Type-Options': 'nosniff',
  2219. 'X-Robots-Tag': 'noindex, nofollow',
  2220. 'X-Frame-Options': 'SAMEORIGIN',
  2221. 'X-Permitted-Cross-Domain-Policies': 'none',
  2222. 'Referrer-Policy': 'no-referrer',
  2223. }
  2224. );
  2225. async.done(function( data, s, x ){
  2226. expect(data).toEqual([{
  2227. 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>.',
  2228. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2229. }]);
  2230. done();
  2231. });
  2232. });
  2233. it('should return a SSL warning if SSL used with to a bogus Strict-Transport-Security-Header', function(done) {
  2234. protocolStub.returns('https');
  2235. var async = OC.SetupChecks.checkGeneric();
  2236. suite.server.requests[0].respond(200,
  2237. {
  2238. 'Strict-Transport-Security': 'iAmABogusHeader342',
  2239. 'X-XSS-Protection': '1; mode=block',
  2240. 'X-Content-Type-Options': 'nosniff',
  2241. 'X-Robots-Tag': 'noindex, nofollow',
  2242. 'X-Frame-Options': 'SAMEORIGIN',
  2243. 'X-Permitted-Cross-Domain-Policies': 'none',
  2244. 'Referrer-Policy': 'no-referrer',
  2245. }
  2246. );
  2247. async.done(function( data, s, x ){
  2248. expect(data).toEqual([{
  2249. 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>.',
  2250. type: OC.SetupChecks.MESSAGE_TYPE_WARNING
  2251. }]);
  2252. done();
  2253. });
  2254. });
  2255. it('should return no SSL warning if SSL used with to exact the minimum Strict-Transport-Security-Header', function(done) {
  2256. protocolStub.returns('https');
  2257. var async = OC.SetupChecks.checkGeneric();
  2258. suite.server.requests[0].respond(200, {
  2259. 'Strict-Transport-Security': 'max-age=15768000',
  2260. 'X-XSS-Protection': '1; mode=block',
  2261. 'X-Content-Type-Options': 'nosniff',
  2262. 'X-Robots-Tag': 'noindex, nofollow',
  2263. 'X-Frame-Options': 'SAMEORIGIN',
  2264. 'X-Permitted-Cross-Domain-Policies': 'none',
  2265. 'Referrer-Policy': 'no-referrer',
  2266. });
  2267. async.done(function( data, s, x ){
  2268. expect(data).toEqual([]);
  2269. done();
  2270. });
  2271. });
  2272. it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header', function(done) {
  2273. protocolStub.returns('https');
  2274. var async = OC.SetupChecks.checkGeneric();
  2275. suite.server.requests[0].respond(200, {
  2276. 'Strict-Transport-Security': 'max-age=99999999',
  2277. 'X-XSS-Protection': '1; mode=block',
  2278. 'X-Content-Type-Options': 'nosniff',
  2279. 'X-Robots-Tag': 'noindex, nofollow',
  2280. 'X-Frame-Options': 'SAMEORIGIN',
  2281. 'X-Permitted-Cross-Domain-Policies': 'none',
  2282. 'Referrer-Policy': 'no-referrer',
  2283. });
  2284. async.done(function( data, s, x ){
  2285. expect(data).toEqual([]);
  2286. done();
  2287. });
  2288. });
  2289. it('should return no SSL warning if SSL used with to more than the minimum Strict-Transport-Security-Header and includeSubDomains parameter', function(done) {
  2290. protocolStub.returns('https');
  2291. var async = OC.SetupChecks.checkGeneric();
  2292. suite.server.requests[0].respond(200, {
  2293. 'Strict-Transport-Security': 'max-age=99999999; includeSubDomains',
  2294. 'X-XSS-Protection': '1; mode=block',
  2295. 'X-Content-Type-Options': 'nosniff',
  2296. 'X-Robots-Tag': 'noindex, nofollow',
  2297. 'X-Frame-Options': 'SAMEORIGIN',
  2298. 'X-Permitted-Cross-Domain-Policies': 'none',
  2299. 'Referrer-Policy': 'no-referrer',
  2300. });
  2301. async.done(function( data, s, x ){
  2302. expect(data).toEqual([]);
  2303. done();
  2304. });
  2305. });
  2306. 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) {
  2307. protocolStub.returns('https');
  2308. var async = OC.SetupChecks.checkGeneric();
  2309. suite.server.requests[0].respond(200, {
  2310. 'Strict-Transport-Security': 'max-age=99999999; preload; includeSubDomains',
  2311. 'X-XSS-Protection': '1; mode=block',
  2312. 'X-Content-Type-Options': 'nosniff',
  2313. 'X-Robots-Tag': 'noindex, nofollow',
  2314. 'X-Frame-Options': 'SAMEORIGIN',
  2315. 'X-Permitted-Cross-Domain-Policies': 'none',
  2316. 'Referrer-Policy': 'no-referrer',
  2317. });
  2318. async.done(function( data, s, x ){
  2319. expect(data).toEqual([]);
  2320. done();
  2321. });
  2322. });
  2323. });