mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
proxy-auth: fix check_proxy enforcement and persistence
The proxy IP check was never enforced: ServiceProxyAuth read config key 'proxy_check' but the property is registered as 'check_proxy', so the lookup always returned the default empty string and the else-branch set $sProxyRequest = true unconditionally. The BOOL property also had SetEncrypted(), which caused getDecrypted() to call DecryptFromJSON() on a literal bool and fail with "DecryptFromJSON() invalid $data", so the admin UI never reflected the saved value. BOOLs are stored as plain bools in JSON; switch to Get() and drop SetEncrypted() on the property. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
ed35c8e91e
commit
60ee74c68a
1 changed files with 4 additions and 5 deletions
|
|
@ -6,8 +6,8 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
NAME = 'Proxy Auth',
|
||||
AUTHOR = 'Philipp',
|
||||
URL = 'https://www.mundhenk.org/',
|
||||
VERSION = '0.5',
|
||||
RELEASE = '2024-09-20',
|
||||
VERSION = '0.6',
|
||||
RELEASE = '2026-05-17',
|
||||
REQUIRED = '2.36.1',
|
||||
CATEGORY = 'Login',
|
||||
LICENSE = 'MIT',
|
||||
|
|
@ -84,7 +84,7 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
$sMsg = "ProxyIP: " . $sProxyIP;
|
||||
$oLogger->Write($sMsg, $sLevel, $sPrefix);
|
||||
|
||||
$sProxyCheck = $this->Config()->getDecrypted('plugin', 'proxy_check', '');
|
||||
$sProxyCheck = (bool) $this->Config()->Get('plugin', 'check_proxy', false);
|
||||
$sClientIPs = $this->Manager()->Actions()->Http()->GetClientIP(true);
|
||||
|
||||
/* make sure that remote user is only set by authorized proxy to avoid security risks */
|
||||
|
|
@ -192,8 +192,7 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
->SetLabel('Check Proxy')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||
->SetDescription('Activates check if proxy is connecting')
|
||||
->SetDefaultValue(true)
|
||||
->SetEncrypted(),
|
||||
->SetDefaultValue(true),
|
||||
\RainLoop\Plugins\Property::NewInstance('proxy_ip')
|
||||
->SetLabel('Proxy IPNet')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue