Browse Source

Revert default password setting & using "HiddenString" even for empty strings

pull/7358/head
Philipp Holzer 1 week ago
parent
commit
e1d135238a
No account linked to committer's email address

+ 1
- 1
config/defaults.config.php View File

@@ -22,7 +22,7 @@ return [
22 22
 
23 23
 		// pass (String)
24 24
 		// Database user password. Please don't use empty passwords.
25
-		'password' => new \ParagonIE\HiddenString\HiddenString(''),
25
+		'password' => '',
26 26
 
27 27
 		// base (String)
28 28
 		// Database name.

+ 1
- 1
src/Core/Config/Cache/ConfigCache.php View File

@@ -95,7 +95,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
95 95
 
96 96
 		if ($this->hidePasswordOutput &&
97 97
 		    $key == 'password' &&
98
-		    !empty($value) && is_string($value)) {
98
+		    is_string($value)) {
99 99
 			$this->config[$cat][$key] = new HiddenString((string) $value);
100 100
 		} else {
101 101
 			$this->config[$cat][$key] = $value;

+ 3
- 1
tests/src/Core/Config/Cache/ConfigCacheTest.php View File

@@ -4,6 +4,7 @@ namespace Friendica\Test\src\Core\Config\Cache;
4 4
 
5 5
 use Friendica\Core\Config\Cache\ConfigCache;
6 6
 use Friendica\Test\MockedTest;
7
+use ParagonIE\HiddenString\HiddenString;
7 8
 
8 9
 class ConfigCacheTest extends MockedTest
9 10
 {
@@ -322,7 +323,8 @@ class ConfigCacheTest extends MockedTest
322 323
 			]
323 324
 		]);
324 325
 
325
-		$this->assertEmpty($configCache->get('database', 'password'));
326
+		$this->assertNotEmpty($configCache->get('database', 'password'));
327
+		$this->assertInstanceOf(HiddenString::class, $configCache->get('database', 'password'));
326 328
 		$this->assertEmpty($configCache->get('database', 'username'));
327 329
 	}
328 330
 

Loading…
Cancel
Save