Skip to content

Conversation

@Dhanus3133
Copy link
Contributor

Summary

Fixes an issue where {CHECKOUT_ID} in the success URL was auto-escaped to %7BCHECKOUT_ID%7D after saving a checkout link.

Why This Change Was Made

  • Libraries like pypandic follow RFC 3986 and escape {} as %7B/%7D.
  • This ensures the placeholder is kept as-is and replaced correctly when generating the final URL.

Fixes: #6300

@vercel
Copy link

vercel bot commented Sep 7, 2025

@Dhanus3133 is attempting to deploy a commit to the polar-sh Team on Vercel.

A member of the Team first needs to authorize it.

@frankie567
Copy link
Member

Thank you for having a look into this, but I don't think this is the right approach: calling unquote on the whole URL opens a security risk, as everything can be decoded, even malicious payloads and stuff like that.

IMO, we should do the following:

  • Find a way to "unescape" {CHECKOUT_ID} (and only that) when creating/updating that URL. We can probably rely on a custom Pydantic validator for this. Don't forget to use it both in checkout/schemas.py and checkout_link/schemas.py.
  • Create a database migration to unescape {CHECKOUT_ID} (and only that) from existing checkout links.

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.

{CHECKOUT_ID} in the success url auto-escapes to %7BCHECKOUT_ID%7D upon Save Link

2 participants