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: losing profile on impersonation threat #42

Closed
wants to merge 1 commit into from

Conversation

martillansky
Copy link
Contributor

If the impersonated requests transferring her profile to the foreign chain, her profile will be removed as a consequence of the unsatisfied conditions on ccGrantHumanity. This update allows avoiding such unwanted side effect if the mentioned edgecase occurs.

If the impersonated requests transferring her profile to the foreign chain, her profile will be removed as a consequence of the unsatisfied conditions on ccGrantHumanity. This update allows avoiding such unwanted side effect if the mentioned edgecase occurs.
@@ -287,6 +297,16 @@

// ========== RECEIVES ==========

function checkCCTransferCondition(
address _owner,

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

@@ -287,6 +297,16 @@

// ========== RECEIVES ==========

function checkCCTransferCondition(
address _owner,
bytes20 _humanityId

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

@@ -366,7 +386,7 @@
* @param _humanityId The id of the humanity to check
* @return Whether humanity is claimed
*/
function isClaimed(bytes20 _humanityId) external view returns (bool) {
function isClaimed(bytes20 _humanityId) public view returns (bool) {

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

Comment on lines +487 to +499
function ccIsHumanityGranteable(
bytes20 _humanityId,
address _account
) external view onlyCrossChain returns (bool success) {
Humanity storage humanity = humanityData[_humanityId];

// If humanity is claimed, don't overwrite.
if (humanity.owner != address(0x0) && block.timestamp < humanity.expirationTime) return false;

// Must not be in the process of claiming a humanity.
require(humanityData[accountHumanity[_account]].requestCount[_account] == 0);
return true;
}
@@ -484,6 +484,20 @@

/// ====== GOVERNANCE ====== ///

function ccIsHumanityGranteable(
bytes20 _humanityId,

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

Comment on lines +490 to +505
function ccIsHumanityGranteable(
bytes20 _humanityId,
address _account
) external view onlyCrossChain returns (bool success) {
Humanity storage humanity = humanityData[_humanityId];

// If humanity is claimed, don't overwrite.
if (
(humanity.owner != address(0x0) && block.timestamp < humanity.expirationTime) ||
// If not claimed in this contract, check in fork module too.
forkModule.isRegistered(_account)
) return false;

// Must not be in the process of claiming a humanity.
require(humanityData[accountHumanity[_account]].requestCount[_account] == 0);
}
@@ -487,6 +487,23 @@

/// ====== GOVERNANCE ====== ///

function ccIsHumanityGranteable(
bytes20 _humanityId,

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

@@ -487,6 +487,23 @@

/// ====== GOVERNANCE ====== ///

function ccIsHumanityGranteable(
bytes20 _humanityId,
address _account

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

Comment on lines +546 to +565
function ccIsHumanityDischargeable(
address _account
) external view onlyCrossChain returns (bytes20 humanityId, uint40 expirationTime) {
humanityId = accountHumanity[_account];
Humanity storage humanity = humanityData[humanityId];
require(humanity.nbPendingRequests == 0);

if (humanity.owner == _account && block.timestamp < humanity.expirationTime) {
require(!humanity.vouching);

expirationTime = humanity.expirationTime;

} else {
// V1 profiles have default humanity.
humanityId = bytes20(_account);

// Should revert in case account is not registered.
expirationTime = forkModule.tryRemove(_account);
}
}

Check notice

Code scanning / Slither

Block timestamp Low

@@ -526,6 +543,27 @@
return true;
}

function ccIsHumanityDischargeable(
address _account

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning

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