Skip to content

Add payment methods via Stripe#2011

Draft
jim wants to merge 4 commits intomainfrom
jim-stripe-payment-methods
Draft

Add payment methods via Stripe#2011
jim wants to merge 4 commits intomainfrom
jim-stripe-payment-methods

Conversation

@jim
Copy link
Member

@jim jim commented Oct 1, 2025

What it does

Adds a new flow to the UI that allows a user to save payment methods for future use.

Why it is important

We'll want this as a part of organization lending.

Implementation notes

  • I haven't written exhaustive tests for this just yet. I want to get some feedback from staff and talk a little bit more about how we want to leverage this before locking things down too much.
  • The webhook bits are not fully baked yet.

@jim jim marked this pull request as draft October 1, 2025 01:15
@@ -0,0 +1,41 @@
class StripeController < ApplicationController
skip_before_action :verify_authenticity_token

Check failure

Code scanning / CodeQL

CSRF protection weakened or disabled High

Potential CSRF vulnerability due to forgery protection being disabled or weakened.

Copilot Autofix

AI 4 months ago

  • General fix: Restrict the skipping of CSRF protection so that it only applies to the webhook action, not the entire controller.
  • Detailed fix: Change the line skip_before_action :verify_authenticity_token to skip_before_action :verify_authenticity_token, only: :webhook. This way, only the webhook action will skip CSRF checks; all other current (and future) actions will still be protected by default.
  • Specific changes:
    • In app/controllers/stripe_controller.rb, locate line 2 and replace skip_before_action :verify_authenticity_token with skip_before_action :verify_authenticity_token, only: :webhook.
  • What’s needed: No additional imports, methods, or definitions are necessary—just the modification of the skip_before_action call.

Suggested changeset 1
app/controllers/stripe_controller.rb

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/controllers/stripe_controller.rb b/app/controllers/stripe_controller.rb
--- a/app/controllers/stripe_controller.rb
+++ b/app/controllers/stripe_controller.rb
@@ -1,5 +1,5 @@
 class StripeController < ApplicationController
-  skip_before_action :verify_authenticity_token
+  skip_before_action :verify_authenticity_token, only: :webhook
 
   def webhook
     payload = request.body.read
EOF
@@ -1,5 +1,5 @@
class StripeController < ApplicationController
skip_before_action :verify_authenticity_token
skip_before_action :verify_authenticity_token, only: :webhook

def webhook
payload = request.body.read
Copilot is powered by AI and may make mistakes. Always verify output.
@jim jim committed this autofix suggestion 4 months ago.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant