Commit Graph
76 Commits
Author SHA1 Message Date
David Goodwin 1b55dc96e4 security updates (smarty, phpunit)
move to use smarty/smarty ^5.8.4 (see https://github.com/postfixadmin/postfixadmin/security/dependabot/2),
use phpunit ^11.5.50
use only psalm 6
2026-08-16 10:28:44 +01:00
David Goodwin 8a1f9a11af CSRF protection - support multiple tokens (#985)
possible fix for https://github.com/postfixadmin/postfixadmin/issues/967

CSRF Token changes : rather than have one PFA_Token value in $_SESSION, store a list of them, where each value has a time stamp it was issued on. The aim is to allow the user to have multiple browser tabs open at once - and not have the last tab that loaded trample on others. Tokens expire after 1 hour.

Adds a Smarty helper function `{CSRF_Token}` which will output `<input type=hidden name=CSRF_Token value=asdf123>` or `{CSRF_Token type=url}` which outputs a literal string like 'asdf123' suitable for placing in a URL.

Adds a PHP exception handler in public/common.php, which could be used to display a more friendly error message/response (but at the moment is fairly minimal).

Removes most uses of `die()` within the codebase, and instead moves to throw an exception
2026-03-01 19:30:16 +00:00
David Goodwin b4b0f86df0 fix namespace issue (model\Languages etc) 2026-02-28 19:07:00 +00:00
David Goodwin fe7b013449 rename INSTALL.TXT to INSTALL.md 2026-01-28 09:50:26 +00:00
David Goodwin 2f905d13ee Revert "if templates_c is not writeable fall back to using sys_get_temp_dir() and add a error_log warning"
This reverts commit 5cc95851886d714fd78a3f85bee16243466ec9be.
2026-01-28 09:50:26 +00:00
David Goodwin ff0a3d7636 psalm stuff, add Languages class, token refactor 2026-01-28 09:50:26 +00:00
David Goodwin 19b47d5f17 if templates_c is not writeable fall back to using sys_get_temp_dir() and add a error_log warning 2026-01-28 09:50:26 +00:00
David Goodwin 6754b7a01d improve error handling if vendor/autoload.php does not exist (show a hint to the user etc) 2026-01-28 09:50:26 +00:00
David Goodwin 5f24d12c5f allow the TOTP qr code to render (relax Content Security Policy to allow img-src: self data) 2025-06-11 21:24:25 +01:00
David Goodwin a9215a99fa change project reference 2025-06-01 15:36:50 +01:00
David Goodwin 9620056277 formatting 2025-02-21 09:58:44 +00:00
David Goodwin 0f53b0343b add a lax content-security-policy http header - see #905 2025-02-21 09:55:29 +00:00
David Goodwin 03d5fb4b29 tighten up the cookie used by postfixadmin for PHP sessions - add samesite, httponly and perhaps secure flags, see #903, thanks @gitblacker 2025-02-21 09:11:02 +00:00
David Goodwin f01274ec94 try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
David Goodwin 1988a70489 drop local copy of smarty library; use composer for installation of it; allow smarty 4.x which appears to work and also better supports php8 etc 2022-09-17 10:49:57 +01:00
Adrien Crivelli a97771adfd Automatic code style fixes 2022-07-15 11:29:55 +02:00
David Goodwin e960fa96a0 put some sort of warning if a turkish locale is set - see #541 2022-07-13 21:10:35 +01:00
David Goodwin 0b9b7db917 Merge remote-tracking branch 'origin/master' into feature-improve-pacrypt 2021-09-29 18:04:49 +01:00
David Goodwin 12ed3fba3d avoid a clickjacking attack reported on huntr.dev by @ranjit-git 2021-08-04 20:38:06 +01:00
David Goodwin 2ccda5c26a move to use the composer autoloader 2021-07-07 21:41:59 +01:00
David Goodwin 2edabc3e03 phpcs insists on some brace changes 2021-04-13 21:19:16 +01:00
David Goodwin 2a58056fff be more consistent with how we load common.php, improve comments 2021-03-09 20:34:09 +00:00
David Goodwin b2831d1241 psalm improvements 2021-02-17 21:29:18 +00:00
David Goodwin b8fa60bb8a more type hints / psalm fixes 2020-09-28 20:33:54 +01:00
David Goodwin 484acfbf59 Remove the random_compat lib. 2020-09-27 10:47:22 +01:00
David Goodwin 8754af58cb fix undefined variables (psalm) 2020-03-12 20:45:51 +00:00
David Goodwin 036245063e drop references to magic_quotes; see: https://github.com/postfixadmin/postfixadmin/pull/325 2020-02-10 11:26:23 +00:00
David Goodwin 87824ef970 psalm fixes/workarounds; require PHP 5.6+ 2019-10-19 20:51:05 +01:00
David Goodwin a0b4e690b2 only load random_compat if PHP_VERSION is < 7.0 2019-08-10 21:33:39 +01:00
David Goodwin 7e7f644952 skip this check if unit test 2019-01-03 19:35:33 +00:00
David Goodwin 2b31e71d5c improve error message 2019-01-01 20:39:41 +00:00
David Goodwin 4fcdba9cf4 run php-cs-fixer (code reforamt) 2018-12-28 19:31:43 +00:00
David Goodwin 5d74ff4cc7 only require language if non-empty 2018-12-27 22:01:53 +00:00
David Goodwin 1c4a6080d7 make phar loading optional depending on the extension being present or not 2018-05-25 09:44:20 +01:00
Christian Boltz 05bf2d2013 if unconfigured, recommend to edit config.local.php
... instead of config.inc.php

(idea based on comments on
https://github.com/postfixadmin/postfixadmin/commit/7c38bdd871e31b9bdd7828a7310019a0d36f5807 )
2018-05-06 23:58:01 +02:00
David Goodwin b97decb7c2 add a lib directory; move smarty into it; add random_compat phar (for random_bytes() on PHP < 7) 2018-04-29 20:27:33 +01:00
David Goodwin 9bef45aed5 remove logout behaviour from common.php (never used); try and fix logout in login.php - see #130 2018-02-05 20:47:07 +00:00
Adrien Crivelli 15df6c1d7b Reformat everything with PHP-Cs-Fixer 2018-01-26 23:54:37 +09:00
David Goodwin f0be0ebf62 remove more incpath usages 2018-01-25 21:13:36 +00:00
David Goodwin 99147d51eb move public facing stuff into public/, this allows us to stop exposing templates_c/ etc to the world 2018-01-25 20:27:09 +00:00
Christian Boltz 9df6de65af Finally get rid of variables.inc.php
Initialize $error and $tMailbox where needed.

The other variables in variables.inc.php are already initialized
everywhere.
2017-04-10 20:54:34 +02:00
Christian Boltz 431bd3d810 rename session cookie
With the default PHPSESSID cookie name, there are some rare (and hard to
debug) cases that break logging in if a different application on the
domain also uses a PHPSESSID cookie. See
https://sourceforge.net/p/postfixadmin/bugs/314/ for details.

Using 'postfixadmin_session' as cookie name should fix this.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1846 a1433add-5e2c-0410-b055-b7f2511e0802
2016-05-22 16:57:09 +00:00
David Goodwin 9c022f7e01 merge patch from https://sourceforge.net/p/postfixadmin/bugs/347/ (thank you Eugene Grosbein) - explictly set session_cache_limiter to nocache
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1792 a1433add-5e2c-0410-b055-b7f2511e0802
2015-07-12 12:09:34 +00:00
David Goodwin e39510726a use !empty to avoid error
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1623 a1433add-5e2c-0410-b055-b7f2511e0802
2014-01-14 16:00:42 +00:00
Christian Boltz fbc18ff993 login.php, common.php:
- when login.php is requested, logout the current admin/user
  https://sourceforge.net/p/postfixadmin/bugs/284/



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1568 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-11 00:06:27 +00:00
Christian Boltz 6e2e132bac remove "postfixadmin.com" in comments in lots of files
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1558 a1433add-5e2c-0410-b055-b7f2511e0802
2013-11-10 15:57:32 +00:00
Christian Boltz c6ca4f9bae common.php:
- call Config::write() earlier, because check_language() uses it
- later add $PALANG with Config::write(__LANG)

Thanks to <controlcde> for reporting the results of this bug on IRC
(even if I had to hunt it down to find the reason ;-)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1548 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-31 20:52:45 +00:00
Christian Boltz 4d9a338eb2 After hunting an "undefined index transport" error in list-domain, I
found out that the 'Config' class is too static - it shares its static
data with the 'Lang' child class. 

This caused a conflict because we have $CONF[transport] and 
$PALANG[transport], and Config::read('transport') returned the $PALANG 
text.

To fix this, all texts are now stored as $CONF[__LANG].
I also dropped the 'Lang' class.


model/Config.php:
- mark the 'Config' class as final to ensure we don't trap into the 
  "too static" problem again.
- bool(): display and log an error message if a $CONF option does not
  contain YES or NO (that would have uncovered this bug much earlier)
- add lang() and lang_f() wrapper functions to get $PALANG texts
- remove unused $__cache and $__objects

model/Lang.php:
- deleted

common.php:
- store $PALANG as $CONF[__LANG]

lots of files:
- replace Lang::read() and Lang::read_f() calls with Config::lang()
  and Config::lang_f()




git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1536 a1433add-5e2c-0410-b055-b7f2511e0802
2013-10-13 18:11:18 +00:00
Christian Boltz 631c6e754f common.php:
- move postfixadmin_autoload() and spl_autoload_register upwards
  (it's needed earlier after using the Config class in more functions)
- call Config::write earlier (as soon as $CONF is complete)


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1454 a1433add-5e2c-0410-b055-b7f2511e0802
2013-04-01 22:12:10 +00:00
David Goodwin ecf7757981 Remove getInstance calls; not needed as we use ::write
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1239 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-24 22:25:36 +00:00