mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-24 18:36:59 +03:00
fix: disallow usage of default password (#3284)
This commit is contained in:
parent
f0e5ef0fc5
commit
a01c1f6ab0
3 changed files with 10 additions and 3 deletions
|
@ -75,8 +75,8 @@ enable = false
|
||||||
|
|
||||||
username = "admin"
|
username = "admin"
|
||||||
|
|
||||||
; This default password is public knowledge. Replace it.
|
; The password cannot be the empty string if authentication is enabled.
|
||||||
password = "7afbf648a369b261"
|
password = ""
|
||||||
|
|
||||||
; This will be used only for actions that require privileged access
|
; This will be used only for actions that require privileged access
|
||||||
access_token = ""
|
access_token = ""
|
||||||
|
|
|
@ -14,6 +14,13 @@
|
||||||
|
|
||||||
final class AuthenticationMiddleware
|
final class AuthenticationMiddleware
|
||||||
{
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if (Configuration::getConfig('authentication', 'password') === '') {
|
||||||
|
throw new \Exception('The authentication password cannot be the empty string');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function __invoke(): void
|
public function __invoke(): void
|
||||||
{
|
{
|
||||||
$user = $_SERVER['PHP_AUTH_USER'] ?? null;
|
$user = $_SERVER['PHP_AUTH_USER'] ?? null;
|
||||||
|
|
|
@ -63,8 +63,8 @@ final class RssBridge
|
||||||
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
|
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
|
||||||
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
|
||||||
|
|
||||||
$authenticationMiddleware = new AuthenticationMiddleware();
|
|
||||||
if (Configuration::getConfig('authentication', 'enable')) {
|
if (Configuration::getConfig('authentication', 'enable')) {
|
||||||
|
$authenticationMiddleware = new AuthenticationMiddleware();
|
||||||
$authenticationMiddleware();
|
$authenticationMiddleware();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue