Commit Graph

23 Commits

Author SHA1 Message Date
Tanmay Deep Sharma
239c4dcb91 feat: MFA (#12290)
## Linear:
- https://github.com/chatwoot/chatwoot/issues/486

## Description
This PR implements Multi-Factor Authentication (MFA) support for user
accounts, enhancing security by requiring a second form of verification
during login. The feature adds TOTP (Time-based One-Time Password)
authentication with QR code generation and backup codes for account
recovery.

## Type of change

- [ ] New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

- Added comprehensive RSpec tests for MFA controller functionality
- Tested MFA setup flow with QR code generation
- Verified OTP validation and backup code generation
- Tested login flow with MFA enabled/disabled

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2025-09-18 20:19:24 +05:30
Sojan Jose
abe22c8649 fix: Rack-attack disable double Redis pooling (#11545)
Rails 7.1 ships with connection-pooling enabled by default for
`RedisCacheStore` (see rails/rails#45235).
Because we already wrap our Redis clients in our own `ConnectionPool`
($alfred / $velma), the upgrade resulted in a double-wrapped object and
runtime errors such as:

NoMethodError: undefined method `get` for an instance of ConnectionPool

This patch:

* Passes `pool: false` when instantiating `RedisCacheStore` in
`config/initializers/rack_attack.rb`, telling Rails to use the pool we
supply instead of building its own.
* Adds an inline comment explaining the rationale.
* Adds a TODO in `config/initializers/01_redis.rb` suggesting a future
simplification: switch to plain Redis clients and let Rails manage the
pool.

Reference docs:
* rails/rails#45235 – “Enable connection pooling by default for
MemCacheStore and RedisCacheStore” -
https://github.com/rails/rails/pull/45235
* Rails 7.1 Caching Guide – 2.1.1 “Connection Pool Options” (use `pool:
false`) [Ruby on Rails
Guides](https://guides.rubyonrails.org/v7.1/caching_with_rails.html)
2025-05-21 20:00:11 -07:00
Shivam Mishra
6766b706c1 feat: Add support for typing events in webhooks (#11423)
Added support for typing events in webhooks. Two new events are now
available: `conversation_typing_on` and `conversation_typing_off`.


<img width="746" alt="Screenshot 2025-05-08 at 4 50 24 PM"
src="https://github.com/user-attachments/assets/62da7b38-de0f-42c5-84f4-066e653da331"
/>

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
Co-authored-by: Pranav <pranavrajs@gmail.com>
2025-05-08 17:28:35 -07:00
ElvioRibeiro
c73f8aefc5 feat: Allow support for trusted IPs to disable throttling (#11226)
Co-authored-by: Pranav <pranav@chatwoot.com>
2025-05-08 16:10:30 -07:00
Vishnu Narayanan
fa8f1d9b6f fix: throttle reports api endpoint (#10620)
- Throttle reports API requests at the account level
- Throttle reports API requests at the user level for dashboard users as
well as API users

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2025-01-08 15:43:33 +05:30
Pranav
888d3cb3fa chore: Increase the rate limit for contact search (#9256) 2024-04-17 16:59:38 -07:00
Vishnu Narayanan
96b781b7fd fix: throttle contact search endpoint to prevent abuse (#8919)
Throttle contact_search endpoint to prevent abuse/maintain db perf
ref: https://discord.com/channels/897869226579222540/899920096972111883/1206919316402999326
2024-02-13 18:48:11 +05:30
Shivam Mishra
0c35a77d4b feat: Show a confirmation banner if the email is not verified (#8808)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2024-02-02 12:31:29 -08:00
Mazen Khalil
5c9ab21617 fix: Application not loading after setting RACK_ATTACK_LIMIT ENV variable [CW-2587] (#8044) 2023-10-04 15:56:20 +05:30
Shivam Mishra
53d530b815 feat: Add upload under account scope (#7914) 2023-09-19 09:51:54 +05:30
Shivam Mishra
5c74674c2b feat: Update rack attack IP limit (#7866)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2023-09-06 18:56:42 +05:30
Shivam Mishra
9ebabb9832 feat: common attachment endpoint follow-up changes (#7826) 2023-09-01 15:18:48 +07:00
Sojan Jose
2df83276e0 chore: Ability to disable rack attack on widget endpoints (#7729) 2023-08-15 17:44:25 -07:00
Sojan Jose
bfaca851f1 chore: Throttle conversation transcript endpoints (#7155)
- Throttle conversation transcripts to 20 per hour via rack attack

Fixes: https://linear.app/chatwoot/issue/CW-1630/throttle-transcript-endpoint
2023-05-24 19:56:23 +05:30
Sojan Jose
0888596b83 chore: Limit widget endpoint with rack attack (#6465)
ref: https://github.com/chatwoot/chatwoot/issues/1007#issuecomment-1427156094
2023-02-15 20:41:40 -08:00
Sojan Jose
8b659de73d chore: Use connection_pool for redis (#5790)
fixes: #3199
2022-11-02 17:31:20 -07:00
Sojan Jose
9525d4f034 chore: Improve rack-attack configuration (#5389)
fixes: https://github.com/chatwoot/product/issues/540
2022-09-02 23:09:03 +05:30
Vishnu Narayanan
8155024b6a feat: fix logging levels (#4314)
https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html

Fixes https://github.com/chatwoot/chatwoot/issues/4313
2022-03-28 18:14:30 +05:30
Sojan Jose
34e8ad9dc5 feat: Unify user and super admin credentials (#3830)
Fixes: #3061, #3489
2022-01-25 16:58:49 -08:00
Sojan Jose
0e0632be22 chore: Minor Housekeeping tasks (#3169)
- Limit Rack attack to production environments
- Make the long-running data migration optional
2021-10-08 15:45:45 +05:30
Sojan Jose
8c192559fe chore: Rate limits on widget conversation endpoints (#3162)
- Limit widget conversation creation to 6 per 12 hours
- Enable rack attack by default
2021-10-07 18:06:43 +05:30
Sojan Jose
a14f4ede87 chore: Sidebar icons for new inboxes (#3016)
- Sidebar icons for line and telegram inboxes
- Sentry fix for contact IP lookup job
2021-09-15 18:12:56 +05:30
Sojan Jose
b44f9b792b chore: Block & throttle abusive requests (#2706)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-07-27 21:27:23 +05:30