mailcow/data/web/inc
Stephen Ritz c17cc8a792 [Web] fix add/time_limited_alias silently discarding requests and validity
Three defects in add/time_limited_alias:

The description was read as $_data['description'] without a guard. When a
client omits it, null is bound to spamalias.description, which is TEXT NOT
NULL, so the insert raises a PDOException. The global exception handler is
terminal, so process_add_return() never echoes anything and the caller sees
HTTP 200 with an empty body while no alias was created. Default it to an
empty string instead.

The validity guard used a single condition whose else branch also caught the
success case, so every valid validity was overwritten with the 8760 hour
default and the parameter did nothing. Only invalid values were rejected.
Nest the range check so a valid value survives.

The OpenAPI spec documented only username and domain, while the code also
reads description, validity and permanent. Spec driven clients therefore
could not construct a working request. Document all three.

spamalias.description is the only NOT NULL description column in the schema,
which is why the same unguarded read in add/domain and add/resource does not
fail, both of those columns are nullable.

This does not change the generic exception handling. A database error is
still swallowed into an empty HTTP 200, and the message the handler builds
carries the raw PDOException, so surfacing it to API clients would need
sanitising first. That is left for a separate change.

Refs #7287

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 15:23:31 -07:00
..
ajax Add MTA-STS support for alias domains (#6972) 2025-12-15 16:29:21 +01:00
lib [Web] Switch QR code generation from external API to local library and fix composer.json/lock mismatch 2026-02-24 11:02:47 +01:00
presets [UI] Corrected Sieve Preset 1 (Fixed Regex) 2024-05-13 15:02:41 +02:00
footer.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
functions.acl.inc.php [Web] Fix permission exception in IdP actions 2025-01-15 12:48:10 +01:00
functions.address_rewriting.inc.php Fix @ prefixing domain rewrite and update localization 2025-02-24 22:36:17 -08:00
functions.admin.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
functions.app_passwd.inc.php Merge pull request #6780 from patschi/fix-pwcomplexity-apppasswds 2025-09-29 11:53:26 +02:00
functions.auth.inc.php [Web] Fix LDAP/Keycloak login TypeError - missing JSON decode for attributes 2026-03-11 09:18:03 +01:00
functions.customize.inc.php [Web] include hostname in default website title 2025-10-06 10:58:35 +02:00
functions.dkim.inc.php dkim: Add support for 3072 and 4096 bit RSA keys (#6365) 2025-03-11 15:30:46 +01:00
functions.docker.inc.php fix: show stopped and failed containers in dashboard and API 2026-02-27 13:41:36 +01:00
functions.domain_admin.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
functions.fail2ban.inc.php [Web] f2b banlist - add http status codes 2023-07-11 10:31:25 +02:00
functions.fwdhost.inc.php add missing access control 2026-03-19 12:41:47 +01:00
functions.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
functions.mailbox.inc.php [Web] fix add/time_limited_alias silently discarding requests and validity 2026-07-14 15:23:31 -07:00
functions.mailq.inc.php
functions.oauth2.inc.php [Web] Various PHP 8 fixes, partly fixes #4219 2021-08-09 08:28:22 +02:00
functions.policy.inc.php [Web] Various PHP 8 fixes, partly fixes #4219 2021-08-09 08:28:22 +02:00
functions.presets.inc.php
functions.pushover.inc.php Added SENDER_ADDRESS and SENDER_NAME as variables for messages 2022-11-17 21:01:18 +01:00
functions.quarantine.inc.php [DB][Web] optimize qhandler by keeping SHA2 in new column qhash (#6556) 2025-08-06 16:02:25 +02:00
functions.quota_notification.inc.php [Web] Feature: Allow copies of quota notifications to be sent via SMTP to internal or external addresses 2021-05-23 13:18:52 +02:00
functions.ratelimit.inc.php [Web] Fix permission exception in IdP actions 2025-01-15 12:48:10 +01:00
functions.rspamd.inc.php [Web] break loop if rspamd_map is valid 2024-04-04 16:29:58 +02:00
functions.tls_policy_maps.inc.php
functions.transports.inc.php [Web] Fix transport validation 2021-08-17 22:07:06 +02:00
header.inc.php Improve template URI escaping and parameter handling 2026-03-19 12:48:43 +01:00
init_db.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
prerequisites.inc.php [Web] Switch QR code generation from external API to local library and fix composer.json/lock mismatch 2026-02-24 11:02:47 +01:00
sessions.inc.php [Web] switch from GET to POST for datatable requests 2026-03-03 08:10:16 +01:00
spf.inc.php [Web] Fix: spf record validation failed with redirect 2021-05-28 23:48:15 +02:00
triggers.admin.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
triggers.domainadmin.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
triggers.global.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
triggers.user.inc.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
twig.inc.php Improve template URI escaping and parameter handling 2026-03-19 12:48:43 +01:00
vars.inc.php Add Uzbek language (#7224) 2026-05-13 16:42:38 +02:00