19 Commits
Author SHA1 Message Date
Rodrigo Cortés Cano 07b9d500fe FIX: Complete search and account-form follow-ups from #1165 (#1188)
thanks @TrapoSAMA
2026-11-12 19:39:49 +00:00
Rodrigo Cortés Cano 3feeb081af Escape security lists and make template escaping opt-outs explicit (#1172)
fixes potential XSS issue with TOTP exception lists (which need escaping, see also #1185). 

refactors Template escaping to use TemplateEscape enum (rather than the previous boolean).

thanks @TrapoSAMA
2026-11-01 10:41:54 +00:00
David Goodwin ae85e51f6e Security fixes (master only) (#1165)
Someone wishing to remain anonymous emailed @cboltz a number of security issues, summarised below.

1. fix sql injection bug in getPageBrowser - search keys bypass the field filter, due to 2a6f27c3 / #1127
2. when performing a password change, do not start the session before the new password has been validated for compexity etc - as things stand someone with a recovery code gets logged in even if their password gets
rejected. Also invalid recovery code on failure.
3. broadcast-message.php was using smtp_mail() with incorrect args, and passing the SMTP password in as the mail body. - probably related to commit 7f1d78e and 42a664e9c2
4. a regular (non-admin) user could submit an arbitrary username in the POST data and create/edit a TOTP exception for another user or entire domain

PR includes refactoring of the password change code (into PasswordChangeAttempt) to make it easier to test/verify.
2026-10-17 09:27:59 +01:00
Fredrik Boström 1024befd39 Fix pw recovery without totp (#1032)
Check if user has TOTP active, if so display input field in pw-change form and evaluate it.
2026-05-23 14:34:42 +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 52794bede7 misc fixes for psalm after allowing it to be updated 2026-01-28 09:50:26 +00:00
David Goodwin 460c624275 remove more references to sourceforge 2025-07-13 18:29:37 +01:00
David Goodwin 759304ecb8 apparently these all need reformatting 2024-12-05 14:33:41 +00:00
David Goodwin 56dd787ce2 when going through password recovery, only wipe the recovery token after the user has updated their password
see https://github.com/postfixadmin/postfixadmin/issues/550
2024-05-17 22:02:01 +01:00
David Goodwin 2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
David Goodwin ef36710ea7 print a better error message when password change is blocked 2022-06-11 09:03:03 +01:00
David Goodwin 829b27fc20 re-fix password-change 2021-01-21 13:54:53 +00:00
David Goodwin 70bf59edc4 composer format; fix syntax issue; comment out code in model/Login which fails psalm check 2021-01-14 22:22:27 +00:00
BotoX c6ae3ea2f3 Suport for dovecot mail-crypt-plugin via new mailbox_postpassword_script hook.
Uses doveadm mailbox cryptokey on create user / password change to adjust user encryption key.
https://doc.dovecot.org/configuration_manual/mail_crypt_plugin/
2021-01-11 21:07:45 +01:00
David Goodwin c7850b78eb fix bootstrap theme for users/ urls; make some other links use https. 2021-01-07 20:34:06 +00:00
David Goodwin f6f62180e8 remove some global variables 2020-09-27 11:02:58 +01:00
David Goodwin 3c7da4f3b8 Refactor some methods
PFAHandler::store() -> PFAHandler::save();
 PFAHandler::storemore() -> PFAHandler::postSave();
 PFAHandler::beforestore() -> PFAHandler::preSave();
2020-09-25 21:29:45 +01:00
David Goodwin c3b87ebb11 phpcs fixes 2018-01-26 19:58:35 +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