Conversation
`referralCustomer.addCreditCardToUser` built the `POST /v1/tokens` request with the card number, expiry and CVC in the URL query string and never wrote a request body (despite `setDoOutput(true)`). Stripe accepts the same form-encoded fields in the request body, which keeps 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.createStripeTokenbuilds thePOST https://api.stripe.com/v1/tokensrequest withcard[number],card[exp_month],card[exp_year]andcard[cvc]appended to the URL query string. It callssetDoOutput(true)but never writes a body. 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 writes the same form-encoded string to the connection's output stream and drops it from the URL. Stripe already expects
application/x-www-form-urlencodedbodies on this endpoint (it is whateasypost-ruby,easypost-goandeasypost-csharpdo today), so there is no behavioural change for callers.InternalUtilities.getEncodedURLis reused unchanged as the encoder.Also adds a
Next ReleaseCHANGELOG entry.Tracking: SEC-768 (internal).
Testing
java.io.OutputStreamimport, one renamed local, and a try-with-resources write. Please runmvn test/ checkstyle in CI.src/test/cassettes/referral_customer/referral_add_credit_card.jsonandcreate_bad_stripe_token.jsonwere recorded with the card fields in the URL, andTestUtilsconfigures EasyVCR to matchbyFullUrl().byBody(...), sotestReferralAddCreditCardandtestCreateBadStripeTokenwill not replay until re-recorded with the partner / referral prod keys. I do not have those keys. When re-recording, please confirm the recorded URL no longer carries card fields and that the body censor rules covercard[number]andcard[cvc].Pull Request Type
Please select the option(s) that are relevant to this PR.
🤖 Generated with Claude Code