this post was submitted on 06 Apr 2025
4 points (83.3% liked)

Cybersecurity

6938 readers
171 users here now

c/cybersecurity is a community centered on the cybersecurity and information security profession. You can come here to discuss news, post something interesting, or just chat with others.

THE RULES

Instance Rules

Community Rules

If you ask someone to hack your "friends" socials you're just going to get banned so don't do that.

Learn about hacking

Hack the Box

Try Hack Me

Pico Capture the flag

Other security-related communities [email protected] [email protected] [email protected] [email protected] [email protected]

Notable mention to [email protected]

founded 2 years ago
MODERATORS
 

Why does Stripe require OAuth tokens to pass through a third party server?

Can someone who understands OAuth better than me explain to me why Stripe REQUIRES that their OAuth Access Keys get shared with a third party?

I've tried RTFM, but my biggest hangup is that the OAuth docs appear describe a very different situation than mine. They usually describe a user agent (web browser) as the client. And they talk about "your users" as if I have a bunch of users that I'm going to be fetching access keys for.

Nah, this is server <--> server. I have a server. Stripe has a server. I am one user. All I need is ONE API key for ONE account. But I'm forced to use OAuth. It doesn't seem appropriate, and it's especially concerning that the "flow" requires the (non-expiring!) Access Token to be shared with a third party server. Why?!?

I recently learned that Stripe has been pushing OAuth (branded as "Stripe Connect") to its integration apps as the "more secure" solution, compared to Restricted API Keys. In fact, we've found that most integrations we've encountered that use Stripe Connect are less secure than using Restricted API Keys because the (private!) tokens are shared with a third party!

I've been using Stripe to handle credit card payments on my e-commerce website for years. Recently, we updated our wordpress e-commerce website and all its plugins. And then we discovered that all credit card payments were broken because our Stripe Payment Gateway plugin stopped allowing use of Restricted API Keys. Instead they only support "Stripe Connect" (which, afaict, is a marketing term for OAuth). This change forced us to do a security audit to make sure that the new authentication method met our org's security requirements. What we found was shocking.

So far we've started auditing two woocommerce plugins for Stripe, and both have admitted that the OAuth tokens are shared with their (the developer's) servers!

One of them is a "Stripe Verified Partner", and they told us that they're contractually obligated by Stripe to use only "Stripe Connect" (OAuth) -- they are not allowed to use good-'ol API Keys.

They also told us that Stripe REQUIRED them to include them in the OAuth flow, such that their servers are given our (very secret!) OAuth Access Keys!

The benefit of normal API Keys, of course, is that they're more secure than this OAuth setup for (at least) two reasons:

  1. I generate the API keys myself, and I can restrict the scope of the keys permissions

  2. I store the key myself on my own server. It's never transmitted-to nor stored-on any third party servers. Only my server and Stripe's servers ever see it.

Can someone shine a light onto this darkpattern? I understand that standardization is good. OAuth Refresh Keys add security (this service doesn't use them). But why-oh-why would you FORCE OAuth flows that share the (non-expiring) Access Tokens with a third party? And why would you claim that's more secure than good-ol-API-keys?

Does OAuth somehow not support server<-->server flows? Or is it a library issue?

What am I missing?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 2 days ago* (last edited 2 days ago) (1 children)

Oauth doesn't. Use keycloak if you need on prem.

[–] [email protected] 1 points 2 days ago (1 children)

Please read the question. I am not the developer; I can't change to keycloak.

[–] [email protected] 2 points 2 days ago (1 children)

Oh sorry, yeah. That's a library thing. You're shit out of luck.

[–] [email protected] 1 points 2 days ago* (last edited 2 days ago) (1 children)

Can you elaborate? Any idea why Stripe would choose this design?

I think Stripe generally has good security practices. But I just can't understand this design choice. There has to be a reason..

[–] [email protected] 1 points 2 days ago (1 children)

I honestly don't know why. If you're that curious, you could probably ask them directly.

[–] [email protected] 2 points 1 day ago (1 children)

I have been, but Stripe support hasn't been helpful.

Update: one of the plugin authors finally explained it well:

It's because Stripe doesn't allow the redirect during the OAuth flow to be dynamic. It must be a predefined value that's hard-coded into the app.

For security purposes, Stripe redirects a user only to a predefined URI.

That's why Stripe forces you to expose your access tokens to the developer's servers.

I'd still appreciate if someone with more experience with OAuth than me knows if this is common. Seems like a very bad design decision to require users to transmit their bearer tokens through the developer's servers.

[–] [email protected] 1 points 1 day ago (1 children)

That sounds super sketchy to me. Are you forced to use stripe? If so, CYA. Put it in writing.

[–] [email protected] 2 points 1 day ago* (last edited 1 day ago) (1 children)

No, I'm not forced to use Stripe.

I'm looking at mollie now, but I don't really know of any better alternatives to Stripe. Got a recommendation?

Anything that requires a PayPal account is not an option.

Edit: Mollie won't let us create an account unless we push >50.000 EUR/mo. Yeah, we're a small business. We're wayyy under that limit. So no Mollie :(

[–] [email protected] 2 points 1 day ago

Unfortunately, I don't. I wish you luck though, hope you find a good solution