chore(users): invite email hardening — throttle, dedupe, lowercase (#173)#181
Open
b3lz3but wants to merge 1 commit intocaptainpragmatic:masterfrom
Open
chore(users): invite email hardening — throttle, dedupe, lowercase (#173)#181b3lz3but wants to merge 1 commit intocaptainpragmatic:masterfrom
b3lz3but wants to merge 1 commit intocaptainpragmatic:masterfrom
Conversation
…aptainpragmatic#173) - Add @throttle_classes([BurstAPIThrottle]) to customer_users_create API endpoint so a compromised portal token cannot create users in a loop - Extract send_welcome_email() as a module-level function (single source of truth), replacing byte-for-byte identical _send_welcome_email_secure methods on both service classes with thin delegates - Fix empty company_name producing broken email subject by falling back to customer.name or "your organization" - Lowercase email before DB lookup in both the API and staff views so case-mismatched duplicates get a clean error instead of IntegrityError Addresses captainpragmatic#173 (HIGH + MEDIUM + LOW items). Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
Contributor
Author
|
@mostlyvirtual CI green — rate limiting, deduplication, company_name fallback, and email lowercasing all addressed. Ready for review 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@throttle_classes([BurstAPIThrottle])tocustomer_users_createendpoint. A compromised portal token could previously create users in a loop triggering unbounded email sending.send_welcome_email()as a module-level function. BothSecureUserRegistrationService._send_welcome_email_secureandSecureCustomerUserService._send_welcome_email_securenow delegate to this single source of truth. A bug fix to one now automatically applies to both.customer.nameor"your organization"instead of producing"Account Created for "..lower()the email before DB lookup, soUser@Example.comhits the exists check cleanly instead of passing through to an IntegrityError.Not included (deferred)
_send_welcome_email_secureto public (chore: invite email hardening — throttle, dedup, validation gaps #173 MEDIUM) — kept as thin delegates to avoid breaking callers in other branchesTest plan
Addresses #173
🤖 Generated with Claude Code
Closes #173