Stop claiming no tampering was detected when nothing was compared - #222
Merged
Conversation
verifyProviderTransaction returns passed: true in two very different situations: the local decode was compared against the API's and they agreed, or there was no API decode to compare against at all. The second happens whenever the endpoint errors, returns a non-200, or rejects a payload our unpacker accepts -- and the approval screen rendered the same green shield reading "Verified locally -- no tampering detected" either way. The wallet's one affirmative security claim was loudest exactly when it had checked least. The result now carries comparedAgainstApi, and the two cases render differently: a cross-checked pass keeps the shield, while a decode with nothing to compare against gets a neutral badge saying so. Signing behaviour is unchanged -- neither case was ever blocked, and this does not start blocking one; only the claim made to the user changes. Both approval screens default the flag to false when absent, so a path that forgets to report it understates rather than overstates. Claude-Session: https://claude.ai/code/session_01CcjnCrgosSeshymXLBxdGj
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.
PRIORITIES.md item 3a. Small fix, removes a false assurance.
The problem
verifyProviderTransactionreturnspassed: truein two very different situations:(
providerVerify.ts)The second case happens whenever
decodeCounterpartyMessagereturns null — a network error, a non-200, or anerrorfield in the response — and the caller swallows that exception (useSignTransactionRequest.ts). The approval screen rendered the same green shield for both:So the wallet's one affirmative security claim was made most confidently in the case where it had checked least, including when an attacker submits a payload our unpacker accepts but core rejects.
The change
The result now carries
comparedAgainstApi, and the two cases render differently:Signing behaviour is unchanged. Neither case was ever blocked, and this does not start blocking one — only the claim made to the user changes. Both approval screens default the flag to
falsewhen absent, so a path that forgets to report it understates rather than overstates.Tests
verification-status.test.tsxcovers all four states, including that the "no tampering" text is absent when nothing was compared.providerVerify.test.tsextended:comparedAgainstApiis false with no API message, false for non-Counterparty data, true only when a comparison ran.tsc --noEmitclean.provider-transaction-signing.spec.ts11/11 locally.Not addressed here
The deeper issue behind this one is item 3: the raw-transaction approval screen renders from the API's decode rather than a local parse, so the "local" unpack is not independent of the API either. That is a larger change and is next.
https://claude.ai/code/session_01CcjnCrgosSeshymXLBxdGj