Browse Source

Force run the verification of the signature on occ

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v21.0.0beta7
Joas Schilling 3 years ago
parent
commit
f319660f60
No account linked to committer's email address
2 changed files with 8 additions and 5 deletions
  1. 1
    1
      core/Command/Integrity/CheckApp.php
  2. 7
    4
      lib/private/IntegrityCheck/Checker.php

+ 1
- 1
core/Command/Integrity/CheckApp.php View File

protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appid = $input->getArgument('appid'); $appid = $input->getArgument('appid');
$path = (string)$input->getOption('path'); $path = (string)$input->getOption('path');
$result = $this->checker->verifyAppSignature($appid, $path);
$result = $this->checker->verifyAppSignature($appid, $path, true);
$this->writeArrayInOutputFormat($input, $output, $result); $this->writeArrayInOutputFormat($input, $output, $result);
if (count($result) > 0) { if (count($result) > 0) {
return 1; return 1;

+ 7
- 4
lib/private/IntegrityCheck/Checker.php View File

* @param string $signaturePath * @param string $signaturePath
* @param string $basePath * @param string $basePath
* @param string $certificateCN * @param string $certificateCN
* @param bool $forceVerify
* @return array * @return array
* @throws InvalidSignatureException * @throws InvalidSignatureException
* @throws \Exception * @throws \Exception
*/ */
private function verify(string $signaturePath, string $basePath, string $certificateCN): array {
if (!$this->isCodeCheckEnforced()) {
private function verify(string $signaturePath, string $basePath, string $certificateCN, bool $forceVerify = false): array {
if (!$forceVerify && !$this->isCodeCheckEnforced()) {
return []; return [];
} }


* *
* @param string $appId * @param string $appId
* @param string $path Optional path. If none is given it will be guessed. * @param string $path Optional path. If none is given it will be guessed.
* @param bool $forceVerify
* @return array * @return array
*/ */
public function verifyAppSignature(string $appId, string $path = ''): array {
public function verifyAppSignature(string $appId, string $path = '', bool $forceVerify = false): array {
try { try {
if ($path === '') { if ($path === '') {
$path = $this->appLocator->getAppPath($appId); $path = $this->appLocator->getAppPath($appId);
$result = $this->verify( $result = $this->verify(
$path . '/appinfo/signature.json', $path . '/appinfo/signature.json',
$path, $path,
$appId
$appId,
$forceVerify
); );
} catch (\Exception $e) { } catch (\Exception $e) {
$result = [ $result = [

Loading…
Cancel
Save