@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | 62 | public function isCodeCheckEnforced(): bool { |
| 63 | - $notSignedChannels = [ '', 'git']; |
|
| 63 | + $notSignedChannels = ['', 'git']; |
|
| 64 | 64 | if (\in_array($this->serverVersion->getChannel(), $notSignedChannels, true)) { |
| 65 | 65 | return false; |
| 66 | 66 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // Thus we ignore everything below the first occurrence of |
| 139 | 139 | // "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the |
| 140 | 140 | // hash generated based on this. |
| 141 | - if ($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') { |
|
| 141 | + if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess') { |
|
| 142 | 142 | $fileContent = file_get_contents($filename); |
| 143 | 143 | $explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent); |
| 144 | 144 | if (\count($explodedArray) === 2) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | - if ($filename === $this->environmentHelper->getServerRoot() . '/core/js/mimetypelist.js') { |
|
| 149 | + if ($filename === $this->environmentHelper->getServerRoot().'/core/js/mimetypelist.js') { |
|
| 150 | 150 | $oldMimetypeList = new GenerateMimetypeFileBuilder(); |
| 151 | 151 | $newFile = $oldMimetypeList->generateFile($this->mimeTypeDetector->getAllAliases(), $this->mimeTypeDetector->getAllNamings()); |
| 152 | 152 | $oldFile = $this->fileAccessHelper->file_get_contents($filename); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | public function writeAppSignature($path, |
| 200 | 200 | X509 $certificate, |
| 201 | 201 | RSA $privateKey) { |
| 202 | - $appInfoDir = $path . '/appinfo'; |
|
| 202 | + $appInfoDir = $path.'/appinfo'; |
|
| 203 | 203 | try { |
| 204 | 204 | $this->fileAccessHelper->assertDirectoryExists($appInfoDir); |
| 205 | 205 | |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | $hashes = $this->generateHashes($iterator, $path); |
| 208 | 208 | $signature = $this->createSignatureData($hashes, $certificate, $privateKey); |
| 209 | 209 | $this->fileAccessHelper->file_put_contents( |
| 210 | - $appInfoDir . '/signature.json', |
|
| 210 | + $appInfoDir.'/signature.json', |
|
| 211 | 211 | json_encode($signature, JSON_PRETTY_PRINT) |
| 212 | 212 | ); |
| 213 | 213 | } catch (\Exception $e) { |
| 214 | 214 | if (!$this->fileAccessHelper->is_writable($appInfoDir)) { |
| 215 | - throw new \Exception($appInfoDir . ' is not writable'); |
|
| 215 | + throw new \Exception($appInfoDir.' is not writable'); |
|
| 216 | 216 | } |
| 217 | 217 | throw $e; |
| 218 | 218 | } |
@@ -229,19 +229,19 @@ discard block |
||
| 229 | 229 | public function writeCoreSignature(X509 $certificate, |
| 230 | 230 | RSA $rsa, |
| 231 | 231 | $path) { |
| 232 | - $coreDir = $path . '/core'; |
|
| 232 | + $coreDir = $path.'/core'; |
|
| 233 | 233 | try { |
| 234 | 234 | $this->fileAccessHelper->assertDirectoryExists($coreDir); |
| 235 | 235 | $iterator = $this->getFolderIterator($path, $path); |
| 236 | 236 | $hashes = $this->generateHashes($iterator, $path); |
| 237 | 237 | $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); |
| 238 | 238 | $this->fileAccessHelper->file_put_contents( |
| 239 | - $coreDir . '/signature.json', |
|
| 239 | + $coreDir.'/signature.json', |
|
| 240 | 240 | json_encode($signatureData, JSON_PRETTY_PRINT) |
| 241 | 241 | ); |
| 242 | 242 | } catch (\Exception $e) { |
| 243 | 243 | if (!$this->fileAccessHelper->is_writable($coreDir)) { |
| 244 | - throw new \Exception($coreDir . ' is not writable'); |
|
| 244 | + throw new \Exception($coreDir.' is not writable'); |
|
| 245 | 245 | } |
| 246 | 246 | throw $e; |
| 247 | 247 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | // Check if certificate is signed by Nextcloud Root Authority |
| 294 | 294 | $x509 = new \phpseclib\File\X509(); |
| 295 | - $rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot() . '/resources/codesigning/root.crt'); |
|
| 295 | + $rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot().'/resources/codesigning/root.crt'); |
|
| 296 | 296 | |
| 297 | 297 | $rootCerts = $this->splitCerts($rootCertificatePublicKey); |
| 298 | 298 | foreach ($rootCerts as $rootCert) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | $path = $this->appLocator->getAppPath($appId); |
| 464 | 464 | } |
| 465 | 465 | $result = $this->verify( |
| 466 | - $path . '/appinfo/signature.json', |
|
| 466 | + $path.'/appinfo/signature.json', |
|
| 467 | 467 | $path, |
| 468 | 468 | $appId, |
| 469 | 469 | $forceVerify |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | public function verifyCoreSignature(): array { |
| 515 | 515 | try { |
| 516 | 516 | $result = $this->verify( |
| 517 | - $this->environmentHelper->getServerRoot() . '/core/signature.json', |
|
| 517 | + $this->environmentHelper->getServerRoot().'/core/signature.json', |
|
| 518 | 518 | $this->environmentHelper->getServerRoot(), |
| 519 | 519 | 'core' |
| 520 | 520 | ); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $appNeedsToBeChecked = false; |
| 546 | 546 | if ($isShipped) { |
| 547 | 547 | $appNeedsToBeChecked = true; |
| 548 | - } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId) . '/appinfo/signature.json')) { |
|
| 548 | + } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId).'/appinfo/signature.json')) { |
|
| 549 | 549 | // Otherwise only if the application explicitly ships a signature.json file |
| 550 | 550 | $appNeedsToBeChecked = true; |
| 551 | 551 | } |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | public function registerTypeArray(array $types): void { |
| 77 | 77 | // Register the types, |
| 78 | 78 | foreach ($types as $extension => $mimeType) { |
| 79 | - $this->registerType((string)$extension, $mimeType[0], $mimeType[1] ?? null); |
|
| 79 | + $this->registerType((string) $extension, $mimeType[0], $mimeType[1] ?? null); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Update the alternative mimeTypes to avoid having to look them up each time. |
| 83 | 83 | foreach ($this->mimeTypes as $extension => $mimeType) { |
| 84 | - if (str_starts_with((string)$extension, '_comment')) { |
|
| 84 | + if (str_starts_with((string) $extension, '_comment')) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | private function loadCustomDefinitions(string $fileName, array $definitions): array { |
| 96 | - if (file_exists($this->customConfigDir . '/' . $fileName)) { |
|
| 97 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/' . $fileName), true); |
|
| 96 | + if (file_exists($this->customConfigDir.'/'.$fileName)) { |
|
| 97 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/'.$fileName), true); |
|
| 98 | 98 | if (json_last_error() === JSON_ERROR_NONE) { |
| 99 | 99 | $definitions = array_merge($definitions, $custom); |
| 100 | 100 | } else { |
| 101 | - $this->logger->warning('Failed to parse ' . $fileName . ': ' . json_last_error_msg()); |
|
| 101 | + $this->logger->warning('Failed to parse '.$fileName.': '.json_last_error_msg()); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | return $definitions; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
| 115 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
| 116 | 116 | $this->mimeTypeAlias = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEALIASES, $this->mimeTypeAlias); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | public function getOnlyDefaultAliases(): array { |
| 128 | 128 | $this->loadMappings(); |
| 129 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
| 129 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
| 130 | 130 | return $this->mimeTypeAlias; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $mimeTypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); |
|
| 141 | + $mimeTypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypemapping.dist.json'), true); |
|
| 142 | 142 | $mimeTypeMapping = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEMAPPING, $mimeTypeMapping); |
| 143 | 143 | |
| 144 | 144 | $this->registerTypeArray($mimeTypeMapping); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | return; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $mimeTypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypenames.dist.json'), true); |
|
| 160 | + $mimeTypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypenames.dist.json'), true); |
|
| 161 | 161 | $mimeTypeMapping = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPENAMES, $mimeTypeMapping); |
| 162 | 162 | |
| 163 | 163 | $this->mimeTypesNames = $mimeTypeMapping; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | // Icon exists? |
| 356 | 356 | try { |
| 357 | - $this->mimeTypeIcons[$mimeType] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); |
|
| 357 | + $this->mimeTypeIcons[$mimeType] = $this->urlGenerator->imagePath('core', 'filetypes/'.$icon.'.svg'); |
|
| 358 | 358 | return $this->mimeTypeIcons[$mimeType]; |
| 359 | 359 | } catch (\RuntimeException $e) { |
| 360 | 360 | // Specified image not found |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | if (strpos($icon, '-')) { |
| 365 | 365 | $mimePart = substr($icon, 0, strpos($icon, '-')); |
| 366 | 366 | try { |
| 367 | - $this->mimeTypeIcons[$mimeType] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); |
|
| 367 | + $this->mimeTypeIcons[$mimeType] = $this->urlGenerator->imagePath('core', 'filetypes/'.$mimePart.'.svg'); |
|
| 368 | 368 | return $this->mimeTypeIcons[$mimeType]; |
| 369 | 369 | } catch (\RuntimeException $e) { |
| 370 | 370 | // Image for the first part of the MIME type not found |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function generateFile(array $aliases, array $names): string { |
| 19 | 19 | // Remove comments |
| 20 | - $aliases = array_filter($aliases, static function ($key) { |
|
| 20 | + $aliases = array_filter($aliases, static function($key) { |
|
| 21 | 21 | // Single digit extensions will be treated as integers |
| 22 | 22 | // Let's make sure they are strings |
| 23 | 23 | // https://github.com/nextcloud/server/issues/42902 |
| 24 | - $key = (string)$key; |
|
| 24 | + $key = (string) $key; |
|
| 25 | 25 | return !($key === '' || $key[0] === '_'); |
| 26 | 26 | }, ARRAY_FILTER_USE_KEY); |
| 27 | 27 | |
| 28 | 28 | // Fetch all files |
| 29 | - $dir = new \DirectoryIterator(\OC::$SERVERROOT . '/core/img/filetypes'); |
|
| 29 | + $dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes'); |
|
| 30 | 30 | |
| 31 | 31 | $files = []; |
| 32 | 32 | foreach ($dir as $fileInfo) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // Fetch all themes! |
| 44 | 44 | $themes = []; |
| 45 | - $dirs = new \DirectoryIterator(\OC::$SERVERROOT . '/themes/'); |
|
| 45 | + $dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/'); |
|
| 46 | 46 | foreach ($dirs as $dir) { |
| 47 | 47 | //Valid theme dir |
| 48 | 48 | if ($dir->isFile() || $dir->isDot()) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $theme = $dir->getFilename(); |
| 53 | - $themeDir = $dir->getPath() . '/' . $theme . '/core/img/filetypes/'; |
|
| 53 | + $themeDir = $dir->getPath().'/'.$theme.'/core/img/filetypes/'; |
|
| 54 | 54 | // Check if this theme has its own filetype icons |
| 55 | 55 | if (!file_exists($themeDir)) { |
| 56 | 56 | continue; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // Skip internal names |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | - $namesOutput .= "'$key': t('core', " . json_encode($name) . "),\n"; |
|
| 80 | + $namesOutput .= "'$key': t('core', ".json_encode($name)."),\n"; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | //Generate the JS |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * To regenerate this file run ./occ maintenance:mimetype:update-js |
| 91 | 91 | */ |
| 92 | 92 | OC.MimeTypeList={ |
| 93 | - aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . ', |
|
| 94 | - files: ' . json_encode($files, JSON_PRETTY_PRINT) . ', |
|
| 95 | - themes: ' . json_encode($themes, JSON_PRETTY_PRINT) . ', |
|
| 96 | - names: {' . $namesOutput . '}, |
|
| 93 | + aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).', |
|
| 94 | + files: ' . json_encode($files, JSON_PRETTY_PRINT).', |
|
| 95 | + themes: ' . json_encode($themes, JSON_PRETTY_PRINT).', |
|
| 96 | + names: {' . $namesOutput.'}, |
|
| 97 | 97 | }; |
| 98 | 98 | '; |
| 99 | 99 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | // Output the JS |
| 34 | 34 | $generatedMimetypeFile = new GenerateMimetypeFileBuilder(); |
| 35 | 35 | $namings = $this->mimetypeDetector->getAllNamings(); |
| 36 | - file_put_contents(\OC::$SERVERROOT . '/core/js/mimetypelist.js', $generatedMimetypeFile->generateFile($aliases, $namings)); |
|
| 36 | + file_put_contents(\OC::$SERVERROOT.'/core/js/mimetypelist.js', $generatedMimetypeFile->generateFile($aliases, $namings)); |
|
| 37 | 37 | |
| 38 | 38 | $output->writeln('<info>mimetypelist.js is updated'); |
| 39 | 39 | return 0; |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | ->with('NotExistingApp/appinfo') |
| 95 | 95 | ->willReturn(true); |
| 96 | 96 | |
| 97 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); |
|
| 98 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); |
|
| 97 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt'); |
|
| 98 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key'); |
|
| 99 | 99 | $rsa = new RSA(); |
| 100 | 100 | $rsa->loadKey($rsaPrivateKey); |
| 101 | 101 | $x509 = new X509(); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | ->method('file_put_contents') |
| 114 | 114 | ->will($this->throwException(new \Exception('Exception message'))); |
| 115 | 115 | |
| 116 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); |
|
| 117 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); |
|
| 116 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt'); |
|
| 117 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key'); |
|
| 118 | 118 | $rsa = new RSA(); |
| 119 | 119 | $rsa->loadKey($rsaPrivateKey); |
| 120 | 120 | $x509 = new X509(); |
| 121 | 121 | $x509->loadX509($keyBundle); |
| 122 | - $this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa); |
|
| 122 | + $this->checker->writeAppSignature(\OC::$SERVERROOT.'/tests/data/integritycheck/app/', $x509, $rsa); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function testWriteAppSignature(): void { |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | ->expects($this->once()) |
| 136 | 136 | ->method('file_put_contents') |
| 137 | 137 | ->with( |
| 138 | - $this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'), |
|
| 139 | - $this->callback(function ($signature) use ($expectedSignatureFileData) { |
|
| 138 | + $this->equalTo(\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json'), |
|
| 139 | + $this->callback(function($signature) use ($expectedSignatureFileData) { |
|
| 140 | 140 | $expectedArray = json_decode($expectedSignatureFileData, true); |
| 141 | 141 | $actualArray = json_decode($signature, true); |
| 142 | 142 | $this->assertEquals($expectedArray, $actualArray); |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | }) |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); |
|
| 148 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); |
|
| 147 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt'); |
|
| 148 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key'); |
|
| 149 | 149 | $rsa = new RSA(); |
| 150 | 150 | $rsa->loadKey($rsaPrivateKey); |
| 151 | 151 | $x509 = new X509(); |
| 152 | 152 | $x509->loadX509($keyBundle); |
| 153 | - $this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa); |
|
| 153 | + $this->checker->writeAppSignature(\OC::$SERVERROOT.'/tests/data/integritycheck/app/', $x509, $rsa); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function testVerifyAppSignatureWithoutSignatureData(): void { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | ->expects($this->once()) |
| 189 | 189 | ->method('getAppPath') |
| 190 | 190 | ->with('SomeApp') |
| 191 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 191 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 192 | 192 | $signatureDataFile = '{ |
| 193 | 193 | "hashes": { |
| 194 | 194 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | ->expects($this->exactly(2)) |
| 202 | 202 | ->method('file_get_contents') |
| 203 | 203 | ->willReturnMap([ |
| 204 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 205 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 204 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 205 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 206 | 206 | ]); |
| 207 | 207 | |
| 208 | 208 | $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | ->expects($this->once()) |
| 224 | 224 | ->method('getAppPath') |
| 225 | 225 | ->with('SomeApp') |
| 226 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 226 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 227 | 227 | $signatureDataFile = '{ |
| 228 | 228 | "hashes": { |
| 229 | 229 | "AnotherFile.txt": "tampered", |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | ->expects($this->exactly(2)) |
| 237 | 237 | ->method('file_get_contents') |
| 238 | 238 | ->willReturnMap([ |
| 239 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 240 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 239 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 240 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 241 | 241 | ]); |
| 242 | 242 | |
| 243 | 243 | $expected = [ |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | ->expects($this->once()) |
| 265 | 265 | ->method('getAppPath') |
| 266 | 266 | ->with('SomeApp') |
| 267 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); |
|
| 267 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/'); |
|
| 268 | 268 | $signatureDataFile = '{ |
| 269 | 269 | "hashes": { |
| 270 | 270 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | ->expects($this->exactly(2)) |
| 278 | 278 | ->method('file_get_contents') |
| 279 | 279 | ->willReturnMap([ |
| 280 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 281 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 280 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 281 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 282 | 282 | ]); |
| 283 | 283 | |
| 284 | 284 | |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | ->expects($this->exactly(2)) |
| 334 | 334 | ->method('file_get_contents') |
| 335 | 335 | ->willReturnMap([ |
| 336 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 337 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 336 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 337 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 338 | 338 | ]); |
| 339 | 339 | |
| 340 | 340 | $expected = [ |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | ], |
| 359 | 359 | |
| 360 | 360 | ]; |
| 361 | - $this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp', \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/')); |
|
| 361 | + $this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp', \OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/')); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | public function testVerifyAppWithDifferentScope(): void { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | ->expects($this->once()) |
| 377 | 377 | ->method('getAppPath') |
| 378 | 378 | ->with('SomeApp') |
| 379 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); |
|
| 379 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/'); |
|
| 380 | 380 | $signatureDataFile = '{ |
| 381 | 381 | "hashes": { |
| 382 | 382 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -389,8 +389,8 @@ discard block |
||
| 389 | 389 | ->expects($this->exactly(2)) |
| 390 | 390 | ->method('file_get_contents') |
| 391 | 391 | ->willReturnMap([ |
| 392 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 393 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 392 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile], |
|
| 393 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 394 | 394 | ]); |
| 395 | 395 | |
| 396 | 396 | $expected = [ |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | ->expects($this->once()) |
| 418 | 418 | ->method('getAppPath') |
| 419 | 419 | ->with('SomeApp') |
| 420 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 420 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 421 | 421 | $signatureDataFile = '{ |
| 422 | 422 | "hashes": { |
| 423 | 423 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | ->expects($this->exactly(2)) |
| 431 | 431 | ->method('file_get_contents') |
| 432 | 432 | ->willReturnMap([ |
| 433 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 434 | - ['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 433 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile], |
|
| 434 | + ['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 435 | 435 | ]); |
| 436 | 436 | |
| 437 | 437 | $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); |
@@ -449,11 +449,11 @@ discard block |
||
| 449 | 449 | $this->fileAccessHelper |
| 450 | 450 | ->expects($this->once()) |
| 451 | 451 | ->method('is_writable') |
| 452 | - ->with(__DIR__ . '/core') |
|
| 452 | + ->with(__DIR__.'/core') |
|
| 453 | 453 | ->willReturn(true); |
| 454 | 454 | |
| 455 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); |
|
| 456 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); |
|
| 455 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt'); |
|
| 456 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key'); |
|
| 457 | 457 | $rsa = new RSA(); |
| 458 | 458 | $rsa->loadKey($rsaPrivateKey); |
| 459 | 459 | $x509 = new X509(); |
@@ -473,11 +473,11 @@ discard block |
||
| 473 | 473 | $this->fileAccessHelper |
| 474 | 474 | ->expects($this->once()) |
| 475 | 475 | ->method('is_writable') |
| 476 | - ->with(__DIR__ . '/core') |
|
| 476 | + ->with(__DIR__.'/core') |
|
| 477 | 477 | ->willReturn(false); |
| 478 | 478 | |
| 479 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt'); |
|
| 480 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key'); |
|
| 479 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt'); |
|
| 480 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key'); |
|
| 481 | 481 | $rsa = new RSA(); |
| 482 | 482 | $rsa->loadKey($rsaPrivateKey); |
| 483 | 483 | $x509 = new X509(); |
@@ -497,13 +497,13 @@ discard block |
||
| 497 | 497 | $this->environmentHelper |
| 498 | 498 | ->expects($this->any()) |
| 499 | 499 | ->method('getServerRoot') |
| 500 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 500 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 501 | 501 | $this->fileAccessHelper |
| 502 | 502 | ->expects($this->once()) |
| 503 | 503 | ->method('file_put_contents') |
| 504 | 504 | ->with( |
| 505 | - \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', |
|
| 506 | - $this->callback(function ($signature) use ($expectedSignatureFileData) { |
|
| 505 | + \OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', |
|
| 506 | + $this->callback(function($signature) use ($expectedSignatureFileData) { |
|
| 507 | 507 | $expectedArray = json_decode($expectedSignatureFileData, true); |
| 508 | 508 | $actualArray = json_decode($signature, true); |
| 509 | 509 | $this->assertEquals($expectedArray, $actualArray); |
@@ -511,13 +511,13 @@ discard block |
||
| 511 | 511 | }) |
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); |
|
| 515 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); |
|
| 514 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt'); |
|
| 515 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key'); |
|
| 516 | 516 | $rsa = new RSA(); |
| 517 | 517 | $rsa->loadKey($rsaPrivateKey); |
| 518 | 518 | $x509 = new X509(); |
| 519 | 519 | $x509->loadX509($keyBundle); |
| 520 | - $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 520 | + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | public function testWriteCoreSignatureWithUnmodifiedHtaccess(): void { |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | $this->environmentHelper |
| 533 | 533 | ->expects($this->any()) |
| 534 | 534 | ->method('getServerRoot') |
| 535 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); |
|
| 535 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified/'); |
|
| 536 | 536 | $this->fileAccessHelper |
| 537 | 537 | ->expects($this->once()) |
| 538 | 538 | ->method('file_put_contents') |
| 539 | 539 | ->with( |
| 540 | - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json', |
|
| 541 | - $this->callback(function ($signature) use ($expectedSignatureFileData) { |
|
| 540 | + \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified//core/signature.json', |
|
| 541 | + $this->callback(function($signature) use ($expectedSignatureFileData) { |
|
| 542 | 542 | $expectedArray = json_decode($expectedSignatureFileData, true); |
| 543 | 543 | $actualArray = json_decode($signature, true); |
| 544 | 544 | $this->assertEquals($expectedArray, $actualArray); |
@@ -546,13 +546,13 @@ discard block |
||
| 546 | 546 | }) |
| 547 | 547 | ); |
| 548 | 548 | |
| 549 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); |
|
| 550 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); |
|
| 549 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt'); |
|
| 550 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key'); |
|
| 551 | 551 | $rsa = new RSA(); |
| 552 | 552 | $rsa->loadKey($rsaPrivateKey); |
| 553 | 553 | $x509 = new X509(); |
| 554 | 554 | $x509->loadX509($keyBundle); |
| 555 | - $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); |
|
| 555 | + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified/'); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | public function testWriteCoreSignatureWithInvalidModifiedHtaccess(): void { |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | ->expects($this->once()) |
| 568 | 568 | ->method('file_put_contents') |
| 569 | 569 | ->with( |
| 570 | - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', |
|
| 571 | - $this->callback(function ($signature) use ($expectedSignatureFileData) { |
|
| 570 | + \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', |
|
| 571 | + $this->callback(function($signature) use ($expectedSignatureFileData) { |
|
| 572 | 572 | $expectedArray = json_decode($expectedSignatureFileData, true); |
| 573 | 573 | $actualArray = json_decode($signature, true); |
| 574 | 574 | $this->assertEquals($expectedArray, $actualArray); |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | }) |
| 577 | 577 | ); |
| 578 | 578 | |
| 579 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); |
|
| 580 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); |
|
| 579 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt'); |
|
| 580 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key'); |
|
| 581 | 581 | $rsa = new RSA(); |
| 582 | 582 | $rsa->loadKey($rsaPrivateKey); |
| 583 | 583 | $x509 = new X509(); |
| 584 | 584 | $x509->loadX509($keyBundle); |
| 585 | - $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/'); |
|
| 585 | + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithInvalidModifiedContent/'); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | public function testWriteCoreSignatureWithValidModifiedHtaccess(): void { |
@@ -597,13 +597,13 @@ discard block |
||
| 597 | 597 | $this->environmentHelper |
| 598 | 598 | ->expects($this->any()) |
| 599 | 599 | ->method('getServerRoot') |
| 600 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 600 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 601 | 601 | $this->fileAccessHelper |
| 602 | 602 | ->expects($this->once()) |
| 603 | 603 | ->method('file_put_contents') |
| 604 | 604 | ->with( |
| 605 | - \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', |
|
| 606 | - $this->callback(function ($signature) use ($expectedSignatureFileData) { |
|
| 605 | + \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', |
|
| 606 | + $this->callback(function($signature) use ($expectedSignatureFileData) { |
|
| 607 | 607 | $expectedArray = json_decode($expectedSignatureFileData, true); |
| 608 | 608 | $actualArray = json_decode($signature, true); |
| 609 | 609 | $this->assertEquals($expectedArray, $actualArray); |
@@ -611,13 +611,13 @@ discard block |
||
| 611 | 611 | }) |
| 612 | 612 | ); |
| 613 | 613 | |
| 614 | - $keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt'); |
|
| 615 | - $rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key'); |
|
| 614 | + $keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt'); |
|
| 615 | + $rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key'); |
|
| 616 | 616 | $rsa = new RSA(); |
| 617 | 617 | $rsa->loadKey($rsaPrivateKey); |
| 618 | 618 | $x509 = new X509(); |
| 619 | 619 | $x509->loadX509($keyBundle); |
| 620 | - $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 620 | + $this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | public function testVerifyCoreSignatureWithoutSignatureData(): void { |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | $this->environmentHelper |
| 655 | 655 | ->expects($this->any()) |
| 656 | 656 | ->method('getServerRoot') |
| 657 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 657 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 658 | 658 | $signatureDataFile = '{ |
| 659 | 659 | "hashes": { |
| 660 | 660 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -667,8 +667,8 @@ discard block |
||
| 667 | 667 | ->expects($this->exactly(2)) |
| 668 | 668 | ->method('file_get_contents') |
| 669 | 669 | ->willReturnMap([ |
| 670 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 671 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 670 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 671 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 672 | 672 | ]); |
| 673 | 673 | |
| 674 | 674 | $this->assertSame([], $this->checker->verifyCoreSignature()); |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | $this->environmentHelper |
| 689 | 689 | ->expects($this->any()) |
| 690 | 690 | ->method('getServerRoot') |
| 691 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 691 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent'); |
|
| 692 | 692 | $signatureDataFile = '{ |
| 693 | 693 | "hashes": { |
| 694 | 694 | ".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227", |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | ->expects($this->exactly(2)) |
| 702 | 702 | ->method('file_get_contents') |
| 703 | 703 | ->willReturnMap([ |
| 704 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', $signatureDataFile], |
|
| 705 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 704 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', $signatureDataFile], |
|
| 705 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 706 | 706 | ]); |
| 707 | 707 | |
| 708 | 708 | $this->assertSame([], $this->checker->verifyCoreSignature()); |
@@ -712,8 +712,8 @@ discard block |
||
| 712 | 712 | * See inline instruction on how to update the test assets when changing mimetypealiases.dist.json |
| 713 | 713 | */ |
| 714 | 714 | public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData(): void { |
| 715 | - $shippedMimetypeAliases = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json')); |
|
| 716 | - $shippedMimetypeNames = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypenames.dist.json')); |
|
| 715 | + $shippedMimetypeAliases = (array) json_decode(file_get_contents(\OC::$SERVERROOT.'/resources/config/mimetypealiases.dist.json')); |
|
| 716 | + $shippedMimetypeNames = (array) json_decode(file_get_contents(\OC::$SERVERROOT.'/resources/config/mimetypenames.dist.json')); |
|
| 717 | 717 | $allAliases = array_merge($shippedMimetypeAliases, ['my-custom/mimetype' => 'custom']); |
| 718 | 718 | $allMimetypeNames = array_merge($shippedMimetypeNames, ['my-custom/mimetype' => 'Custom Document']); |
| 719 | 719 | |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | // file_put_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js', $newFile); |
| 740 | 740 | // 2. Update signature.json using the following occ command: |
| 741 | 741 | // occ integrity:sign-core --privateKey=./tests/data/integritycheck/core.key --certificate=./tests/data/integritycheck/core.crt --path=./tests/data/integritycheck/mimetypeListModified |
| 742 | - self::assertEquals($newFile, file_get_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js')); |
|
| 742 | + self::assertEquals($newFile, file_get_contents(\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js')); |
|
| 743 | 743 | |
| 744 | 744 | $this->serverVersion |
| 745 | 745 | ->expects($this->once()) |
@@ -754,14 +754,14 @@ discard block |
||
| 754 | 754 | $this->environmentHelper |
| 755 | 755 | ->expects($this->any()) |
| 756 | 756 | ->method('getServerRoot') |
| 757 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified'); |
|
| 757 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified'); |
|
| 758 | 758 | |
| 759 | - $signatureDataFile = file_get_contents(__DIR__ . '/../../data/integritycheck/mimetypeListModified/core/signature.json'); |
|
| 759 | + $signatureDataFile = file_get_contents(__DIR__.'/../../data/integritycheck/mimetypeListModified/core/signature.json'); |
|
| 760 | 760 | $this->fileAccessHelper |
| 761 | 761 | ->method('file_get_contents') |
| 762 | 762 | ->willReturnMap([ |
| 763 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile], |
|
| 764 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 763 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile], |
|
| 764 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 765 | 765 | ]); |
| 766 | 766 | |
| 767 | 767 | $this->assertSame([], $this->checker->verifyCoreSignature()); |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | $this->environmentHelper |
| 782 | 782 | ->expects($this->any()) |
| 783 | 783 | ->method('getServerRoot') |
| 784 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 784 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 785 | 785 | $signatureDataFile = '{ |
| 786 | 786 | "hashes": { |
| 787 | 787 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -794,8 +794,8 @@ discard block |
||
| 794 | 794 | ->expects($this->exactly(2)) |
| 795 | 795 | ->method('file_get_contents') |
| 796 | 796 | ->willReturnMap([ |
| 797 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 798 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 797 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 798 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 799 | 799 | ]); |
| 800 | 800 | |
| 801 | 801 | $this->assertSame([], $this->checker->verifyCoreSignature()); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | $this->environmentHelper |
| 816 | 816 | ->expects($this->any()) |
| 817 | 817 | ->method('getServerRoot') |
| 818 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); |
|
| 818 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/'); |
|
| 819 | 819 | $signatureDataFile = '{ |
| 820 | 820 | "hashes": { |
| 821 | 821 | "AnotherFile.txt": "tampered", |
@@ -828,8 +828,8 @@ discard block |
||
| 828 | 828 | ->expects($this->exactly(2)) |
| 829 | 829 | ->method('file_get_contents') |
| 830 | 830 | ->willReturnMap([ |
| 831 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile], |
|
| 832 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 831 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile], |
|
| 832 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 833 | 833 | ]); |
| 834 | 834 | |
| 835 | 835 | $expected = [ |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | $this->environmentHelper |
| 856 | 856 | ->expects($this->any()) |
| 857 | 857 | ->method('getServerRoot') |
| 858 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); |
|
| 858 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/'); |
|
| 859 | 859 | $signatureDataFile = '{ |
| 860 | 860 | "hashes": { |
| 861 | 861 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -868,8 +868,8 @@ discard block |
||
| 868 | 868 | ->expects($this->exactly(2)) |
| 869 | 869 | ->method('file_get_contents') |
| 870 | 870 | ->willReturnMap([ |
| 871 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile], |
|
| 872 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 871 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile], |
|
| 872 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 873 | 873 | ]); |
| 874 | 874 | |
| 875 | 875 | $expected = [ |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | $this->environmentHelper |
| 911 | 911 | ->expects($this->any()) |
| 912 | 912 | ->method('getServerRoot') |
| 913 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 913 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 914 | 914 | $signatureDataFile = '{ |
| 915 | 915 | "hashes": { |
| 916 | 916 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -923,8 +923,8 @@ discard block |
||
| 923 | 923 | ->expects($this->exactly(2)) |
| 924 | 924 | ->method('file_get_contents') |
| 925 | 925 | ->willReturnMap([ |
| 926 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 927 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 926 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 927 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 928 | 928 | ]); |
| 929 | 929 | |
| 930 | 930 | $expected = [ |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | $this->environmentHelper |
| 951 | 951 | ->expects($this->any()) |
| 952 | 952 | ->method('getServerRoot') |
| 953 | - ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); |
|
| 953 | + ->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/'); |
|
| 954 | 954 | $signatureDataFile = '{ |
| 955 | 955 | "hashes": { |
| 956 | 956 | "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", |
@@ -963,8 +963,8 @@ discard block |
||
| 963 | 963 | ->expects($this->exactly(2)) |
| 964 | 964 | ->method('file_get_contents') |
| 965 | 965 | ->willReturnMap([ |
| 966 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 967 | - [\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')], |
|
| 966 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile], |
|
| 967 | + [\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')], |
|
| 968 | 968 | ]); |
| 969 | 969 | |
| 970 | 970 | $expected = [ |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | $this->checker |
| 1026 | 1026 | ->expects($this->exactly(3)) |
| 1027 | 1027 | ->method('verifyAppSignature') |
| 1028 | - ->willReturnCallback(function ($app) use (&$calls) { |
|
| 1028 | + ->willReturnCallback(function($app) use (&$calls) { |
|
| 1029 | 1029 | $expected = array_shift($calls); |
| 1030 | 1030 | $this->assertSame($expected, $app); |
| 1031 | 1031 | return []; |