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

Additional votes in the structures #2506

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

Conversation

ineiti
Copy link
Member

@ineiti ineiti commented Jun 26, 2023

What this PR does

For a new election at EPFL there will be more than 8 candidates. This is a problem, as currently all
choices are stored as data in an ed25519 Point. But as this Point only takes 24 bits of data,
we cannot store easily more than 9 choices.

To allow for more than 9 candidates, each Ballot, Mix, and Partial will have Additional* fields
to hold the additional choices.
As these fields are slices, and added to the end of the structures, and thus to the end of the protobuf definition,
it should be backward-compatible.
To make sure we don't add security problems, we also do:

  • fill up as many Additional fields in the Ballot as are maximally possible, to avoid leaking for how many candidates a person voted
  • use shuffle/sequences.go if there are more than 9 candidates
  • test if it works with one node down in shuffling / decryption
  • integration tests
    • create a set of nodes for testing the frontend
    • start with old version, set up an election, switch to new version, make sure it all works out

🙅‍ Friendly checklist:

  • 0. Code comments are added (or updated) when/where needed and explain the WHY of the code.
  • 1. Design choices, user documentation and any additional doc are added (or updated) in READMEs.
  • 2. Any new behaviour is tested and small units of code that can be are unit tested.
  • 3. Code comments are added on tests to explain what they do.
  • 4. Errors are systematically wrapped with a meaningful message using xerrors.Errorf and the %v verb.
  • 5. Hard limit of 80 chars is always respected.
  • 6. Changes are backward compatible.
  • 7. Indentation level does not exceed 5, although 4 is already suspicious.
  • 8. Functions, files, and packages are kept to a manageable size and decomposed into smaller units if needed.
  • 9. There are no magic values.

@ineiti ineiti force-pushed the evoting-many-candidates branch 3 times, most recently from c001d3c to 805682a Compare June 26, 2023 08:26
Added some security bugs found while adding the new functionalities.
They are here: #2507 #2508 #2509 #2510

Also added some comments and fixed some typos.
@ineiti ineiti force-pushed the evoting-many-candidates branch 5 times, most recently from faf72ba to 83a26f4 Compare June 28, 2023 08:57
Added 'Additional*' fields in a backward-compatible way.
Also split the evoting/struct.go to a evoting/proto.go for updating the messages in
the evoting frontend.
Put more methods in evoting/lib/container.go
Prepared usage of multiple points per vote
Showing all elections
Allow voting if the private key is known
@sonarcloud
Copy link

sonarcloud bot commented Jun 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
0.9% 0.9% Duplication

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.

1 participant