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

08 Custom-token: At least add nonce to prevent exploiting admin signature #366

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HyunggyuJang
Copy link

It is not bullet-proof solution, but at least, we can alert with the following change, we should consider double spending for the mint method in production.

@HyunggyuJang HyunggyuJang requested a review from a team as a code owner April 24, 2023 04:49
@vercel
Copy link

vercel bot commented Apr 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 16, 2023 0:27am

@barriebyron
Copy link
Contributor

thank you for your suggestion @HyunggyuJang
Let me ask our tutorial expert @ymekuria to lend his technical expertise and evaluate this change.

@mitschabaude
Copy link
Member

Thanks @HyunggyuJang for watching out!
As I read this, this prevents replaying a mint transaction by adding a special "mint nonce" which the mint is tied to. The nonce is incremented so that this transaction can't succeed a second time.

I think this is a good idea, but I'd do it differently. There's already a dedicated nonce field on the account which would be better to use.

We could even refactor the admin signature input, to instead create an account update for the admin (assuming they have an associated Mina account) and call update.requireSignature(). This achieves everything here (access control + replay protection) with very little code and a cheap proof (signature is checked on the Mina node, not in the SNARK), and would be a nice pattern to demonstrate.

But importantly, we should only make any change to the example code if we also update the tutorial along with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants