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

Fix vulnerable vote function #16

Closed

Conversation

a-singh09
Copy link

Problem:

Fixes #15

The original implementation of the vote function in the smart contract allowed for unauthorised voting by manipulating the _voter parameter.

Solution:

The solution involves ensuring that only authenticated users are allowed to cast votes. This is achieved by implementing an authentication check that verifies the sender's identity before allowing them to vote. The updated vote function now checks if the sender is authenticated before proceeding with the voting process. The authentication was already being done in Authentication.sol, so its instance is created in Election.sol and later a require() statement is used to allow only authenticated users.

Changes Made:

Election.sol:

  • Modified the constructor to accept an additional parameter _authContractAddress for the Authentication contract address.
  • Instantiated the Authentication contract using the provided address.
  • Updated the vote function to include a check for the sender's authentication status using authContract.getAuthStatus(msg.sender) before proceeding with the voting logic.

ElectionFactory.sol:

  • Modified the getElectionFromFactory function to accept an additional parameter _authContractAddress for the Authentication contract address.

ElectionOrganizer.sol:

  • Updated the createElection function to accept an additional parameter _authContractAddress for the Authentication contract address.

rajranjan0608 and others added 30 commits September 11, 2021 15:06
Merge gsoc-2021 branch with develop

See merge request aossie/agora-blockchain!22
Added anaytics api

See merge request aossie/agora-blockchain!24
Base of new architecture ready

See merge request aossie/agora-blockchain!36
Ready for integration with frontend

See merge request aossie/agora-blockchain!39
Hardhat integrated

See merge request aossie/agora-blockchain!38
Added documentation for final evaluation

See merge request aossie/agora-blockchain!42
Final evaluations documentation

See merge request aossie/agora-blockchain!43
Updated the docs

See merge request aossie/agora-blockchain!45
@a-singh09 a-singh09 closed this Mar 16, 2024
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.

Fixing Vulnerable Vote Function
6 participants