Commit Graph
128 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
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
David Goodwin 97e17c41c1 allow users to configure a closure (anonymous function) as a *_struct_hook config setting as well
previously we required a named function, see #1069
2026-07-05 20:06:17 +01:00
Copilot ae7339afd4 Use native booleans for prepared SQL params; stop binding db_get_boolean() values (#1019)
Prepared statements were binding DB-specific boolean literals (`'t'/'f'`) produced by `db_get_boolean()`, which breaks PostgreSQL parameter typing in some paths (notably mailbox creation via handler flows). 

This change standardizes bound boolean parameters to native PHP `true`/`false` (which are then cast to 0/1 which seems to work fine within PDO/PostgreSQL).

fixes https://github.com/postfixadmin/postfixadmin/issues/1017
2026-04-23 19:28:01 +01:00
Kent Riboe 8e6a4f0f4b Add developer documentation for Handler classes, update PFAHandler::pacol() params (#1008)
Add DOCUMENTS/HANDLER_CLASSES.md which attempts to document how the Handler classes work and help future developers/contributors. 

Changes spec of PFAHandler::pacol() to discourage the 9th parameter (was: multiopt) from being passed as an array (param renamed to not_in_db). Previous behaviour is maintained, but a deprecation error should be triggered.
2026-04-18 10:10:00 +01:00
Kent Riboe 2c0a06f932 Add Exec class to help refactor/reduce duplication of proc_open calls, update phpunit (see note) (#1009)
* code refactoring (adds Exec class to centralise proc_open like calls). 
* bump phpunit to ^11.0, as this is the last release that supports php8.2. Note, there is not (yet?) a phpunit release for php8.2 that fixes PKSA-z3gr-8qht-p93v or PKSA-5jz8-6tcw-pbk4, so ignore them for now in composer.json
2026-04-18 10:05:35 +01:00
Kent Riboe 26530c5d0b Replace escape_string() concatenation with parameterized queries (#1004)
* Replace most escape_string() usages with parameterized queries (reducing the chance of SQL injection), see also #1003 

thanks @knofte
2026-04-06 20:47:34 +01:00
David Goodwin b092017f9b be more explict over what types class properties should be 2026-01-28 09:50:26 +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 0d5edbf099 move pacol() into PFAHandler class, I think it makes more sense for it to be there given the dependency between the two 2025-07-13 10:12:22 +01:00
David Goodwin 798e8b269c Topt app passwords fixes (WIP) (#805)
various improvements to the TOTP code see also:  #802
2025-05-16 20:31:20 +01:00
David Goodwin f3ce7e232d token formatting changes 2024-05-17 22:03:55 +01: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 f01274ec94 try relaxing composer dependencies to allow php8.2 dev support, reformat so composer format passes 2024-04-22 21:02:01 +01:00
Shao Yu-Lung (Allen) 0876c368e4 feat: support Dovecot DIGEST-MD5 (#816)
Add support for dovecot DIGEST-MD5 auth (using : $CONF['pacrypt'] = 'dovecot:DIGEST-MD5') 

This also changes the pacrypt() function to take an optional 3rd argument (username). 
Thanks @bestlong
2024-04-12 09:57:19 +01:00
David Goodwin 6b5801c666 typo fixes 2024-01-05 19:30:16 +00:00
Christian Boltz 4b8027e8e3 rename 'txtlarge' field type to 'txta'
... (think "textarea") to keep the field type name short.

This is a follow-up up https://github.com/postfixadmin/postfixadmin/pull/631#issuecomment-1188336564
2022-07-23 21:22:49 +02:00
David Goodwin d3e101e9d8 Merge remote-tracking branch 'origin/master' into feature/dkim 2022-07-18 08:55:07 +01:00
Adrien Crivelli a97771adfd Automatic code style fixes 2022-07-15 11:29:55 +02:00
David Goodwin 2d6ded2786 PSR2 -> PSR12 formatting 2022-06-28 13:46:11 +01:00
Fredrik Falk 9e73025058 Add Domain Key handling 2022-06-23 20:40:06 +02:00
David Goodwin af2cba2a6c only update the modified field on update 2021-04-13 21:35:06 +01:00
David Goodwin 2edabc3e03 phpcs insists on some brace changes 2021-04-13 21:19:16 +01:00
David Goodwin 823f27b29d phpcs wants to change ... 2021-03-22 09:28:28 +00:00
David Goodwin ff2a7c96d4 update changelog; try and improve tests 2021-01-14 17:07:55 +00:00
Christian Boltz 6663a35bdb PFAHandler: fix backwards compability for store()
... and beforestore() and storemore()

Custom child classes might use the old names, and we should keep them
working (with a deprecation notice in the error log).
2021-01-06 21:18:53 +01:00
David Goodwin 16531534a3 add @deprecated phpdoc 2020-10-02 20:57:55 +01:00
David Goodwin d07d115bd5 fix names .... 2020-10-02 20:56:45 +01:00
David Goodwin 712939eb88 maintain backwards compatability with PFAHAndler::{store(),storemore(),beforestore()} 2020-09-28 21:51:57 +01:00
David Goodwin b8fa60bb8a more type hints / psalm fixes 2020-09-28 20:33:54 +01:00
David Goodwin b868f950bf refactor Login stuff out of Handler classes into Login... add tests 2020-09-25 21:32:53 +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 c3a8875ca6 psalm fixes 2020-08-06 21:10:30 +01:00
David Goodwin e8f27969a3 psalm fixes 2020-06-21 16:44:43 +01:00
David Goodwin 3303f25bcc add some php 7+ array type hints. 2020-03-16 13:11:15 +00:00
David Goodwin 48e236ffc0 use hash_equals for login - see: https://github.com/postfixadmin/postfixadmin/issues/58 2020-03-14 22:04:54 +00:00
David Goodwin 1ad184641d php7.4 / psalm fixes 2020-01-31 16:30:46 +00:00
David Goodwin bcae218cbb composer format time 2019-10-19 21:36:27 +01:00
David Goodwin 87824ef970 psalm fixes/workarounds; require PHP 5.6+ 2019-10-19 20:51:05 +01:00
David Goodwin 4aa3110712 phpdoc/psalm fixes 2019-10-19 20:01:25 +01:00
David Goodwin 80418e6412 try and avoid hitting : https://github.com/postfixadmin/postfixadmin/issues/51 2019-09-14 21:19:39 +01:00
David Goodwin 71402e9051 comment 2019-04-26 11:46:57 +01:00
David Goodwin 045a19ae33 re-format 2019-02-27 14:44:20 +00:00
David Goodwin 7ed57a0cda assume the db updates work if no exception was thrown 2019-02-27 14:44:20 +00:00
David Goodwin 28e687ff5b sqlite does not support NOW(), use a string comparison 2019-02-18 21:11:17 +00:00
David Goodwin 803e2342f8 fix psalm issues; reformat; rename new db functions 2019-01-06 21:32:58 +00:00
David Goodwin 1176c9ce78 reformat; fix some transition bugs 2019-01-06 21:32:58 +00:00
David Goodwin ea33d9951a try migrating to pdo 2019-01-06 21:32:58 +00:00
David Goodwin 4fcdba9cf4 run php-cs-fixer (code reforamt) 2018-12-28 19:31:43 +00:00
David Goodwin 74002bbf57 psalm fixes 2018-12-27 21:43:11 +00:00