fabric-private-chaincode icon indicating copy to clipboard operation
fabric-private-chaincode copied to clipboard

Guide for writing secure chaincode

Open g2flyer opened this issue 5 years ago • 3 comments

challenges

  • general
    • _is there a good reference for fabric or more general handling issues like how to safely do cc2cc avoiding re-entrant code/DAO-style attacks, input validation, ...)
    • ....
  • fpc (confidentiality) specific
    • leakage through (publically readable!) keys and access patterns (but not data) of key/value pairs (set of accesses from ledger and sequence of accesses at peer running enclave). Note that here is some related discussion in the "Data Model on Ledger" section in the Auction Demo specification & design

    • commit-and-reveal

    • for designated peer there is an inherent fairness issue: the peer (org) hosting the single enclave can stop processing requests if it doesn't like the state of the chaincode and prevent any progress (for other endorsement strategy this is a non-issue as any peer can be used to make progress). Depending on chaincode, this can be mitigated by careful choice of the designated peer to be at a org which is doesn't have any incentive to exploit this "priviilege" ...

    • ...

see HLGF slides (where we announced this guide :-) for more challenges/issues

g2flyer avatar Mar 19 '20 16:03 g2flyer

[maybe off topic] Realms in es/js at tc39 (frozen realms from SES secure ecmascript) has implemented an object graph with wet/dry as observable/private membranes to stop key leakage. A great deal of research already, this PR gives succinct insight into implementation details underway. https://github.com/salesforce/observable-membrane/pull/48

cliveb avatar May 27 '20 06:05 cliveb

Possibly add a pointer to/summary of guidelines for writing side-channel-resistant code, for most sensitive use cases

jrlinton avatar Jun 25 '20 15:06 jrlinton

Found this article

mbrandenburger avatar Sep 08 '20 21:09 mbrandenburger