Conversation
`referral_customer.add_credit_card` passed the card number, expiry and CVC to `requests.post` via `params=`, which puts them in the URL query string of the `POST /v1/tokens` request. Use `data=` so the same form-encoded fields go in the request body, keeping cardholder data out of access logs, proxy logs, tracing tools and Referer headers. SEC-768 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ReferralCustomerService._create_stripe_tokenpassescard[number],card[exp_month],card[exp_year]andcard[cvc]torequests.postthroughparams=, which places them in the URL query string of thePOST https://api.stripe.com/v1/tokensrequest. Query strings are routinely captured by access logs, outbound proxies, APM/tracing tools andRefererheaders, so cardholder data could be retained outside the payment path (PCI DSS requirement 3 / 4).This change switches to
data=, sorequestssends the same flattenedcard[...]fields as anapplication/x-www-form-urlencodedbody, which is what Stripe expects on this endpoint (and whateasypost-ruby,easypost-goandeasypost-csharpalready do). The existingContent-typeheader already declares that encoding.Also adds a
Next ReleaseCHANGELOG entry.Tracking: SEC-768 (internal).
Testing
python -m py_compilepasses locally; the change is a one-keyword swap.test_referral_customer_add_credit_cardis currently@pytest.mark.skipped ("flow is deprecated, cannot easily be tested due to Stripe changes"), so no cassette needs re-recording for this PR to pass.test_referral_add_credit_card_errormocks_create_stripe_tokenand is unaffected. If that test is ever re-enabled, itsmatch_onlist can drop"query"since the request no longer has one.Pull Request Type
Please select the option(s) that are relevant to this PR.
🤖 Generated with Claude Code