summaryrefslogtreecommitdiffstats
path: root/lib/private/integritycheck
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/integritycheck')
-rw-r--r--lib/private/integritycheck/checker.php34
-rw-r--r--lib/private/integritycheck/exceptions/invalidsignatureexception.php2
-rw-r--r--lib/private/integritycheck/helpers/applocator.php2
-rw-r--r--lib/private/integritycheck/helpers/environmenthelper.php11
-rw-r--r--lib/private/integritycheck/helpers/fileaccesshelper.php2
-rw-r--r--lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php2
-rw-r--r--lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php2
7 files changed, 48 insertions, 7 deletions
diff --git a/lib/private/integritycheck/checker.php b/lib/private/integritycheck/checker.php
index baffa9f735b..0cd01df7fe1 100644
--- a/lib/private/integritycheck/checker.php
+++ b/lib/private/integritycheck/checker.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@@ -82,6 +82,34 @@ class Checker {
}
/**
+ * Whether code signing is enforced or not.
+ *
+ * @return bool
+ */
+ public function isCodeCheckEnforced() {
+ // FIXME: Once the signing server is instructed to sign daily, beta and
+ // RCs as well these need to be included also.
+ $signedChannels = [
+ 'stable',
+ ];
+ if(!in_array($this->environmentHelper->getChannel(), $signedChannels, true)) {
+ return false;
+ }
+
+ /**
+ * This config option is undocumented and supposed to be so, it's only
+ * applicable for very specific scenarios and we should not advertise it
+ * too prominent. So please do not add it to config.sample.php.
+ */
+ $isIntegrityCheckDisabled = $this->config->getSystemValue('integrity.check.disabled', false);
+ if($isIntegrityCheckDisabled === true) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* Enumerates all files belonging to the folder. Sensible defaults are excluded.
*
* @param string $folderToIterate
@@ -209,6 +237,10 @@ class Checker {
* @throws \Exception
*/
private function verify($signaturePath, $basePath, $certificateCN) {
+ if(!$this->isCodeCheckEnforced()) {
+ return [];
+ }
+
$signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true);
if(!is_array($signatureData)) {
throw new InvalidSignatureException('Signature data not found.');
diff --git a/lib/private/integritycheck/exceptions/invalidsignatureexception.php b/lib/private/integritycheck/exceptions/invalidsignatureexception.php
index 9e05e5884f5..521171642b2 100644
--- a/lib/private/integritycheck/exceptions/invalidsignatureexception.php
+++ b/lib/private/integritycheck/exceptions/invalidsignatureexception.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
diff --git a/lib/private/integritycheck/helpers/applocator.php b/lib/private/integritycheck/helpers/applocator.php
index b732cb80893..af22fca1fe4 100644
--- a/lib/private/integritycheck/helpers/applocator.php
+++ b/lib/private/integritycheck/helpers/applocator.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
diff --git a/lib/private/integritycheck/helpers/environmenthelper.php b/lib/private/integritycheck/helpers/environmenthelper.php
index d7747dbb966..8bddcb3d794 100644
--- a/lib/private/integritycheck/helpers/environmenthelper.php
+++ b/lib/private/integritycheck/helpers/environmenthelper.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@@ -36,4 +36,13 @@ class EnvironmentHelper {
public function getServerRoot() {
return \OC::$SERVERROOT;
}
+
+ /**
+ * Provides \OC_Util::getChannel()
+ *
+ * @return string
+ */
+ public function getChannel() {
+ return \OC_Util::getChannel();
+ }
}
diff --git a/lib/private/integritycheck/helpers/fileaccesshelper.php b/lib/private/integritycheck/helpers/fileaccesshelper.php
index 23f592122dc..f0bf6576d35 100644
--- a/lib/private/integritycheck/helpers/fileaccesshelper.php
+++ b/lib/private/integritycheck/helpers/fileaccesshelper.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
diff --git a/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php b/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php
index c75554a7cc9..51850852cbd 100644
--- a/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php
+++ b/lib/private/integritycheck/iterator/excludefilebynamefilteriterator.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
diff --git a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
index 43f19475862..efe7c114d9e 100644
--- a/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
+++ b/lib/private/integritycheck/iterator/excludefoldersbypathfilteriterator.php
@@ -2,7 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify