In the commit-reveal voting scheme for referendums, UUID 4 is used for random salt generation instead of a cryptographic random generator
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Summary
In the current implementation for the commit-reveal voting scheme in referendum, the random salt values are generated by UUID 4. While Joystream seems to be aware of this according to the code annotation, we wanted to issue a reminder to use a cryptographically secure random number generator instead of UUID 4 for this purpose.
Issue details
Currently, the salt used in the commit-reveal scheme for votes is generated in pioneer/packages/joy-election/src/VoteForm.tsx the following way:
// TODO use a crypto-prooven generator instead of UUID 4.
function randomSalt () {
return uuid().replace(/-/g, '');
}
While UUIDs can be generated with variable amounts of randomness, they are generally designed to be unique and not necessarily random. While Joystream seems to be aware of this according to the code annotation, we wanted to point it out as an information-level issue.
Risk
If an attacker is able to predict the random salt that is generated for the commit-reveal scheme for referendums, they could reveal votes of participants before the referendum ends.
Mitigation
Make sure to use a cryptographically secure random number generator for salt generation in production.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pioneer/packages/joy-election/src/VoteForm.tsx at randomSalt() and trace how its value is used by the referendum commit-reveal flow. Check the available production-safe randomness options, then verify that generated salts remain compatible with vote commitment and reveal handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100