Git Product home page Git Product logo

smart-contracts's Introduction

An easy option is properly using the validana-cli (https://github.com/DvdGiessen/validana-cli). A user interface is still on the planning. Attached are the contracts in json format, as expected by the validana-cli. Start by creating the institution and then the entity contract.

Example usage:
Make sure to update the url, prefix and signing key to that of the processor.

validana-cli contract create --url wss://edubadges.com:8080/api/v1/ --prefix edubadges --signing-key KyJPCoYvgXaNpvTPshw52Nu5HyHq9jrUGmoCSkEvjbTgyQPWkJX5 --contract-file "path/to/contract/URL.json"

(Optional)

validana-cli transaction await --url wss://edubadges.com:8080/api/v1/ --prefix edubadges --id b043790915bc2f9b6bf8ae470f49c32d

Once all contract are created change call the url contract with the rest url of the server, e.g.:

validana-cli contract execute --url wss://edubadges.com:8080/api/v1/ --prefix edubadges --signing-key KyJPCoYvgXaNpvTPshw52Nu5HyHq9jrUGmoCSkEvjbTgyQPWkJX5 --contract-type URL --payload '{"url":"https://edubadges.com/api/v1/"}'

(Optional)

validana-cli transaction await --url wss://edubadges.com:8080/api/v1/ --prefix edubadges --id b043790915bc2f9b6bf8ae470f49c32d

smart-contracts's People

Contributors

fransward avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

smart-contracts's Issues

smart-contracts/Badge\ Class.txt: Database queries being formed with concatenation of strings/stringified values

Database queries being formed with concatenation of strings/stringified values

In smart-contract module, Badge\ Class.txt file, query is constructed using string concatenation and uses parameters directly, which may lead to query injection issues.

The attack vector is a peer node in the blockchain community - which can send malicious parameters causing SQL injection.

  1. $1 is used by concatenation
    Line 19: const entity = await query("SELECT", "entities", "WHERE entity = $1;", [from]);
    Line 29: const institution = await query("SELECT", "institutions", "WHERE institution = $1;"

  2. $3 is used by concatenation
    Line 41: + "ON CONSTRAINT endorseclasses_pkey DO UPDATE SET endorsed = $3;"

  3. $1, $2, $3 is used by concatenation
    Line 45: const changed = await query("UPDATE", "endorseclasses", "SET endorsed = $3 WHERE class = $1 AND entity = $2;"

smart-contracts/Entity.txt : Database queries being formed with concatenation of strings/stringified values

In smart-contract module, Entity.txt file, query is constructed using string concatenation and uses parameters directly, which may lead to query injection issues.

The attack vector is a peer node in the blockchain community - which can send malicious parameters causing SQL injection.

  1. The WHERE clause uses $1 by concatenation Line 12,13: //Check if the institution exists and is allowed to create/unwithdraw entities. const institution = await query("SELECT", "institutions", "WHERE institution = $1;", [from]);

  2. $2 and $3 are directly used by concatenation Line 27: "ON CONFLICT ON CONSTRAINT entities_pkey DO UPDATE SET allowed = true, name = $3 WHERE entities.institution = $2;", [payload.receiver, from, payload.name]);

  3. $1 and $2 are used by concatenation Line 34: const changed = await query("UPDATE", "entities", "SET allowed = false WHERE entity = $1 AND institution = $2;"

smart-contracts/Metadata.txt : Database queries being formed with concatenation of strings/stringified values

Database queries being formed with concatenation of strings/stringified values

In smart-contract module, Metadata.txt file, query is constructed using string concatenation and uses parameters directly, which may lead to query injection issues.

The attack vector is a peer node in the blockchain community - which can send malicious parameters causing SQL injection.

  1. $1 is used by concatenation
    Line 15: const entity = await query("SELECT", "entities", "WHERE entity = $1;", [from]);
    Line 24: const institution = await query("SELECT", "institutions", "WHERE institution = $1;"

  2. $1, $2 and $2 are used by concatenation
    Line 30: const changed = await query("UPDATE", "badgeclasses", "SET metadata = $3 WHERE class = $1 AND first_endorser = $2;", [payload.badgeClass, from, payload.metadata]);

smart-contracts/Badge.txt : Database queries being formed with concatenation of strings/stringified values

Database queries being formed with concatenation of strings/stringified values

In smart-contract module, Badge.txt file, query is constructed using string concatenation and uses parameters directly, which may lead to query injection issues.

The attack vector is a peer node in the blockchain community - which can send malicious parameters causing SQL injection.

  1. $1 is used by concatenation
    Line 16: const entity = await query("SELECT", "entities", "WHERE entity = $1;", [from]);

  2. $1 is used by concatenation
    Line 25: const institution = await query("SELECT", "institutions", "WHERE institution = $1;"

smart-contracts/Institutions.txt : Database queries being formed with concatenation of strings/stringified values

Database queries being formed with concatenation of strings/stringified values

In smart-contract module, Institutions.txt file, query is constructed using string concatenation and uses parameters directly, which may lead to query injection issues.

The attack vector is a peer node in the blockchain community - which can send malicious parameters causing SQL injection.

  1. $2 is used by concatenation
    Line 23:"ON CONSTRAINT institutions_pkey DO UPDATE SET name = $2, allowed = true;"
  2. $1 is used by concatenation

Line 26:const changed = await query("UPDATE", "institutions", "SET allowed = false WHERE institution = $1;"

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.