Commit Graph

103 Commits

Author SHA1 Message Date
Adrià Casajús 50c130a3a3
Store the latest email_log id in the alias to simplify dashboard query (#2022)
* Store the latest email_log id in the alias to simplify dashboard query

* Fix test

* Add script to migrate users last email_log_id to alias

* Always update the alias last_email_log_id automatically

* Only set the alias_id if it is set

* Fix test with randomization

* Fix notification test

* Also remove explicit set on tests

* Rate limit alias creation to prevent abuse (#2021)

* Rate limit alias creation to prevent abuse

* Limit in secs

* Calculate bucket time

* fix exception

* Tune limits

* Move rate limit config to configuration (#2023)

* Fix dropdown item in header (#2024)

* Add option for admin to stop trial (#2026)

* Fix: if redis is not configured do not enable rate limit (#2027)

* support product IDs for the new Mac app (#2028)

Co-authored-by: Son NK <son@simplelogin.io>

* Add metrics to rate limit (#2029)

* Order domains alphabetically when retrieving them (#2030)

* Removed unused import

* Remove debug info

---------

Co-authored-by: D-Bao <49440133+D-Bao@users.noreply.github.com>
Co-authored-by: Son Nguyen Kim <son.nguyen@proton.ch>
Co-authored-by: Son NK <son@simplelogin.io>
2024-02-15 15:48:02 +01:00
Adrià Casajús 761420ece9
Prevent mailboxes that have been disabled from being used again (#2016)
* Prevent mailboxes that have been disabled from being used again

* Improve test

* Get one user since it will be unique
2024-01-23 14:57:40 +01:00
Adrià Casajús 31896ff262
Replace black and flake8 with ruff (#1943) 2023-11-21 16:42:18 +01:00
Adrià Casajús 6e4f6fe540
Sanitize alias, contacts, mailboxes and users before creating them (#1829)
* Sanitize alias, contacts, mailboxes and users before creating them

* Updated comments and moved crons to run when load is low

* Run the stats at the same time as previously

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-08-03 10:20:25 +02:00
Adrià Casajús 04d92b7f23
Fix: Use MIMEText for text contents (#1801)
* Fix: For badly formatted messages use MIMEText

* Fix: For badly formatted messages use MIMEText

* fix test

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-07-11 16:48:01 +02:00
Adrià Casajús cb900ed057
Fix: For badly formatted messages use MIMEText (#1800)
Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
2023-07-11 16:23:37 +02:00
Adrià Casajús bec8cb2292
Alias domain as contact domain (#1689)
* Use the alias domain for contacts

* Check there are not duplicate emails

* Check also in trash

* Use helper

* Set VERP for the forward phase to the contact domain

* Add pgp_fingerprint as index for contacts

* Removed check trash

* Only use reply domains for sl domains

* Configure via db wether the domain can be used as a reverse_domain

* Fix: typo

* reverse logic

* fix migration

* fix test

---------

Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
Co-authored-by: Son <nguyenkims@users.noreply.github.com>
2023-04-20 12:14:53 +02:00
Son Nguyen Kim 989358af34
Fix empty authorized address (#1423)
* not allow empty authorized address

* check authorized address before adding

* use github for flake8

* fix test
2022-11-15 16:04:31 +01:00
Son Nguyen Kim 753a28e886
handle case msg is string in replace() (#1271)
should fix https://sentry.io/organizations/simplelogin/issues/3563106404/?alert_rule_id=2478639&alert_timestamp=1662404226476&alert_type=email&environment=production&project=1868546&referrer=alert_email
2022-09-07 10:22:11 +02:00
Son Nguyen Kim 192d03fd68
make sure sl_formataddr always return str (#1269) 2022-09-05 15:38:04 +02:00
Son Nguyen Kim 313a928070
Create sl_formataddr to handle unicode for built-in formataddr (#1265)
* Create sl_formataddr to handle unicode for built-in formataddr

* fix circular import
2022-09-05 08:40:24 +02:00
Son 21255866b6 improve test 2022-05-10 14:53:50 +02:00
Son 4dbbc4ed5e add test 2022-05-10 11:23:40 +02:00
Adrià Casajús 9a04376894
Allow sending messages in a background thread 2022-04-28 14:43:24 +02:00
Son Nguyen Kim c14e01839e
Merge pull request #899 from simple-login/add-alias-to-to-header
add alias to To: header if it isn't included in To and Cc header
2022-04-20 09:10:11 +02:00
Son Nguyen Kim 9b624edf11
Merge pull request #901 from simple-login/no-dot-in-reverse-alias
use _ instead of . in reverse alias
2022-04-19 18:24:37 +02:00
Son e136fc8c92 add test 2022-04-19 13:33:31 +02:00
Adrià Casajús bad9202cf8
Calculate proper padding when decoding base32 2022-04-19 10:50:25 +02:00
Son Nguyen Kim 259851a04e
Merge pull request #860 from acasajus/remove-softfail
Generate secure transactional emails from address
2022-04-19 09:28:47 +02:00
Son becde6458b fix test 2022-04-18 11:55:14 +02:00
Son 8dfdac79bf use _ instead of . in reverse alias
to avoid AC_FROM_MANY_DOTS SpamAssassin rule
2022-04-15 17:34:29 +02:00
Son a966665478 refactor test: no hardcode a@b.c, make sure each test has a different user 2022-04-15 16:59:44 +02:00
Adrià Casajús d28980a810
Format 2022-04-14 18:27:20 +02:00
Adrià Casajús 4bcc728222
Merge remote-tracking branch 'origin/master' into remove-softfail
* origin/master: (34 commits)
  fix flake8
  add link to the anti phishing page
  improve email wording
  Move tests
  Only send enum names
  Only send enum name for events intead of the full class.enum
  Also track login and register events from the api routes
  typo
  revert changes
  Added fix for parts that are not messages
  Add missing formatting place
  Revert unwanted changes
  Do not show an error if we receive an unsubscribe from a different address
  Revert changes to pgp_utils
  fix import
  Send newrelic events on login and register
  PR changes
  format
  Move dmarc management to its own file
  ignore VERPTransactional
  ...
2022-04-14 18:25:03 +02:00
Adrià Casajús fc13171f3d
Move tests 2022-04-12 12:51:11 +02:00
Adrià Casajús ca93c8e603
Merge remote-tracking branch 'origin/master' into ac-dmarc-reply-phase
* origin/master:
  Only send enum name for events intead of the full class.enum
  Also track login and register events from the api routes
  typo
  revert changes
  Added fix for parts that are not messages
  Add missing formatting place
  Revert unwanted changes
  Do not show an error if we receive an unsubscribe from a different address
  Revert changes to pgp_utils
  Send newrelic events on login and register
2022-04-12 12:48:46 +02:00
Adrià Casajús c16fd25b2e
Added fix for parts that are not messages 2022-04-11 15:52:31 +02:00
Adrià Casajús b128d64563
Moved spamd check to a custom file and cached the result 2022-04-07 19:17:37 +02:00
Adrià Casajús db06ce0ae6
Create signed email addresses for VERP emails 2022-03-30 16:00:02 +02:00
Adrià Casajús 085c166cb2
Replace 5XX with 2XX for return path that fail SPF check 2022-03-29 15:09:10 +02:00
Adrià Casajús ce6ee1a105
Added checks to get_dmarc_status 2022-03-21 19:13:51 +01:00
Adrià Casajús c9cbaeb460
format 2022-03-21 10:43:17 +01:00
Adrià Casajús e8013f8e0c
Initial parse of rpamd extra headers 2022-03-21 10:43:17 +01:00
Son 350f498b94 lessen alias automatic disable check 2022-03-07 15:50:58 +01:00
Son 71136669e9 return the block reason in should_disable() 2022-03-07 15:44:27 +01:00
george 116fc7114a
Update test_can_be_used_as_personal_email to only skip if using GitHub Actions. 2022-02-06 14:37:46 +00:00
Son 325207d6ba Use InvalidMailboxDomain instead of DISPOSABLE_EMAIL_DOMAINS 2022-01-03 10:33:21 +01:00
Son ebe727dc53 skip test_can_be_used_as_personal_email 2021-10-28 19:00:41 +02:00
Son 8680c0a739 do do not use the ra+ prefix for reverse alias 2021-10-25 14:33:42 +02:00
Son 283a6a530d handle case address.parse can also parse an URL and return UrlAddress 2021-10-17 12:52:59 +02:00
Son 3bdeda3e04 add get_mailbox_bounce_info() 2021-10-14 15:10:16 +02:00
Son 372466ab06 do not use flask-sqlalchemy
- add __tablename__ for all models
- use sa and orm instead of db
- rollback all changes in tests
- remove session in @app.teardown_appcontext
2021-10-12 14:36:47 +02:00
Son Nguyen Kim 41478a5715 replace parseaddr_unicode by parse_full_address 2021-09-10 17:26:14 +02:00
Son Nguyen Kim defd7b159d Fix get_header_unicode: handle the case header contains several parts 2021-09-09 11:47:01 +02:00
Son Nguyen Kim fb29503b81 do not send bounce to IgnoreBounceSender 2021-08-02 11:33:58 +02:00
Son Nguyen Kim e26287a4c7 Revert "disable should_disable() for now"
This reverts commit fb88654d84.
2021-07-14 12:23:02 +02:00
Son Nguyen Kim fb88654d84 disable should_disable() for now 2021-07-13 17:24:28 +02:00
Son Nguyen Kim f97b18e60a fill up EmailLog.alias_id when creating new EmailLog 2021-07-11 12:28:42 +02:00
Son NK 79d0ef8906 Use Postfix queue-id as log message-id 2021-06-04 17:15:59 +02:00
Son NK 73555ad524 generate mail_from during reply phase using BOUNCE_PREFIX_FOR_REPLY_PHASE 2021-05-25 17:59:40 +02:00