Conversation
`referralCustomer->addCreditCard` passed the card number, expiry and CVC to Guzzle via the `query` option, which puts them in the URL query string of the `POST /v1/tokens` request. Use `form_params` 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::createStripeTokenpassescard[number],card[exp_month],card[exp_year]andcard[cvc]to Guzzle through thequeryrequest option, 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 the option to
form_params, so Guzzle sends the same nestedcard[...]fields as anapplication/x-www-form-urlencodedbody, which is what Stripe expects on this endpoint (and whateasypost-ruby,easypost-goandeasypost-csharpalready do). The explicitContent-Typeheader is kept; Guzzle honours a caller-supplied header alongsideform_params.Also adds a
Next ReleaseCHANGELOG entry.Tracking: SEC-768 (internal).
Testing
phpunit/phpstanhave not been run here; the change is a one-key rename in the Guzzle options array. Please run the suite in CI.test/cassettes/referral_customers/addCreditCard.ymlwas recorded with the card fields in the query string, sotestAddCreditCardwill not replay under php-vcr's default matchers until re-recorded withPARTNER_USER_PROD_API_KEY/REFERRAL_CUSTOMER_PROD_API_KEY. I do not have those keys. When re-recording, please confirm the recorded URL no longer carries card fields and that the request-body scrubber covers them.Pull Request Type
Please select the option(s) that are relevant to this PR.
🤖 Generated with Claude Code