Skip to content

Commit

Permalink
Add check for ecrecover in ColonyTask
Browse files Browse the repository at this point in the history
  • Loading branch information
area committed Dec 15, 2022
1 parent c67cfea commit c2d77ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/colony/ColonyTask.sol
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ contract ColonyTask is ColonyStorage {
}

reviewerAddresses[i] = ecrecover(txHash, _sigV[i], _sigR[i], _sigS[i]);
require(reviewerAddresses[i] != address(0), "colony-task-invalid-signature");
}
return reviewerAddresses;
}
Expand Down
16 changes: 16 additions & 0 deletions test/contracts-network/colony-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,22 @@ contract("ColonyTask", (accounts) => {
await checkErrorRevert(colony.executeTaskChange([sigV[0]], sigR, sigS, [0], 0, txData), "colony-task-change-signatures-count-do-not-match");
});

it("should fail to execute task change with a bad signature and only one of the relevant roles set", async () => {
const taskId = await makeTask({ colony });
const { sigR, sigS, txData } = await getSigsAndTransactionData({
colony,
taskId,
functionName: "setTaskDueDate",
signers: [MANAGER],
sigTypes: [0],
args: [taskId, "1"],
});

// Make the signature bad
const sigV = [11];
await checkErrorRevert(colony.executeTaskChange(sigV, sigR, sigS, [0], 0, txData), "colony-task-invalid-signature");
});

it("should fail to execute task change send for a task role assignment call (which should be using executeTaskRoleAssignment)", async () => {
const taskId = await makeTask({ colony });
const { sigV, sigR, sigS, txData } = await getSigsAndTransactionData({
Expand Down

0 comments on commit c2d77ae

Please sign in to comment.