Verify SEP-10 challenge body integrity after domain signing#237
Merged
Conversation
Compares the hash of the transaction returned by the configured DomainSigner against the original challenge before signing it with the user's account key. If the body differs, a new DomainSigningModifiedError is thrown and the user-account signature is never applied.
There was a problem hiding this comment.
Pull request overview
This PR strengthens SEP-10 authentication by ensuring that a configured domain signer cannot modify the SEP-10 challenge transaction body before the wallet applies the user-account signature. It does so by comparing the transaction body hash (excluding signatures) before and after domain signing, and rejecting any body changes with a dedicated error.
Changes:
- Added an integrity check in
Sep10.sign()to verify the domain signer returns a transaction with the same envelope body hash as the original challenge. - Introduced
DomainSigningModifiedErrorto clearly signal domain-signer body modification. - Added unit tests covering both the accepted case (signature appended only) and the rejected case (body changed), including assertions that user signing and token POST are not performed on rejection.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| @stellar/typescript-wallet-sdk/src/walletSdk/Auth/index.ts | Adds post-domain-signing body-hash verification and throws DomainSigningModifiedError on mismatch. |
| @stellar/typescript-wallet-sdk/src/walletSdk/Exceptions/index.ts | Defines the new DomainSigningModifiedError used by SEP-10 signing flow. |
| @stellar/typescript-wallet-sdk/test/auth.test.ts | Adds unit tests for domain signer integrity behavior (accept same body + extra signature; reject modified body). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
piyalbasu
approved these changes
May 21, 2026
Contributor
piyalbasu
left a comment
There was a problem hiding this comment.
This is looking good to me!
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
Sep10.sign()now verifies that the transaction returned by the configuredDomainSignerhas the same body hash as the original challenge before signing it with the user's account key. If the body differs, aDomainSigningModifiedErroris thrown and the user-account signature is not applied.Test plan
DomainSigningModifiedErrorbefore any user-account signing.yarn lintpassesyarn test:cipasses (249 tests, 0 failures)