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

Security updates and migration code for 0.6 #66

Merged
merged 15 commits into from
Jul 1, 2022
Merged

Security updates and migration code for 0.6 #66

merged 15 commits into from
Jul 1, 2022

Conversation

jberkus
Copy link
Member

@jberkus jberkus commented Jun 23, 2022

This merge incorporates all of @007vedant's security updates for his internship, including:

  • updating all python module requirements
  • flipping the direction of the encrypted link between voters and ballots
  • randomizing the session key
  • enforcing length limits for voter passphrases
  • using more robust encryption for the ballot key
  • allowing ballot review

For more information on the above, see Vedant's many commits in the NewBallot branch.

It also incorporates an upgrade-in-place code snippet for migrating from 0.5 to 0.6. This is inserted through a fairly ad-hoc mechanism, because SQLAlchemy migrations was not able to perform the require migration steps without loss of data for production instances. Unfortunately, this also means that currently the migration code only works for PostgreSQL backends. Additional code for MySQL and SQLite would be very much desired, but more difficult because of the lack of transactional DDL and ALTER-time data transformations in those systems.

It also introduces schema version numbers. 0.5 is schema version 1, and 0.6 is version 2. Future changes to the schema should be represented by incrementing the version number and writing additional migration code.

jberkus and others added 15 commits April 7, 2022 17:00
- added env variable MIN_PASSCODE_LENGTH in .env.example (to be set by admin in .env)
- added config variable for MIN_PASSCODE_LENGTH (default value = 6)
- added decorator for performing passcode length check
- decorated elections_voting_page()
Modified min passcode length to admin configurable value
- added text for min passcode length in vote.html
- moved MIN_PASSCODE_LENGTH env variable with the topmost group
- added elections_view to handle ballot recovery
- added ballots.html webpage to display in UI
- updated Revoke Ballot button to View Ballot in single.html webpage
Updated UI for min passcode length
Added feature to view the ballot before revoke
Fixed CSS in View Ballot template
in the SQL models.

Signed-off-by: Josh Berkus <[email protected]>
@kalkayan
Copy link
Member

Looks good to me, also kudos for the database migrations 🥳

@jberkus
Copy link
Member Author

jberkus commented Jul 1, 2022

@kalkayan honestly, I feel kind of dirty for writing an ad-hoc database migrator. But all the other options involved installing massive numbers of dependancies.

@jberkus jberkus merged commit 01f044b into main Jul 1, 2022
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