mailcow/data/web
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
..
admin [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
api [Web] fix add/time_limited_alias silently discarding requests and validity 2026-07-14 15:23:31 -07:00
css [Web] Use absolute paths for flag SVGs 2025-03-26 10:59:56 +01:00
domainadmin [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
fonts
img
inc [Web] fix add/time_limited_alias silently discarding requests and validity 2026-07-14 15:23:31 -07:00
js Fix force_tfa not available in mailbox template #7216 2026-06-07 17:03:52 +02:00
lang Refined wording for displaying of active settings on quarantine page. 2026-07-12 17:22:15 +02:00
oauth
templates Fix force_tfa not available in mailbox template #7216 2026-06-07 17:03:52 +02:00
_rspamderror.php Enable password protection for Redis 2024-11-19 14:25:31 +01:00
_status.502.html
autoconfig.php Fixes issue #6489 2025-12-21 16:56:16 +01:00
autodiscover-json.php
autodiscover.php [Web] Add fail2ban logging to passwordless autodiscover endpoint 2026-03-03 13:24:44 +01:00
edit.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
f2b-banlist.php [Web] remove f2b banlist from json_api.php 2024-11-19 14:13:37 +01:00
favicon.png fixed favicon.png (#6570) 2025-08-06 09:42:43 +02:00
index.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
json_api.php Merge pull request #7089 from mailcow/fix/7039 2026-03-03 15:07:17 +01:00
mobileconfig.php Escape generated password in mobileconfig 2026-05-24 11:52:12 +02:00
mta-sts.php Add MTA-STS support for alias domains (#6972) 2025-12-15 16:29:21 +01:00
qhandler.php
quarantine.php
reset-password.php [Web] Fix password reset 2025-04-01 16:39:15 +02:00
resource.php
robots.txt
sogo-auth.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00
user.php [Web] Add forced 2FA setup and password update enforcement 2026-02-24 10:44:33 +01:00