mirror of
https://github.com/sorenpeter/timeline.git
synced 2025-12-15 10:57:01 +00:00
feat(session): add validation for minimum length in secret_key
This commit is contained in:
parent
1769eeb831
commit
57737e8cd4
2 changed files with 8 additions and 4 deletions
|
|
@ -9,6 +9,10 @@ if (!empty($missing_keys)) {
|
||||||
die('Missing required keys in config.ini: ' . implode(', ', $missing_keys));
|
die('Missing required keys in config.ini: ' . implode(', ', $missing_keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strlen($config['secret_key']) < 32) {
|
||||||
|
die('Secret key in config.ini must be at least 32 characters long');
|
||||||
|
}
|
||||||
|
|
||||||
const COOKIE_NAME = 'timeline_login';
|
const COOKIE_NAME = 'timeline_login';
|
||||||
const ENCRYPTION_METHOD = 'aes-256-cbc';
|
const ENCRYPTION_METHOD = 'aes-256-cbc';
|
||||||
const EXPIRATION_DAYS = 30;
|
const EXPIRATION_DAYS = 30;
|
||||||
|
|
@ -113,7 +117,7 @@ function saveLogin() {
|
||||||
|
|
||||||
function isSavedCookieValid() {
|
function isSavedCookieValid() {
|
||||||
$cookieExpiry = getCookieData();
|
$cookieExpiry = getCookieData();
|
||||||
|
|
||||||
if ($cookieExpiry === false) {
|
if ($cookieExpiry === false) {
|
||||||
deletePersistentCookie();
|
deletePersistentCookie();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ webmentions_txt_path = "./mentions.txt"
|
||||||
public_webmentions = "https://example.com/timeline/mentions.txt"
|
public_webmentions = "https://example.com/timeline/mentions.txt"
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
; Secret key to encrypt cookies
|
; Secret key to encrypt cookies of at least 256-bit (32 characters)
|
||||||
; Create a new one here: https://randomkeygen.com
|
; Create one here: https://randomkeygen.com (CodeIgniter Encryption Keys)
|
||||||
secret_key = "553GkZzIYZKx5z0lftt4yKDG4aKb4sAG"
|
secret_key = ""
|
||||||
|
|
||||||
; Simple password
|
; Simple password
|
||||||
password = "change_me"
|
password = "change_me"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue