-
Notifications
You must be signed in to change notification settings - Fork 8
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
Sig malleability protection for erc1271 only #215
Conversation
Sig malleability protection for erc1271 only
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #215 +/- ##
==========================================
- Coverage 85.00% 84.68% -0.32%
==========================================
Files 13 13
Lines 847 849 +2
Branches 249 271 +22
==========================================
- Hits 720 719 -1
- Misses 112 115 +3
Partials 15 15
Continue to review full report in Codecov by Sentry.
|
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.
got it. lgtm
codecov/patch check is failing. |
Changes to gas cost
🧾 Summary (5% most significant diffs)
Full diff report 👇
|
🤖 Slither Analysis Report 🔎Slither report
# Slither report
_This comment was automatically generated by the GitHub Actions workflow._
THIS CHECKLIST IS NOT COMPLETE. Use
locked-ether🟡 Impact: Medium
utils/NexusBootstrap.sol#L33-L165 constable-statesImpact: Optimization
|
fuck it. It shows 'uncovered' for lines which in fact are. |
Moved sig malleability protection to 1271 flow only as for erc4337 it is excess
ERC-4337 flow has nonce protection against replays including signature malleability. So there is no need to apply this check
ERC-1271 flow has no in-built protection against replays including signature malleability.
Even reference implementation includes the 's' check: https://eips.ethereum.org/EIPS/eip-1271#reference-implementation
If one is using OZ's ECDSA, this above check is applied under the hood : https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol#L134-L145
However, in our K1Validator we use Solady ECDSA.tryRecover
nexus/contracts/modules/validators/K1Validator.sol
Line 15 in 69f437b
https://github.com/Vectorized/solady/blob/45bba1221ad451289d2f54c2f7f48aea624e17aa/src/utils/ECDSA.sol#L218-L259
which, as far I can see, doesn't have such a check
Of course disallowing using n - s is not considered to be the full replay protection. However, we can not know if any additional protection is incorporated into the signed hash in 1271, at the same time we can not enforce stronger replay protection such as nonce, so we can at least protect from signature malleability and expect protocols which use 1271 to have their own replay protection (and if they decide to use full bytes signature as protection, they are covered from malleability).