mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
Revert "Migrate code integrity to SetupCheck API"
This reverts commit aa2d315d95d37b48752d0e92d0ce79913be1d4f1. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
0fd5ed9854
commit
00d3856b92
8 changed files with 34 additions and 68 deletions
|
|
@ -74,7 +74,6 @@ return array(
|
|||
'OCA\\Settings\\Settings\\Personal\\Security\\WebAuthn' => $baseDir . '/../lib/Settings/Personal/Security/WebAuthn.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => $baseDir . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\CheckUserCertificates' => $baseDir . '/../lib/SetupChecks/CheckUserCertificates.php',
|
||||
'OCA\\Settings\\SetupChecks\\CodeIntegrity' => $baseDir . '/../lib/SetupChecks/CodeIntegrity.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => $baseDir . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => $baseDir . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => $baseDir . '/../lib/SetupChecks/FileLocking.php',
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ class ComposerStaticInitSettings
|
|||
'OCA\\Settings\\Settings\\Personal\\Security\\WebAuthn' => __DIR__ . '/..' . '/../lib/Settings/Personal/Security/WebAuthn.php',
|
||||
'OCA\\Settings\\Settings\\Personal\\ServerDevNotice' => __DIR__ . '/..' . '/../lib/Settings/Personal/ServerDevNotice.php',
|
||||
'OCA\\Settings\\SetupChecks\\CheckUserCertificates' => __DIR__ . '/..' . '/../lib/SetupChecks/CheckUserCertificates.php',
|
||||
'OCA\\Settings\\SetupChecks\\CodeIntegrity' => __DIR__ . '/..' . '/../lib/SetupChecks/CodeIntegrity.php',
|
||||
'OCA\\Settings\\SetupChecks\\DefaultPhoneRegionSet' => __DIR__ . '/..' . '/../lib/SetupChecks/DefaultPhoneRegionSet.php',
|
||||
'OCA\\Settings\\SetupChecks\\EmailTestSuccessful' => __DIR__ . '/..' . '/../lib/SetupChecks/EmailTestSuccessful.php',
|
||||
'OCA\\Settings\\SetupChecks\\FileLocking' => __DIR__ . '/..' . '/../lib/SetupChecks/FileLocking.php',
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ use OCA\Settings\Search\AppSearch;
|
|||
use OCA\Settings\Search\SectionSearch;
|
||||
use OCA\Settings\Search\UserSearch;
|
||||
use OCA\Settings\SetupChecks\CheckUserCertificates;
|
||||
use OCA\Settings\SetupChecks\CodeIntegrity;
|
||||
use OCA\Settings\SetupChecks\DefaultPhoneRegionSet;
|
||||
use OCA\Settings\SetupChecks\EmailTestSuccessful;
|
||||
use OCA\Settings\SetupChecks\FileLocking;
|
||||
|
|
@ -57,9 +56,9 @@ use OCA\Settings\SetupChecks\InternetConnectivity;
|
|||
use OCA\Settings\SetupChecks\LegacySSEKeyFormat;
|
||||
use OCA\Settings\SetupChecks\MemcacheConfigured;
|
||||
use OCA\Settings\SetupChecks\PhpDefaultCharset;
|
||||
use OCA\Settings\SetupChecks\PhpModules;
|
||||
use OCA\Settings\SetupChecks\PhpFreetypeSupport;
|
||||
use OCA\Settings\SetupChecks\PhpGetEnv;
|
||||
use OCA\Settings\SetupChecks\PhpModules;
|
||||
use OCA\Settings\SetupChecks\PhpOutdated;
|
||||
use OCA\Settings\SetupChecks\PhpOutputBuffering;
|
||||
use OCA\Settings\SetupChecks\RandomnessSecure;
|
||||
|
|
@ -157,7 +156,6 @@ class Application extends App implements IBootstrap {
|
|||
);
|
||||
});
|
||||
$context->registerSetupCheck(CheckUserCertificates::class);
|
||||
$context->registerSetupCheck(CodeIntegrity::class);
|
||||
$context->registerSetupCheck(DefaultPhoneRegionSet::class);
|
||||
$context->registerSetupCheck(EmailTestSuccessful::class);
|
||||
$context->registerSetupCheck(FileLocking::class);
|
||||
|
|
|
|||
|
|
@ -736,6 +736,8 @@ Raw output
|
|||
'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(),
|
||||
'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
|
||||
'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(),
|
||||
'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(),
|
||||
'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'),
|
||||
'OpcacheSetupRecommendations' => $this->getOpcacheSetupRecommendations(),
|
||||
'isSettimelimitAvailable' => $this->isSettimelimitAvailable(),
|
||||
'missingPrimaryKeys' => $this->hasMissingPrimaryKeys(),
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @author Côme Chilliet <come.chilliet@nextcloud.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
namespace OCA\Settings\SetupChecks;
|
||||
|
||||
use OC\IntegrityCheck\Checker;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\SetupCheck\ISetupCheck;
|
||||
use OCP\SetupCheck\SetupResult;
|
||||
|
||||
class CodeIntegrity implements ISetupCheck {
|
||||
public function __construct(
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private Checker $checker,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->l10n->t('Code integrity');
|
||||
}
|
||||
|
||||
public function getCategory(): string {
|
||||
return 'security';
|
||||
}
|
||||
|
||||
public function run(): SetupResult {
|
||||
if (!$this->checker->isCodeCheckEnforced()) {
|
||||
return SetupResult::info($this->l10n->t('Integrity checker has been disabled. Integrity cannot be verified.'));
|
||||
} elseif ($this->checker->hasPassedCheck()) {
|
||||
return SetupResult::success($this->l10n->t('No altered files'));
|
||||
} else {
|
||||
// FIXME: If setup check can link to settings pages this should link to /settings/integrity/failed and /settings/integrity/rescan?requesttoken=TOKEN
|
||||
return SetupResult::error(
|
||||
$this->l10n->t('Some files have not passed the integrity check.'),
|
||||
$this->urlGenerator->linkToDocs('admin-code-integrity')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -432,6 +432,8 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'forwardedForHeadersWorking' => false,
|
||||
'reverseProxyDocs' => 'reverse-proxy-doc-link',
|
||||
'isCorrectMemcachedPHPModuleInstalled' => true,
|
||||
'hasPassedCodeIntegrityCheck' => true,
|
||||
'codeIntegrityCheckerDocumentation' => 'http://docs.example.org/server/go.php?to=admin-code-integrity',
|
||||
'OpcacheSetupRecommendations' => ['recommendation1', 'recommendation2'],
|
||||
'isSettimelimitAvailable' => true,
|
||||
'isSqliteUsed' => false,
|
||||
|
|
|
|||
|
|
@ -246,6 +246,16 @@
|
|||
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
|
||||
});
|
||||
}
|
||||
if(!data.hasPassedCodeIntegrityCheck) {
|
||||
messages.push({
|
||||
msg: t('core', 'Some files have not passed the integrity check. Further information on how to resolve this issue can be found in the {linkstart1}documentation ↗{linkend}. ({linkstart2}List of invalid files…{linkend} / {linkstart3}Rescan…{linkend})')
|
||||
.replace('{linkstart1}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.codeIntegrityCheckerDocumentation + '">')
|
||||
.replace('{linkstart2}', '<a href="' + OC.generateUrl('/settings/integrity/failed') + '">')
|
||||
.replace('{linkstart3}', '<a href="' + OC.generateUrl('/settings/integrity/rescan?requesttoken={requesttoken}', {'requesttoken': OC.requestToken}) + '">')
|
||||
.replace(/{linkend}/g, '</a>'),
|
||||
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
|
||||
});
|
||||
}
|
||||
if(data.OpcacheSetupRecommendations.length > 0) {
|
||||
var listOfOPcacheRecommendations = "";
|
||||
data.OpcacheSetupRecommendations.forEach(function(element){
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -281,6 +282,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -335,6 +337,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -389,6 +392,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: false,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -441,6 +445,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -496,6 +501,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
forwardedForHeadersWorking: false,
|
||||
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -551,6 +557,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
forwardedForHeadersWorking: true,
|
||||
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -604,6 +611,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
forwardedForHeadersWorking: true,
|
||||
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: false,
|
||||
missingIndexes: [],
|
||||
|
|
@ -657,6 +665,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
forwardedForHeadersWorking: true,
|
||||
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -729,6 +738,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -788,6 +798,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: ['recommendation1', 'recommendation2'],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -840,6 +851,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -896,6 +908,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -949,6 +962,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -999,6 +1013,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -1052,6 +1067,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -1105,6 +1121,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -1157,6 +1174,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
@ -1216,6 +1234,7 @@ describe('OC.SetupChecks tests', function() {
|
|||
isFairUseOfFreePushService: true,
|
||||
forwardedForHeadersWorking: true,
|
||||
isCorrectMemcachedPHPModuleInstalled: true,
|
||||
hasPassedCodeIntegrityCheck: true,
|
||||
OpcacheSetupRecommendations: [],
|
||||
isSettimelimitAvailable: true,
|
||||
missingIndexes: [],
|
||||
|
|
|
|||
Loading…
Reference in a new issue