Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txnbuild: add a method for verifying SEP-10 challenge transactions #1530

Closed
6 tasks done
poliha opened this issue Jul 22, 2019 · 5 comments
Closed
6 tasks done

txnbuild: add a method for verifying SEP-10 challenge transactions #1530

poliha opened this issue Jul 22, 2019 · 5 comments
Assignees
Labels
txnbuild 2nd-generation transaction build library for Go SDK

Comments

@poliha
Copy link
Contributor

poliha commented Jul 22, 2019

The txnbuild package has a method(BuildChallenge) that builds a SEP 10 challenge transaction. There should be a corresponding method(VerifyChallenge) that verifies a SEP-10 challenge transaction.

This method should do the following

  • decode the received input as a base64-urlencoded XDR representation of Stellar transaction envelope;

  • verify that transaction source account is equal to the server's signing key;

  • verify that transaction has time bounds set, and that current time is between the minimum and maximum bounds;

  • verify that transaction contains a single Manage Data operation and its source account is not null;

  • verify that transaction envelope has a correct signature by server's signing key;

  • verify that transaction envelope has a correct signature by the operation's source account;

@abuiles
Copy link
Contributor

abuiles commented Jul 26, 2019

@poliha Is the following checking that the transaction was signed by the client?

verify that transaction envelope has a correct signature by the operation's source account;

If that's the case, are we sure this should be part of this checks? the way I understand it is, as a client, I want to check that the challenge is valid before signing it and send it back to the server.

Maybe we could add a flag to check bot the signature on the operation source account.

VerifyChallenge(challenge, serverAccountId, checkOperation = true)

@poliha
Copy link
Contributor Author

poliha commented Jul 26, 2019

@abuiles The verification steps above are done by the server before responding with a JWT for the client to access other services. We have been approaching the building and verification of the challenge from the perspective of the server. The SEP doesn't mention a validation step for the client, @TomQ is this by design?
In my opinion, i don't think we need the client to verify anything because the transaction can never be submitted to the network.

@abuiles
Copy link
Contributor

abuiles commented Jul 26, 2019

@poliha makes sense. My reasoning was that as a client I want to do some checks before signing it, at least I want to make sure the sequenceNumber is 0 -- but that's such a simple check that it can be left to the client to implement it.

@abuiles
Copy link
Contributor

abuiles commented Feb 25, 2020

I think this was fixe dby @leighmcculloch

@abuiles abuiles closed this as completed Feb 25, 2020
@leighmcculloch
Copy link
Member

This was done by @poliha in #1576 actually 😄. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
txnbuild 2nd-generation transaction build library for Go SDK
Projects
None yet
Development

No branches or pull requests

3 participants