Skip to content

Commit

Permalink
feat: group by nep type
Browse files Browse the repository at this point in the history
  • Loading branch information
futuretech6 committed Jan 13, 2023
1 parent 3d9108a commit 7a5b282
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ docker exec -it -w /rustle rustle bash
* `tg_dir`: Path to the contract build target. Defaults to be same as `src_dir`.
* `detector`: The detector list. It can be used to pass multiple *detectors* or *groups* separated by `,`. Defaults to `all`.
* pass `all` *group* to enable all detectors.
* pass `high`, `medium`, `low` and `info` *groups* to enable detector groups with different severity
* pass `high`, `medium`, `low` and `info` *groups* to enable detector groups with different severity (refer to [Detectors](#detectors))
* pass `nep-ft`, `nep-storage` and `nep-nft` *groups* to enable detectors implemented for specified NEP (refer to [NEP detector groups](#nep-detector-groups))
* pass *detector ids* in the [table](#detectors) to enable those detectors
* `output`: Path where audit reports will be generated in. Defaults to `./audit-result`.

Expand Down Expand Up @@ -123,6 +124,16 @@ All vulnerabilities **Rustle** can find.
| `transfer` | [find all transfer actions](docs/detectors/transfer.md) | Info |
| `public-interface` | [find all public interfaces](docs/detectors/public-interface.md) | Info |

### NEP detector groups

Apart from the groups by severity level, **Rustle** provides some detector groups by corresponding NEP. Currently, **Rustle** supports the following groups.

| Detector-Group Id | Included Detectors |
| ----------------- | ------------------------------------------------------------ |
| `nep-ft` | `nep141-interface`, `self-transfer`, `unregistered-receiver` |
| `nep-storage` | `nep145-interface`, `unclaimed-storage-fee` |
| `nep-nft` | `nep171-interface`, `nft-approval-check`, `nft-owner-check` |

## Add new detector

1. Fork this repo to your account.
Expand Down
8 changes: 8 additions & 0 deletions rustle
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ _arg_detector=$(echo $_arg_detector | sed 's/\blow\b/prepaid-gas,non-callback-pr
_arg_detector=$(echo $_arg_detector | sed 's/\binfo\b/inconsistency,timestamp,ext-call,promise-result,transfer,complex-loop,public-interface/g')
_arg_detector=$(echo $_arg_detector | sed 's/\bnep-interface\b/nep141-interface,nep145-interface,nep148-interface,nep171-interface,nep177-interface,nep178-interface,nep181-interface,nep245-interface/g')

# expand by NEP type
## NEP141
_arg_detector=$(echo $_arg_detector | sed 's/\bnep-ft\b/nep141-interface,self-transfer,unregistered-receiver/g')
## NEP145
_arg_detector=$(echo $_arg_detector | sed 's/\bnep-storage\b/nep145-interface,unclaimed-storage-fee/g')
## NEP171,NEP178
_arg_detector=$(echo $_arg_detector | sed 's/\bnep-nft\b/nep171-interface,nft-approval-check,nft-owner-check/g')

# run audit

make -C $TOP clean_tmp
Expand Down

0 comments on commit 7a5b282

Please sign in to comment.