LeFy - Attestation Reviews does not properly handle the case when attestation ownership has changed #304
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
LeFy
Medium
Attestation Reviews does not properly handle the case when attestation ownership has changed
Summary
In 'EthosReview.sol' , when reviews of attestations are added , its pushed to
reviewIdsBySubjectProfileId[subjectProfileId]
, but in 'EthosAttestation.sol' one can claim an attestation that was previously claimed by another user using_claimAttestation()
but then the reviews of the attestation will still be linked to the previous owner only.Root Cause
In 'EthosReview.sol' , when reviews of attestations are added , its pushed to
reviewIdsBySubjectProfileId[subjectProfileId]
:Repo Link
Now consider if the attestation has been claimed by another user who called the _claimAttestation():
Now the attestation belongs to the second user, but in 'EthosReview.sol' its still linked to the previous owner profileId and every function that fetch reviews will read the reviewIdsBySubjectProfileId and the reviews will always be associated with the previous owner.
Impact
Even though attestation ownership has changed, the attestation reviews will still be linked to previous owner
Mitigation
There are 2 ways in which this can be mitigated, one is to define another mapping to explicitly track revieIds by attestation Hash instead of adding both address and attestation reviews to reviewIdsBySubjectProfileId[]:
Other way would be to implement a function which will be invoked whenever an attestation ownership has changed, that deletes the entry from reviewIdsBySubjectProfileId[previosOwner] and adds it to reviewIdsBySubjectProfileId[newOwner].
The text was updated successfully, but these errors were encountered: