Comments (4)
I am trying to understand this. Regarding:
https://github.com/erasureprotocol/erasure-protocol/blob/c716c17a080ac7817312ab57ec4b1c60aa867f19/contracts/escrows/CountdownGriefingEscrow.sol
The scenario here is:
- Operator creates the
CountdownGriefingEscrow
contract and initializes with:seller
=address(0)
operator
≠address(0)
- Operator deposits stake using
depositStake
- Documentation states "if
seller
not already set, makemsg.sender
theseller
" seller
is not changed- Tokens are attributed to
seller
which is stilladdress(0)
- Documentation states "if
- Nobody can get tokens that are attributed to
address(0)
Design issues:
- If a contract is initialized where the seller is open-ended then the contracts fails if the operator acts as a seller.
- There is no way for an operator to set the seller for the contract if it was not set at initialization.
- The contract works properly if the sender on an open-ended contract deposits stake by itself.
Design questions:
- Is it desired that an operator will be able to set the sender if the contract was initialized without a sender?
Is this a vulnerability?:
- We need to see the contract implementation for the intended operator contract to decide.
- If the operator contract wants to set the sender for a contract that was initialized without a sender then then this is a vulnerability.
Remediation:
- At a minimum, for safety, prevent operator from acting as seller in the current implementation.
- This can be done in below here
- OR review the functionality of the operator implementation to make sure it is not used in this way.
- If it is desired that operator can set the
seller
at a time after contract initialization, then this must be added as a new public function.
from erasure-protocol.
@fulldecent went for remediation num 4.
The rationale is that operator serves as a blanket bypass of all access control to the public functions of the contract. This allows for composability since I can delegate the permissions to a separate contract that only implements the desired functionality.
Hopefully the documentation makes clear that the operator is always a trusted party if used.
from erasure-protocol.
The fix includes the ability to set an arbitrary seller / buyer instead of inferring it from msg.sender. Do you think this is a good pattern?
from erasure-protocol.
Looks great. Very clear and safe. Good pattern.
from erasure-protocol.
Related Issues (20)
- Same-contract variable is accessed using internal scoping
- Separate all test code
- Uses of address types can be more specific
- TODO is present in code
- Variety of approaches is used for restricting actor for permission checking HOT 1
- ⚠️ Mint / burn should be explained clearly
- ⚠️ submitHash does NOT accept multihashes HOT 1
- contracts-wip should be deleted
- Unused libraries are checked into the repository
- Add local subgraph to testenv package
- testenv does not create erasure_users contract
- Solidity 0.6.2 - new selector syntax
- add getter to Escrow for agreement address
- standardize version tags across all packages
- Create a full test flow that exercises all contracts/events in testenv
- bundle testenv as docker image
- Add factory deprecation switch for to registry manager
- use efficient addresses for template contracts to reduce minimal proxy size to single storage slot
- Build token forwarding contract for efficient approval chains
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erasure-protocol.