aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSeungmin Kim <8457324+ehfd@users.noreply.github.com>2024-12-01 22:43:08 +0900
committerSeungmin Kim <8457324+ehfd@users.noreply.github.com>2024-12-17 09:35:54 +0900
commit041eca9b27778ae639e8b11825991f07b3ff4bc4 (patch)
treeaeb93b441738ce119024ca619d2e69d31e3f4165 /core
parente17f011f08cb4529ae19ff8637a49b7f4e89f216 (diff)
downloadnextcloud-server-041eca9b27778ae639e8b11825991f07b3ff4bc4.tar.gz
nextcloud-server-041eca9b27778ae639e8b11825991f07b3ff4bc4.zip
fix(occ): Fix `occ integrity:check-app` and Admin panel "rescan" deliver inconsistent results
Signed-off-by: Seungmin Kim <8457324+ehfd@users.noreply.github.com>
Diffstat (limited to 'core')
-rw-r--r--core/Command/Integrity/CheckApp.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php
index d24b80a4764..ce658ec16da 100644
--- a/core/Command/Integrity/CheckApp.php
+++ b/core/Command/Integrity/CheckApp.php
@@ -9,6 +9,8 @@ namespace OC\Core\Command\Integrity;
use OC\Core\Command\Base;
use OC\IntegrityCheck\Checker;
+use OC\IntegrityCheck\Helpers\AppLocator;
+use OC\IntegrityCheck\Helpers\FileAccessHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -22,6 +24,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class CheckApp extends Base {
public function __construct(
private Checker $checker,
+ private AppLocator $appLocator,
+ private FileAccessHelper $fileAccessHelper,
) {
parent::__construct();
}
@@ -43,14 +47,19 @@ class CheckApp extends Base {
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$appid = $input->getArgument('appid');
- $path = (string)$input->getOption('path');
- $result = $this->checker->verifyAppSignature($appid, $path, true);
- $this->writeArrayInOutputFormat($input, $output, $result);
- if (count($result) > 0) {
- $output->writeln('<error>' . count($result) . ' errors found</error>', OutputInterface::VERBOSITY_VERBOSE);
- return 1;
+ $path = (string)$input->getOption('path') ?? $this->appLocator->getAppPath($appid);
+ if ($this->fileAccessHelper->file_exists($path . '/appinfo/signature.json')) {
+ // Only verify if the application explicitly ships a signature.json file
+ $result = $this->checker->verifyAppSignature($appid, $path, true);
+ $this->writeArrayInOutputFormat($input, $output, $result);
+ if (count($result) > 0) {
+ $output->writeln('<error>' . count($result) . ' errors found</error>', OutputInterface::VERBOSITY_VERBOSE);
+ return 1;
+ }
+ $output->writeln('<info>No errors found</info>', OutputInterface::VERBOSITY_VERBOSE);
+ } else {
+ $output->writeln('<info>App signature not found, skipping app integrity check</info>', OutputInterface::VERBOSITY_VERBOSE);
}
- $output->writeln('<info>No errors found</info>', OutputInterface::VERBOSITY_VERBOSE);
return 0;
}
}