GithubHelp home page GithubHelp logo

edge-core's People

Contributors

aholovko avatar baha-ai avatar bstasyszyn avatar fqutishat avatar grace0925 avatar moopli avatar rolsonquadras avatar sandrask avatar soluchok avatar sudeshrshetty avatar talwinder50 avatar troyronda avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edge-core's Issues

Implement CouchDB store

In addition to the non-persistent simple database from trustbloc/edge-store#27, we need a real CouchDB implementation.

This will be useful for edv.

CouchDB storage provider constructor should perform a smoke test

The CouchDB storage provider's NewProvider() constructor does not perform a smoke test to see if CouchDB is actually ready to be used.

Warning: using the kivik client's Ping() method is not enough because that just queries the _up endpoint, which doesn't guarantee the calls to create databases will succeed. PR hyperledger-archives/aries-framework-go#2180 took the approach of querying for the existence of the _users database as a proxy to determine whether the CouchDB database is ready for use.

Guard against sql injection:

I believe there's an SQL injection attack possibility here that needs to be addressed...unless this is somehow handled by the underlying library already. I found an article here that looks helpful: https://www.calhoun.io/what-is-sql-injection-and-how-do-i-avoid-it-in-go/

^ It describes how to avoid injection attacks via escaping (so you can still have your parameterized table name). Not sure if they're using the same library as you, but I assume there should be an equivalent if your library is different

#37 (comment)

BDD test docker utilities

Many projects can benefit from having the docker utility used in BDD tests implemented in this project and then reused.

Here is one example of the utility I'm referring to.

CouchDB provider's local cache will become invalid if a store is deleted by external forces

The CouchDB provider type keeps a local cache of CouchDBStore objects. If a client calls provider.OpenStore(), the method checks to see if the store already exists in the local cache so it doesn't have to do another network call, which should save time. When closing a store via the provider, this store will be removed from the local cache.

However, if the underlying database in CouchDB is removed by an external force, then that cache will be out of date and OpenStore will return a CouchDBStore object that will fail consistently. provider.CreateStore() would need to be called again to make that CouchDBStore object functional again, or alternatively a new Provider object could just be created.

Is this ok?

mysql store error: Error 1046: No database selected

Users may see this error after operating the mysql store for a while.

A likely cause of this problem is the implementation's use of the MySQL USE statement: it only applies to the connection in which it is executed.

Golang's sql/DB manages a pool of connections. Executing USE in one of them does not affect the rest. Also, connections in pools may be recycled after MySQL closes the connection due to idleness.

The implementation needs to ensure USE is ran on each connection that will be used to write or read data.

Related: trustbloc/adapter#295

zCAP-LD w/HTTP Signatures

Requirement

It is desired to enable an authorization strategy using a form of authorization capabilities where the sender's authentication and capability invocation are transmitted in HTTP message headers using HTTP signatures.

The capability invoker crafts an HTTP message with special headers indicating their KID, the content being signed over, as well as the actual signature itself. The sender's signing key is presumed to have been communicated out of band to the verifier.

Initial signing algorithm supported will be ECDSA using curve P-256 and SHA-256.

Note: we should not use (algorithm) since it enables attack vectors in some cases (eg. "ecdsa-sha256" section 5.1.2).

We will use igor-pavlenko/httpsignatures-go to create and parse HTTP signatures as per the HTTPbis draft.


Breakdown


Known spec issues #89 :


References

Put() should allow a deleted document to be recreated

When a document is deleted, couchDB does a soft delete and marks it at 'deleted'. If we attempt to fetch the deleted document with its ID, an error "Not Found: deleted" is thrown.

Currently, we do not take this into account when we check for errors from the getRevID() call which does not allow deleted docs to be recreated.

mysql store: several lint errors

I've been forced to update golangci-lint while working on #75 (because http.Request.Header.Value does not exist in whatever go version is shipped with golangci-lint 1.21) and found these errors:

pkg/storage/mysql/mysqlstore.go:166:30: rows.Err must be checked (rowserrcheck)
        rows, err := newDBConn.Query(
                                    ^
pkg/storage/mysql/mysqlstore.go:318:31: rows.Err must be checked (rowserrcheck)
        resultRows, err := s.db.Query(findQuery)
                                     ^
pkg/storage/mysql/mysqlstore.go:388:30: rows.Err must be checked (rowserrcheck)
        rows, err := indexStmt.Query(s.tableName)
                                    ^
pkg/storage/mysql/mysqlstore.go:383:32: Rows/Stmt was not closed (sqlclosecheck)
        indexStmt, err := s.db.Prepare(getIndexStmt)

This task is a followup to fix these linting issues.

store.Delete()

Would be good to have a Delete() method on the store interface.

Use case: transient storage, where a state machine needs to delete state to ensure a particular instance of the machine proceed properly on towards the next state.

storage: common API that selects appropriate provider given a DSN

It would be nice to have an API that looks like this:

// mysql provider automatically selected 
provider, err := storage.Open("mysql://root:my-secret-pw@tcp(127.0.0.1:3306)/")
if err != nil {
    // handle error
}

This would reduce refactors users would have to do when selecting different storage providers.

Current obstacles:

  • import cycle b/w storage package and implementation-specific packages
  • need to pass in implementation-specific options. Perhaps encode these options as url parameters?

Update to CouchDB 3

CouchDB is on version 3 now. Update Kivik, tests, etc and anything else that might need updating to support CouchDB 3. One notable change is that they got rid of "Admin Party mode", so some tweaks will need to be made to the tests as currently there isn't a proper admin user set up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.