cryptoconditions icon indicating copy to clipboard operation
cryptoconditions copied to clipboard

PreimageSha256 validation returns only True can be dangerous

Open TimDaub opened this issue 9 years ago • 1 comments

See this method: https://github.com/bigchaindb/cryptoconditions/blob/master/cryptoconditions/types/sha256.py#L120

PreimageSha256.validate always yields True, while all other respective types validate by checking external parameters (usually the message parameter). A user would expect that calling .validate on all present fulfillments in a transaction to (at least partially) validate the transaction. However, for a PreimageSha256 fulfillment, a comparison between the input condition and the newly created fulfillment's condition will also have to happen. In BigchainDB, this case is handled here: https://github.com/bigchaindb/bigchaindb/blob/master/bigchaindb/util.py#L458

To avoid pitfalls for users of this library it would be nice if we could force the submission of the input-condition and then yield the respective boolean in the validate method.

TimDaub avatar Sep 22 '16 13:09 TimDaub

shouldn't be an issue, see: https://github.com/interledger/five-bells-condition/blob/master/src/types/preimage-sha256.js#L96

diminator avatar Oct 12 '16 12:10 diminator