aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/IntegrityCheck/CheckerTest.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-06-04 09:00:45 +0200
committerJulius Härtl <jus@bitgrid.net>2022-06-07 21:54:27 +0200
commit50ed84fe17791861f141cd33020ad4f4d86e6673 (patch)
tree00cae596c18b8ce0ec81c763ed702271d721cdfd /tests/lib/IntegrityCheck/CheckerTest.php
parent4404ed649de30f759515b073b5e9bed520403698 (diff)
downloadnextcloud-server-50ed84fe17791861f141cd33020ad4f4d86e6673.tar.gz
nextcloud-server-50ed84fe17791861f141cd33020ad4f4d86e6673.zip
Simlify tests for integrity check on modified mimetype lists
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/lib/IntegrityCheck/CheckerTest.php')
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php284
1 files changed, 32 insertions, 252 deletions
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 6f0c8e8ae85..be9ecdd9041 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -21,6 +21,7 @@
namespace Test\IntegrityCheck;
+use OC\Core\Command\Maintenance\Mimetype\GenerateMimetypeFileBuilder;
use OC\IntegrityCheck\Checker;
use OC\IntegrityCheck\Helpers\AppLocator;
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
@@ -764,7 +765,32 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyCoreSignature());
}
+ /**
+ * See inline instruction on how to update the test assets when changing mimetypealiases.dist.json
+ */
public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() {
+ $shippedMimetypeAliases = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json'));
+ $allAliases = array_merge($shippedMimetypeAliases, ['my-custom/mimetype' => 'custom']);
+
+ $this->mimeTypeDetector
+ ->method('getOnlyDefaultAliases')
+ ->willReturn($shippedMimetypeAliases);
+
+ $this->mimeTypeDetector
+ ->method('getAllAliases')
+ ->willReturn($allAliases);
+
+ $oldMimetypeList = new GenerateMimetypeFileBuilder();
+ $all = $this->mimeTypeDetector->getAllAliases();
+ $newFile = $oldMimetypeList->generateFile($all);
+
+ // When updating the mimetype list the test assets need to be updated as well
+ // 1. Update core/js/mimetypelist.js with the new generated js by running the test with the next line uncommented:
+ // file_put_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js', $newFile);
+ // 2. Update signature.json using the following occ command:
+ // occ integrity:sign-core --privateKey=./tests/data/integritycheck/core.key --certificate=./tests/data/integritycheck/core.crt --path=./tests/data/integritycheck/mimetypeListModified
+ self::assertEquals($newFile, file_get_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js'));
+
$this->environmentHelper
->expects($this->once())
->method('getChannel')
@@ -775,264 +801,18 @@ class CheckerTest extends TestCase {
->with('integrity.check.disabled', false)
->willReturn(false);
- $this->mimeTypeDetector
- ->expects($this->once())
- ->method('getOnlyDefaultAliases')
- ->willReturn(
- [
- '_comment' => 'Array of mimetype aliases.',
- '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.',
- '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud',
- '_comment4' => 'After any change to mimetypealiases.json run:',
- '_comment5' => './occ maintenance:mimetype:update-js',
- '_comment6' => 'Otherwise your update won\'t propagate through the system.',
- 'application/coreldraw' => 'image',
- 'application/epub+zip' => 'text',
- 'application/font-sfnt' => 'image',
- 'application/font-woff' => 'image',
- 'application/gpx+xml' => 'location',
- 'application/illustrator' => 'image',
- 'application/javascript' => 'text/code',
- 'application/json' => 'text/code',
- 'application/msaccess' => 'file',
- 'application/msexcel' => 'x-office/spreadsheet',
- 'application/msonenote' => 'x-office/document',
- 'application/mspowerpoint' => 'x-office/presentation',
- 'application/msword' => 'x-office/document',
- 'application/octet-stream' => 'file',
- 'application/postscript' => 'image',
- 'application/rss+xml' => 'application/xml',
- 'application/vnd.android.package-archive' => 'package/x-generic',
- 'application/vnd.lotus-wordpro' => 'x-office/document',
- 'application/vnd.garmin.tcx+xml' => 'location',
- 'application/vnd.google-earth.kml+xml' => 'location',
- 'application/vnd.google-earth.kmz' => 'location',
- 'application/vnd.ms-excel' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.addin.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.template.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-fontobject' => 'image',
- 'application/vnd.ms-powerpoint' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.template.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-visio.drawing.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.drawing' => 'application/vnd.visio',
- 'application/vnd.ms-visio.stencil.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.stencil' => 'application/vnd.visio',
- 'application/vnd.ms-visio.template.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.template' => 'application/vnd.visio',
- 'application/vnd.ms-word.document.macroEnabled.12' => 'x-office/document',
- 'application/vnd.ms-word.template.macroEnabled.12' => 'x-office/document',
- 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.text' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-master' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-template' => 'x-office/document',
- 'application/vnd.oasis.opendocument.graphics' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.graphics-template' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.text-web' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-flat-xml' => 'x-office/document',
- 'application/vnd.oasis.opendocument.spreadsheet-flat-xml' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.graphics-flat-xml' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.presentation-flat-xml' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document',
- 'application/vnd.visio' => 'x-office/document',
- 'application/vnd.wordperfect' => 'x-office/document',
- 'application/x-7z-compressed' => 'package/x-generic',
- 'application/x-bzip2' => 'package/x-generic',
- 'application/x-cbr' => 'text',
- 'application/x-compressed' => 'package/x-generic',
- 'application/x-dcraw' => 'image',
- 'application/x-deb' => 'package/x-generic',
- 'application/x-fictionbook+xml' => 'text',
- 'application/x-font' => 'image',
- 'application/x-gimp' => 'image',
- 'application/x-gzip' => 'package/x-generic',
- 'application/x-iwork-keynote-sffkey' => 'x-office/presentation',
- 'application/x-iwork-numbers-sffnumbers' => 'x-office/spreadsheet',
- 'application/x-iwork-pages-sffpages' => 'x-office/document',
- 'application/x-mobipocket-ebook' => 'text',
- 'application/x-perl' => 'text/code',
- 'application/x-photoshop' => 'image',
- 'application/x-php' => 'text/code',
- 'application/x-rar-compressed' => 'package/x-generic',
- 'application/x-tar' => 'package/x-generic',
- 'application/x-tex' => 'text',
- 'application/xml' => 'text/html',
- 'application/yaml' => 'text/code',
- 'application/zip' => 'package/x-generic',
- 'database' => 'file',
- 'httpd/unix-directory' => 'dir',
- 'text/css' => 'text/code',
- 'text/csv' => 'x-office/spreadsheet',
- 'text/html' => 'text/code',
- 'text/x-c' => 'text/code',
- 'text/x-c++src' => 'text/code',
- 'text/x-h' => 'text/code',
- 'text/x-java-source' => 'text/code',
- 'text/x-ldif' => 'text/code',
- 'text/x-python' => 'text/code',
- 'text/x-shellscript' => 'text/code',
- 'web' => 'text/code',
- 'application/internet-shortcut' => 'link',
- 'application/km' => 'mindmap',
- 'application/x-freemind' => 'mindmap',
- 'application/vnd.xmind.workbook' => 'mindmap'
- ]);
-
- $this->mimeTypeDetector
- ->expects($this->once())
- ->method('getAllAliases')
- ->willReturn(
- [
- '_comment' => 'Array of mimetype aliases.',
- '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.',
- '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud',
- '_comment4' => 'After any change to mimetypealiases.json run:',
- '_comment5' => './occ maintenance:mimetype:update-js',
- '_comment6' => 'Otherwise your update won\'t propagate through the system.',
- 'application/coreldraw' => 'image',
- 'application/test' => 'image',
- 'application/epub+zip' => 'text',
- 'application/font-sfnt' => 'image',
- 'application/font-woff' => 'image',
- 'application/gpx+xml' => 'location',
- 'application/illustrator' => 'image',
- 'application/javascript' => 'text/code',
- 'application/json' => 'text/code',
- 'application/msaccess' => 'file',
- 'application/msexcel' => 'x-office/spreadsheet',
- 'application/msonenote' => 'x-office/document',
- 'application/mspowerpoint' => 'x-office/presentation',
- 'application/msword' => 'x-office/document',
- 'application/octet-stream' => 'file',
- 'application/postscript' => 'image',
- 'application/rss+xml' => 'application/xml',
- 'application/vnd.android.package-archive' => 'package/x-generic',
- 'application/vnd.lotus-wordpro' => 'x-office/document',
- 'application/vnd.garmin.tcx+xml' => 'location',
- 'application/vnd.google-earth.kml+xml' => 'location',
- 'application/vnd.google-earth.kmz' => 'location',
- 'application/vnd.ms-excel' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.addin.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.binary.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.sheet.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-excel.template.macroEnabled.12' => 'x-office/spreadsheet',
- 'application/vnd.ms-fontobject' => 'image',
- 'application/vnd.ms-powerpoint' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.addin.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.presentation.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-powerpoint.template.macroEnabled.12' => 'x-office/presentation',
- 'application/vnd.ms-visio.drawing.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.drawing' => 'application/vnd.visio',
- 'application/vnd.ms-visio.stencil.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.stencil' => 'application/vnd.visio',
- 'application/vnd.ms-visio.template.macroEnabled.12' => 'application/vnd.visio',
- 'application/vnd.ms-visio.template' => 'application/vnd.visio',
- 'application/vnd.ms-word.document.macroEnabled.12' => 'x-office/document',
- 'application/vnd.ms-word.template.macroEnabled.12' => 'x-office/document',
- 'application/vnd.oasis.opendocument.presentation' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.presentation-template' => 'x-office/presentation',
- 'application/vnd.oasis.opendocument.spreadsheet' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.spreadsheet-template' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.text' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-master' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-template' => 'x-office/document',
- 'application/vnd.oasis.opendocument.graphics' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.graphics-template' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.text-web' => 'x-office/document',
- 'application/vnd.oasis.opendocument.text-flat-xml' => 'x-office/document',
- 'application/vnd.oasis.opendocument.spreadsheet-flat-xml' => 'x-office/spreadsheet',
- 'application/vnd.oasis.opendocument.graphics-flat-xml' => 'x-office/drawing',
- 'application/vnd.oasis.opendocument.presentation-flat-xml' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'x-office/presentation',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'x-office/spreadsheet',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'x-office/document',
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'x-office/document',
- 'application/vnd.visio' => 'x-office/document',
- 'application/vnd.wordperfect' => 'x-office/document',
- 'application/x-7z-compressed' => 'package/x-generic',
- 'application/x-bzip2' => 'package/x-generic',
- 'application/x-cbr' => 'text',
- 'application/x-compressed' => 'package/x-generic',
- 'application/x-dcraw' => 'image',
- 'application/x-deb' => 'package/x-generic',
- 'application/x-fictionbook+xml' => 'text',
- 'application/x-font' => 'image',
- 'application/x-gimp' => 'image',
- 'application/x-gzip' => 'package/x-generic',
- 'application/x-iwork-keynote-sffkey' => 'x-office/presentation',
- 'application/x-iwork-numbers-sffnumbers' => 'x-office/spreadsheet',
- 'application/x-iwork-pages-sffpages' => 'x-office/document',
- 'application/x-mobipocket-ebook' => 'text',
- 'application/x-perl' => 'text/code',
- 'application/x-photoshop' => 'image',
- 'application/x-php' => 'text/code',
- 'application/x-rar-compressed' => 'package/x-generic',
- 'application/x-tar' => 'package/x-generic',
- 'application/x-tex' => 'text',
- 'application/xml' => 'text/html',
- 'application/yaml' => 'text/code',
- 'application/zip' => 'package/x-generic',
- 'database' => 'file',
- 'httpd/unix-directory' => 'dir',
- 'text/css' => 'text/code',
- 'text/csv' => 'x-office/spreadsheet',
- 'text/html' => 'text/code',
- 'text/x-c' => 'text/code',
- 'text/x-c++src' => 'text/code',
- 'text/x-h' => 'text/code',
- 'text/x-java-source' => 'text/code',
- 'text/x-ldif' => 'text/code',
- 'text/x-python' => 'text/code',
- 'text/x-shellscript' => 'text/code',
- 'web' => 'text/code',
- 'application/internet-shortcut' => 'link',
- 'application/km' => 'mindmap',
- 'application/x-freemind' => 'mindmap',
- 'application/vnd.xmind.workbook' => 'mindmap'
- ]);
-
$this->environmentHelper
->expects($this->any())
->method('getServerRoot')
->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified');
- $signatureDataFile = '{
- "hashes": {
- "core\/js\/mimetypelist.js": "94195a260a005dac543c3f6aa504f1b28e0078297fe94a4f52f012c16c109f0323eecc9f767d6949f860dfe454625fcaf1dc56f87bb8350975d8f006bbbdf14a"
- },
- "signature": "BYPMrU+2vzSOOjSFcRPsWphv0uXQ+Vu6yC7FL6V0iM4WXcAkTK1e5OjkHFqUBNIDxg0AWB14ogUFRGDr+Qh+AqDRaX1u2ST2BhO1mgVh4JaqVOhlnDgWg8NPRMaVqvMy6Rfmyj57D1vmDmbVGQmnaIxEot84mOx4MP6sgZIVOMEe2itlmNwp1ogG6t61wpj4dFe73tYPDePWh0j+TmW8a\/Ry67wIhWHHhSGWIhhYRi8NmfW0oLhL1tgze5+Oo4pvgIgJq47BOYGu4YnfY3w8PB\/sQ5bPIvd\/+CTt\/1RASoadEfLd0MjLFEVEAj3uVGMq1kv7gK4bisXrKJS\/dbC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\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
-}';
- $this->fileAccessHelper
- ->expects($this->at(0))
- ->method('file_get_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json'
- )
- ->willReturn($signatureDataFile);
+
+ $signatureDataFile = file_get_contents(__DIR__ .'/../../data/integritycheck/mimetypeListModified/core/signature.json');
$this->fileAccessHelper
- ->expects($this->at(1))
->method('file_get_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt'
- )
- ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
+ ->willReturnMap([
+ [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile],
+ [\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')],
+ ]);
$this->assertSame([], $this->checker->verifyCoreSignature());
}