-
Notifications
You must be signed in to change notification settings - Fork 60
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
Only allow enabling/disabling recovery alerts for modules of given Safe #1267
Conversation
try { | ||
const { safes } = await this.safeRepository.getSafesByModule({ | ||
chainId, | ||
moduleAddress, | ||
}); | ||
|
||
return safes.some((safe) => getAddress(safe) === getAddress(safeAddress)); | ||
} catch (e) { | ||
this.loggingService.debug(e); | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can merge the try/catch block with the one above. Alternatively you can extract this part to a new Guard
in favour of composability (e.g.: SafeHasModuleGuard
).
However for the context of this PR and since we only perform this check here I would say that we can merge the try/catch block first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged in c3d6cff.
try { | ||
const { safes } = await this.safeRepository.getSafesByModule({ | ||
chainId, | ||
moduleAddress, | ||
}); | ||
|
||
return safes.some((safe) => getAddress(safe) === getAddress(safeAddress)); | ||
} catch (e) { | ||
this.loggingService.debug(e); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged in db117f8.
Summary
We currently prevent the user from enabling/disabling recovery alerts unless they submit a valid signature. This does, not, however, mean that the module is tied to the specified Safe.
This includes a check that the specified
moduleAddress
is enabled on thatsafeAddress
.Changes
moduleAddress
is enabled onsafeAddress
inEnableRecoveryAlertsGuard
/DisableRecoveryAlertsGuard