From 5f9ab96f03c06c6b8bc8b0410881b9a1e30dcfca Mon Sep 17 00:00:00 2001 From: Christoph Schaefer Date: Mon, 17 Aug 2026 10:38:00 +0200 Subject: [PATCH] fix(config): mask the Euro-Office jwt_secret as sensitive Both sensitive-key allowlists carried an `onlyoffice` entry but nothing for `eurooffice`, so the document server signing key was printed in full while the ONLYOFFICE one next to it was redacted. SystemConfig covers `occ config:list system`, which is where the key lands when the app is configured through config.php. AppConfig covers plain `occ config:list` and the admin support report, which is where it lands when it is set through the app's own settings page. Fixes: #63302 Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Christoph Schaefer --- lib/private/AppConfig.php | 3 ++ lib/private/SystemConfig.php | 3 ++ tests/lib/AppConfigTest.php | 31 +++++++++++++++++++++ tests/lib/SystemConfigTest.php | 50 ++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 tests/lib/SystemConfigTest.php diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index ea4394677fa73..63d409e03b054 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -1615,6 +1615,9 @@ private function getSensitiveKeys(string $app): array { 'call_summary_bot' => [ '/^secret_(.*)$/', ], + 'eurooffice' => [ + '/^jwt_secret$/', + ], 'external' => [ '/^sites$/', '/^jwt_token_privkey_(.*)$/', diff --git a/lib/private/SystemConfig.php b/lib/private/SystemConfig.php index 4c6f9d19f83f7..b6b5ccb73ffa7 100644 --- a/lib/private/SystemConfig.php +++ b/lib/private/SystemConfig.php @@ -107,6 +107,9 @@ class SystemConfig { ], ], ], + 'eurooffice' => [ + 'jwt_secret' => true, + ], 'onlyoffice' => [ 'jwt_secret' => true, ], diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index 4c75d6637b384..f13314c0b633a 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -202,4 +202,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')); + } } diff --git a/tests/lib/SystemConfigTest.php b/tests/lib/SystemConfigTest.php new file mode 100644 index 0000000000000..e08922ddd3955 --- /dev/null +++ b/tests/lib/SystemConfigTest.php @@ -0,0 +1,50 @@ +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')); + } +}