Commit Graph
176 Commits
Author SHA1 Message Date
Rodrigo Cortés Cano b14e323af7 Add Cancel navigation to create/edit forms and mail composers (#1181)
Create and edit forms currently lack a Cancel action, making administrators and mailbox users rely on browser navigation or menus to abandon changes. The individual and broadcast mail composers have the
same gap.

thanks @TrapoSAMA
2026-11-01 10:44:23 +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
Rodrigo Cortés Cano 8995ee7b55 Support multiple recipient delimiters (#1178)
- treat recipient_delimiter as a set of alternative characters, matching Postfix semantics
- centralize recipient-extension removal so alias status and mailbox classification cannot diverge
- restrict delimiter matching to the local part and document multi-character configuration
- add focused unit and alias-status regression coverage

See #1143
Thanks @TrapoSAMA
2026-10-15 19:26:09 +01:00
Rodrigo Cortés Cano ca76931f06 Allow configurable mailbox user display-name editing (#1177)
add config setting edit_mailbox_name which can be set to allow users to change their name. 

https://github.com/postfixadmin/postfixadmin/issues/1176#issuecomment-6061535053

Thanks @TrapoSAMA & @pvdv
2026-10-15 19:23:51 +01:00
Rodrigo Cortés Cano 01747fda26 Revoke stale XML-RPC authorization across web login and MFA (#1173)
Stop someone sharing a session cookie between xmlrpc and normal logins, and using it to avoid TOTP auth. 

thanks @TrapoSAMA
2026-10-13 17:10:21 +01:00
Rodrigo Cortés Cano 59e02ea7f6 Restore SMTP delivery without authentication (#1174)
fix regression in smtp_mail() so only do SMTP AUTH if $CONF['admin_smtp_password'] is a non-empty string

(used by password recovery, broadcast message, mailbox post-creation etc)


Thanks @TrapoSAMA
2026-10-07 19:39:04 +01:00
Rodrigo Cortés Cano 090ac0c56a Show configured TOTP status and reset action without empty space (#1166)
When TOTP is configured, stop reserving space on the status page for an enable form that isn't needed.

Thanks @TrapoSAMA
2026-10-03 11:26:06 +01:00
Rodrigo Cortés Cano ff0ae9ddbe Clarify alias destination status indicators (#1150)
Alias destinations absent from local records previously shared the misleading “maybe UNDELIVERABLE” indicator, including valid external addresses such as Gmail. The indicator now distinguishes “Check local destination” (red) from “External destination” (blue), with short explanatory tooltips. An alias with both kinds of destinations can show
both indicators.


thanks @TrapoSAMA
2026-10-03 11:20:28 +01:00
Rodrigo Cortés Cano b0fe5db364 Show usage and neutral boxes for unlimited quotas (#1151)
Unlimited mailboxes currently show only the unlimited label, hiding available usage. 
Unlimited domain counters also lose their quota box, and the domain storage label continues to show assigned quota even when actual usage is available.

thanks @TrapoSAMA
2026-10-03 11:16:53 +01:00
masterblaster79 eea8021889 Fix password changes with database prefixes (#1155)
Users changing their mailbox password currently hit an unprefixed `mailbox` table lookup when `database_prefix` is configured, causing the password change to fail even though authentication succeeds.

Fixes: #1154

thanks @masterblaster79
2026-09-27 19:52:14 +01:00
Rodrigo Cortés Cano 24c51277c2 Show inactive domain DNS status in overview (#1146)
Show DNS status for domains to administrators.
Adds new config setting domain_dns_status_check ( 0 - disabled, 1 authoritative zone, 2 usable MX ) 

Document installation, an optional CLI/cron command, permissions, networking, timeouts, and saved-result semantics.

thanks @TrapoSAMA
2026-09-19 15:04:21 +01:00
Rodrigo Cortés Cano e6a0b3a179 Label the virtual address search field (#1148)
The virtual-address overview currently shows a blank search box with
only a hard-coded English tooltip. Add a visible translated placeholder
and an accessible name: "Search mailboxes and aliases..." (Spanish:
"Buscar buzones y alias...").

thanks @TrapoSAMA
2026-09-06 14:26:30 +01:00
Rodrigo Cortés Cano d92137719d Require reauthentication for TOTP removal (#1129)
- require a completed user or admin role before opening TOTP management
- remove TOTP through the existing password-verifying change path
- keep configured post-change hooks active when a secret is removed
- add regression coverage proving an invalid password cannot remove the stored secret

This is the first focused change for #1128.

thanks @TrapoSAMA
2026-09-02 20:23:26 +01:00
Rodrigo Cortés Cano cd67f20b4e Enforce SMTP protocol state (#1132)
Improve SMTP connection handling + writing ( smtp_mail() )

Refs #1128

thanks @TrapoSAMA
2026-09-02 20:14:30 +01:00
Rodrigo Cortés Cano 2c8a8893e9 Enforce TOTP policy for XML-RPC login (#1131)
if a user/mailbox has TOTP enabled, block access via XMLRPC (if it's enabled) as the two aren't compatible.

Part of #1128.

thanks @TrapoSAMA
2026-08-29 20:07:23 +01:00
Rodrigo Cortés Cano 54be5e3828 Fix legacy md5crypt compatibility (#1125)
- restore `md5crypt` as the PostfixAdmin 3.x-compatible alias for MD5-CRYPT
- verify stored unprefixed MD5-CRYPT, prefixed MD5-CRYPT, bcrypt, and SHA512 crypt hashes from their stored format
- document the canonical `MD5-CRYPT` setting, the legacy alias, and the 3.x upgrade implications

This addresses #1123 on `master`. The `postfixadmin_4.0` correction is in #1126 so each maintained branch can be reviewed and tested against its own PHP requirements.

thanks @TrapoSAMA
2026-08-29 15:11:54 +01:00
Rodrigo Cortés Cano 2a6f27c3c4 Use shared pagination in generic lists (#1127)
Extend bootstrap pagination to list.php

#1090, #1093, and this PR cover all three pagination surfaces tracked in #1064.

thanks @TrapoSAMA
2026-08-29 15:09:23 +01:00
Rodrigo Cortés Cano 47667e56ab Scope Roundcube TOTP preference updates (#1133)
Limit the example Roundcube synchronization update to the selected user and disallow object instantiation while decoding stored preferences.

The script also validates its arguments and safely initializes malformed preference data.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:56:57 +01:00
Rodrigo Cortés Cano e638095d58 Harden password recovery requests (#1130)
Require a validated canonical site_url for recovery links, keep responses uniform, and persist a five-minute per-account request limit.

The token update is atomic across supported database engines and performs the same password hashing work for unknown accounts.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:55:49 +01:00
Rodrigo Cortés Cano 314a3242c9 Escape viewlog output by default (#1134)
Render log records through the default output sanitization path and
remove the inline JavaScript interpolation of log data.

Full log data remains available through a native details element without
placing it in a script context.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:51:41 +01:00
Rodrigo Cortés Cano a9b561506d doveadm: accept valid results with stderr warnings (#1121)
When using dovecot: passwords, and calling the doveadm binary,, ignore stderr as long as the exit code is 0.
Switch _pacrypt_dovecot() to use the Exec class (instead of calling proc_popen directly).

fixes #1119

thanks @TrapoSAMA
2026-08-22 15:07:33 +01:00
Rodrigo Cortés Cano 2008d06bf4 Harden language catalog repair and syntax validation (#1114)
Improve language-update.sh script, fix missing semi-colons, cover languages/*.lang in ci with parallel-lint etc.
Fixes #1112 #1113

thanks @TrapoSAMA
2026-08-12 09:07:15 +01:00
Rodrigo Cortés Cano ab0a4d1357 Fix password expiration handling and visibility (#1109)
- validate domain password-expiration policies as whole numbers from 0 through 36500 days
- make password expiration optional and disabled by default
- make 0 consistently mean that passwords in the domain do not expire
- align administrator, recovery, mailbox-user, and XML-RPC password changes
- show each mailbox password-expiration state in lists and CSV output
- add the new labels to every language file
- document how to enable the feature in `config.local.php`

thanks @TrapoSAMA
2026-08-10 09:19:35 +01:00
Rodrigo Cortés Cano 8c6057b54b Distinguish mailbox and domain quota validation errors (#1096)
- distinguish the per-mailbox maximum quota error from insufficient remaining domain quota
- add the domain-quota error message to every language catalog

Thanks @TrapoSAMA
2026-08-02 10:15:08 +01:00
Rodrigo Cortés Cano 4a38010594 Make 3.3 schema reconciliation retry-safe (#1092)
fix regression in MySQL schema upgrade from 3.3 where vacation.domain, vacation.email and quota2.username had the wrong collation.

thanks @TrapoSAMA + @Knofte
2026-07-28 09:27:38 +01:00
Rodrigo Cortés Cano 9a930b61ad Add a read-only database integrity check to setup.php (#1091)
attempt to highlight any orphaned data, see also https://github.com/postfixadmin/postfixadmin/issues/972

thanks @TrapoSAMA
2026-07-24 09:09:03 +01:00
Rodrigo Cortés Cano 852cb6fb39 Test user alias creation guard directly 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 3ab0104d1a Address forwarding editor review feedback 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 8d631d2ce8 Skip internal vacation target validation 2026-07-22 18:13:16 +00:00
Rodrigo Cortés Cano 9a9078ce21 Unify user and admin forwarding editor 2026-07-22 18:13:16 +00:00
David Goodwin 94d8ffcf78 squash merge #1058 - add the ability to bulk delete forwards from the alias list, thanks @knofte
see https://github.com/postfixadmin/postfixadmin/pull/1058
2026-07-07 21:22:33 +01:00
Kent Riboe a400db12dc Add active-status filter to the alias (forwards) list (#1038) (#1056)
Adds a **Forward status: All / Active / Inactive** selector above the
alias (forwards) list in the domain overview (`list-virtual.php`). 

see #1038, thanks @knofte
2026-07-07 20:44:43 +01:00
Kent Riboe 0f68dee15c viewlog: per-page selector + Bootstrap 5 pager, fix footer layout (#1062) (#1063)
Improve pagination on viewlog page (make page size configurable, use bootstrap 5 pager) 

Closes #1062. Thanks @knofte
2026-07-05 20:21:19 +01:00
Kent Riboe d6aabd7745 viewlog: add "All domains" option to the log viewer (#1059) (#1060)
Adds an **"All domains"** option to the View Log domain dropdown, so an
admin managing many domains can see log entries across all of them in
one view instead of picking each domain individually.

Closes #1059.

Thanks @knofte
2026-07-01 16:22:21 +01:00
Justin Warren 2469e045d8 Add 'description' field to alias and alias_domain tables. (#1042)
Adds a `description` field to the `alias` and `alias_domain` tables, so you can add a comment explaining why the alias exists.

Partially addresses #1036

thanks @jpwarren
2026-06-08 09:08:02 +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 2cce49a657 Add tests for db_where_clause() and db_delete() with additional params (#1021)
Adds test coverage for the core query-building functions refactored in #1004:
 - db_where_clause()
 - db_delete()
2026-04-22 13:41:47 +01:00
David Goodwin b420341083 let down by formatting again :( 2026-04-21 09:17:57 +01:00
David Goodwin a762682d7c token test of PFAHandler::col() and 9th param rename from $options to $not_in_db 2026-04-21 09:15:20 +01:00
David Goodwin ca4dae3ffe Phpunit updates (fix phpunit run, should fix build) (#1016)
should fix build, which is currently failing due to a stale phpunit config and poor choice of class name
2026-04-18 10:42:02 +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 c376b56029 Add regression tests for global admin TOTP exception privileges (#1015)
* Add regression tests for global admin privilege check in TOTP exceptions (#1012)

Verifies that global admins with both 'admin' and 'global-admin' roles
can add TOTP exceptions for any domain, while regular admins are
restricted to their managed domains.

* Add tests for db_in_clause(): placeholders, empty array, unique keys, real query

Covers the parameterized query refactor from PR #1004.

* Move test cleanup to tearDown: add admin table delete and session unset

Prevents state leaking between tests, especially when expectException()
aborts the method before inline cleanup runs.

* Use assertEquals with exact expected SQL per review
2026-04-15 21:12:01 +01:00
David Goodwin f88236bf66 fix unit tests - handle booleans in postgresql being different from mysql etc 2026-04-06 20:29:16 +01:00
Kent Riboe 291609ae6f Add phpstan, MySQL and PostgreSQL test jobs to CI (#1005)
* Add phpstan for static analysis.
* Run unit tests against MySQL and PostgreSQL databases

Thanks @knofte
2026-04-06 09:01:44 +01:00
David Goodwin f20d12c16c use db specific boolean in sql (TotpPfTest) 2026-04-03 09:55:49 +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 0e3aa33207 fix test (removal of invalid namespace) 2026-02-28 16:45:34 +00:00
David Goodwin 8ef6bfe603 php 8.2 does not support array const things 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