embark-mythx/README.md

96 lines
3.3 KiB
Markdown
Raw Normal View History

2019-04-29 08:28:44 +00:00
![Running MythX analyses in Status Embark](https://cdn-images-1.medium.com/max/960/1*7jwHRc5J152bz704Fg7iug.png)
2019-05-07 09:35:36 +00:00
[![GitHub license](https://img.shields.io/github/license/flex-dapps/embark-mythx.svg)](https://github.com/flex-dapps/embark-mythx/blob/master/LICENSE)
![npm](https://img.shields.io/npm/v/embark-mythx.svg)
2019-04-26 16:28:51 +00:00
# Status Embark plugin for MythX.
2019-04-26 15:47:02 +00:00
This plugin brings MythX to Status Embark. Simply call `verify` from the Embark console and `embark-mythx` sends your contracts off for analysis. It is inspired by `truffle-security` and uses its source mapping and reporting functions.
2019-04-26 16:26:30 +00:00
## QuickStart
1. Create a `.env` file in the root of your project and provide your MythX login information. Free MythX accounts can be created at https://dashboard.mythx.io/#/registration.
2019-04-26 15:28:30 +00:00
2019-04-26 16:28:51 +00:00
```json
MYTHX_USERNAME="<mythx-username>"
2019-04-26 15:28:30 +00:00
MYTHX_PASSWORD="<password>"
```
> **NOTE:** `MYTHX_ETH_ADDRESS` has been deprecated in favour of `MYTHX_USERNAME` and will be removed in future versions. Please update your .env file or your environment variables accordingly.
`MYTHX_USERNAME` may be either of:
* MythX User ID (assigned by MythX API to any registered user);
* Ethereum address, if user account is associated with an address;
* A verified email address, if the user account is associated with an email address, and that address has been verified by visiting the verification link in the verification email sent by the MythX API each time when user email is set or modified in the MythX settings.
For more information, please see the [MythX API Login documentation](https://api.mythx.io/v1/openapi#operation/login).
2019-04-30 09:27:16 +00:00
2. Run `verify [options] [contracts]` in the Embark console. When the call returns, it will look something like this:
2019-04-26 16:28:51 +00:00
```bash
Embark (development) > verify
embark-mythx: Running MythX analysis in background.
embark-mythx: Submitting 'ERC20' for analysis...
embark-mythx: Submitting 'SafeMath' for analysis...
embark-mythx: Submitting 'Ownable' for analysis...
embark-mythx:
/home/flex/mythx-plugin/testToken/.embark/contracts/ERC20.sol
1:0 warning A floating pragma is set SWC-103
✖ 1 problem (0 errors, 1 warning)
embark-mythx: MythX analysis found vulnerabilities.
```
2019-04-26 16:26:30 +00:00
## Installation
2019-04-30 09:27:16 +00:00
0. Install this plugin from the root of your Embark project:
```bash
$ npm i embark-mythx
# or
$ npm i flex-dapps/embark-mythx
```
1. Add `embark-mythx` to the `plugins` section of your `embark.json` file. To have the plugin permanently ignore one or multiple contracts, add them to the configuration:
2019-04-26 16:28:51 +00:00
```json
"plugins": {
"embark-mythx": {
"ignore": ["Ownable", "Migrations"]
}
}
```
2019-04-26 16:26:30 +00:00
## Usage
2019-04-22 21:46:52 +00:00
2019-04-26 16:28:51 +00:00
```bash
2020-01-28 16:30:26 +00:00
verify [--full] [--debug] [--limit] [--initial-delay] [<contracts>]
2019-04-26 15:47:02 +00:00
verify status <uuid>
verify help
Options:
2020-01-28 16:30:26 +00:00
--full, -f Perform full instead of quick analysis (not available on free MythX tier).
2019-04-29 09:46:38 +00:00
--debug, -d Additional debug output.
--limit, -l Maximum number of concurrent analyses.
--initial-delay, -i Time in seconds before first analysis status check.
2019-04-26 15:47:02 +00:00
[<contracts>] List of contracts to submit for analysis (default: all).
status <uuid> Retrieve analysis status for given MythX UUID.
help This help.
2019-04-26 16:26:30 +00:00
```
### Example Usage
2019-04-26 16:28:51 +00:00
```bash
2019-04-26 16:26:30 +00:00
# Quick analysis on all contracts in project
2019-04-30 09:27:16 +00:00
$ verify
2019-04-26 16:26:30 +00:00
# 'ERC20' and 'Ownable' full analysis
2019-04-30 09:27:16 +00:00
$ verify ERC20 Ownable --full
2019-04-26 16:26:30 +00:00
2019-04-29 08:31:21 +00:00
# Check status of previous or ongoing analysis
2019-04-30 09:27:16 +00:00
$ verify status ef5bb083-c57a-41b0-97c1-c14a54617812
2019-04-26 15:47:02 +00:00
```