Conversation
parsePaymentReceipt checked that the status field was present but never validated its value, so a receipt with status="failed" (or any other string) parsed successfully into a usable Receipt object. Canonical mppx defines receipt status as the literal value "success" and validates that during deserialization -- this SDK's own Receipt class matches that design (the only constructor that sets status is Receipt.success(...), which hardcodes "success"), but the parser didn't enforce it on the read side, so a malicious or buggy server could return a protocol-invalid error-like receipt that this SDK would still hand back to the caller as if it were a valid successful payment. Add a check right after the existing null check: reject with ParseException if status isn't exactly "success". Adds receiptParseRejectsNonSuccessStatus, following the same pattern as the existing receiptParseRejectsMissingMethod / receiptParseRejectsInvalidMethodId tests in this file -- an otherwise well-formed receipt with status="failed" must throw ParseException rather than parse. As with my other PRs, I could not compile/run this against the real dependencies in my sandbox (no Maven Central access) -- please double-check compilation before merge. Fixes tempoxyz/mpp-tools#208 (AGR-2026-086)
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.
What
parsePaymentReceiptchecked that thestatusfield was present but never validated its value, so a receipt withstatus="failed"(or any other string) parsed successfully into a usableReceiptobject. Canonical mppx defines receipt status as the literal value"success"and validates that during deserialization — this SDK's ownReceiptclass matches that design (the only constructor that sets status isReceipt.success(...), which hardcodes"success"), but the parser didn't enforce it on the read side, so a malicious or buggy server could return a protocol-invalid error-like receipt that this SDK would still hand back to the caller as if it were a valid successful payment.Flagged by the cross-SDK audit as AGR-2026-086.
/ag fixisn't available for this repo since it's outside Agricola's write scope.Fix
Add a check right after the existing null check: reject with
ParseExceptionif status isn't exactly"success".Testing
Adds
receiptParseRejectsNonSuccessStatus, following the same pattern as the existingreceiptParseRejectsMissingMethod/receiptParseRejectsInvalidMethodIdtests in this file — an otherwise well-formed receipt withstatus="failed"must throwParseExceptionrather than parse.As with my other PRs, I couldn't compile/run this against the real dependencies in my sandbox (no Maven Central access) — please double-check compilation before merge, happy to fix anything that doesn't match.
Fixes tempoxyz/mpp-tools#208