Fix internal-detail leak in Setup.php's error handling - #78
Merged
Merged
Conversation
Controller/Payment/Setup.php passed ApiException::getMessage() -- built from curl_error() and Paystack's raw API response body -- straight to the customer-facing checkout failure page. Same leak class D5 already closed on Callback.php, missed here. The abandoned fix/r2.1-settlement-gate branch (reconciled in PR #77) had already fixed this but it wasn't part of that reconciliation's scope; found by diffing that branch against master after the fact. Detail now goes to the logger (context array, not string concatenation, so an embedded newline can't forge log lines) and order history (admin-only) instead; the customer gets a fixed, safe string. Also added a bare \Throwable catch matching Callback.php's D5 fix -- the ApiException-only catch left every other exception processAuthorization() can throw (a missing store URL, a malformed response, a save failure) uncaught. Co-Authored-By: Claude Sonnet 5 <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.
Summary
Controller/Payment/Setup.phppassed rawApiException::getMessage()(built fromcurl_error()and Paystack's raw API response body — can carry internal hostnames, TLS detail, gateway-side state) directly to the customer-facing checkout failure page. Same leak class D5 already closed onCallback.php; missed here.fix/r2.1-settlement-gatereconciliation (PR Reconcile settlement-gate: full accept-side verification, D7/D8/D12 fixes #77) against master after the fact, to confirm everything from that abandoned branch had actually been ported — it hadn't, in this one spot.catch (\Throwable)matchingCallback.php's D5 fix — theApiException-only catch left every other exceptionprocessAuthorization()can throw (a missing store URL, a malformed Paystack response, a save failure) uncaught, which in developer-mode stores would print the raw message + trace to the browser.str_contains.Test plan
Test/Unit/vendor/bin/phpunit -c phpunit.xml --no-coverage— 303 tests, 592 assertions, all green\Throwablepath, confirming a non-ApiExceptionthrow also shows the safe message, not its own text🤖 Generated with Claude Code