Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,9 @@ private function getSensitiveKeys(string $app): array {
'call_summary_bot' => [
'/^secret_(.*)$/',
],
'eurooffice' => [
'/^jwt_secret$/',
],
'external' => [
'/^sites$/',
'/^jwt_token_privkey_(.*)$/',
Expand Down
3 changes: 3 additions & 0 deletions lib/private/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class SystemConfig {
],
],
],
'eurooffice' => [
'jwt_secret' => true,
],
'onlyoffice' => [
'jwt_secret' => true,
],
Expand Down
31 changes: 31 additions & 0 deletions tests/lib/AppConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,35 @@ public function testWritesAreCached(): void {
$config->setValueString('appid', 'first-key', 'new value');
$this->assertSame('new value', $config->getValueString('appid', 'first-key'));
}

public function testFilteredValuesMaskTheEuroOfficeSecret(): void {
$this->localCache->expects(self::atLeastOnce())
->method('get')
->with('OC\\AppConfig')
->willReturn([
'fastCache' => [
'eurooffice' => [
'jwt_secret' => 'a-document-server-signing-key',
'jwt_header' => 'AuthorizationJwt',
],
],
'lazyCache' => [
'eurooffice' => [],
],
'valueTypes' => [
'eurooffice' => [
'jwt_secret' => AppConfig::VALUE_STRING,
'jwt_header' => AppConfig::VALUE_STRING,
],
],
]);

$this->connection->expects(self::never())->method('getQueryBuilder');
$config = $this->getAppConfig(true);

$this->assertSame([
'jwt_secret' => IConfig::SENSITIVE_VALUE,
'jwt_header' => 'AuthorizationJwt',
], $config->getFilteredValues('eurooffice'));
}
}
50 changes: 50 additions & 0 deletions tests/lib/SystemConfigTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace Test;

use OC\Config;
use OC\SystemConfig;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;

/**
* Class SystemConfigTest
*
* @package Test
*/
class SystemConfigTest extends TestCase {
private Config&MockObject $config;

#[\Override]
protected function setUp(): void {
parent::setUp();

$this->config = $this->createMock(Config::class);
}

public function testGetFilteredValueMasksTheEuroOfficeSecret(): void {
$this->config->method('getValue')
->willReturnMap([
['config_extra_sensitive_values', [], []],
['eurooffice', '', [
'editors_check_interval' => 0,
'jwt_secret' => 'a-document-server-signing-key',
'jwt_header' => 'AuthorizationJwt',
]],
]);

$systemConfig = new SystemConfig($this->config);

$this->assertSame([
'editors_check_interval' => 0,
'jwt_secret' => IConfig::SENSITIVE_VALUE,
'jwt_header' => 'AuthorizationJwt',
], $systemConfig->getFilteredValue('eurooffice'));
}
}
Loading