Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rate limit adding new payment methods by user #3679

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Jan 16, 2025

All Submissions:

Changes proposed in this Pull Request:

Building on #3678, improves rate limiting for adding payment methods in My Account.

How to test the changes in this Pull Request:

  1. Check out this branch and enable/connect at least two different payment gateways.
  2. In wp-config.php, define NEWSPACK_CHECKOUT_RATE_LIMIT as something long enough for manual testing like 60 or 90.
  3. As a reader, log in and visit /my-account/add-payment-method to add a new payment method.
  4. Add a new payment method for Stripe using a test Stripe card which will be declined. Confirm that you get a "card was declined" error.
  5. Within the number of seconds defined in step 2, attempt to submit the same or a different card number and confirm that you get an error message:
Screenshot 2025-01-16 at 11 00 19 AM
  1. Within the number of seconds defined in step 2, attempt to submit a new payment method with a different payment gateway and confirm that you get the same error message again.
  2. Wait until after the time limit has elapsed, then try to add a valid card number once more with either payment gateway and confirm that it succeeds.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Jan 16, 2025
@dkoo dkoo self-assigned this Jan 16, 2025
@dkoo dkoo requested a review from a team as a code owner January 16, 2025 18:01
@dkoo dkoo marked this pull request as draft January 23, 2025 15:54
Base automatically changed from feat/rate-limit-checkouts-payment-methods to trunk January 23, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The issue or pull request needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant