Skip to content

Harden API requestor code against malicious URLs - #3441

Merged
xavdid merged 4 commits into
masterfrom
RUN_DEVSDK-2808
Aug 31, 2026
Merged

Harden API requestor code against malicious URLs#3441
xavdid merged 4 commits into
masterfrom
RUN_DEVSDK-2808

Conversation

@xavdid

@xavdid xavdid commented Aug 28, 2026

Copy link
Copy Markdown
Member

Why?

If an attacker got access to a user's webhook secret (or the user wasn't validating incoming webhook signatures) and a user was calling the built-in event_notification.fetch_related_object() method, a malicious webhook payload could cause a user integration to make an authenticated request to an attacker-controlled domain (leaking the secret key)

To solve, we're being more careful during url construction to ensure user input can't be used to send requests to non-stripe.com domains (on a per-request basis).

What?

  • add path validation method and call it before the final URL is built
  • add tests

See Also

@xavdid
xavdid marked this pull request as ready for review August 28, 2026 21:24
@xavdid
xavdid requested a review from a team as a code owner August 28, 2026 21:24
@xavdid
xavdid requested review from kidus-stripe and removed request for a team August 28, 2026 21:24
@xavdid
xavdid enabled auto-merge (squash) August 28, 2026 21:24

@jar-stripe jar-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving to unblock, but consider relocating the content of that long ValidatePath comment

Comment thread src/Stripe.net/Infrastructure/Public/StripeRequest.cs
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.

2 participants