Skip to content

Commit e80099d

Browse files
authored
Merge pull request #88 from pessimistic-io/develop
Slitherin 0.4.0
2 parents fbefc99 + 9b6b6e3 commit e80099d

23 files changed

+289
-33
lines changed

.github/workflows/notification.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: notification
22

33
on:
4-
push:
5-
branches: [ master ]
4+
release:
5+
types: [ published ]
66

77
jobs:
88

@@ -15,4 +15,4 @@ jobs:
1515
to: ${{ secrets.TELEGRAM_TO }}
1616
token: ${{ secrets.BOT_TOKEN }}
1717
message: |
18-
Master branch received updates. Pull new features from https://github.com/pessimistic-io/slitherin.
18+
New version of Slitherin got realeased. Pull updates from here: https://github.com/pessimistic-io/slitherin or update a Python package: https://pypi.org/project/slitherin/. Release note: https://github.com/pessimistic-io/slitherin/releases

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55
types: [published]
66

77
jobs:
8-
publish:
8+
deploy:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-python@v2
1313
with:
14-
python-version: '3.8'
14+
python-version: '3.x'
1515
- name: Install dependencies
1616
run: |
1717
python -m pip install --upgrade pip
18-
pip install -e .[distribute]
18+
pip install setuptools wheel twine
1919
- name: Build and publish
2020
env:
2121
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pip install slitherin
7979

8080
- *Valid - issues included in reports and fixed by developers (January 2023 - June 2023).
8181

82-
- There is one detector that is disabled by default: [pess-uni-v2](https://github.com/pessimistic-io/slitherin/blob/master/slither_pess/detectors/uni_v2.py). **It is recommended to run it only on projects that integrate [Uniswap V2](https://betterprogramming.pub/uniswap-v2-in-depth-98075c826254)!**
82+
- There is one integration detector which has several checks inside: [pess-uni-v2](https://github.com/pessimistic-io/slitherin/blob/master/slither_pess/detectors/uni_v2.py). **It runs only on projects that integrate [Uniswap V2](https://betterprogramming.pub/uniswap-v2-in-depth-98075c826254)!**
8383

8484
## Enhancements & New Detectors
8585

docs/ecrecover.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Ecrecover
2+
3+
## Configuration
4+
5+
- Check: `pess-ecrecover`
6+
- Severity: `High`
7+
- Confidence: `Medium`
8+
9+
## Description
10+
11+
`ecrecover` functions returns `0` on error. It is important to check the result for `0`.
12+
13+
### Potential Improvement
14+
15+
As for now, the detector might not work on asm level.
16+
17+
## Vulnerable Scenario
18+
19+
[test scenarios](../tests/ecrecover.sol)
20+
21+
## Recommendation
22+
23+
Check the result of `ecrecover` or use OZ ECDSA library.

docs/integration_uniswapV2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# UniswapV2 Integration
22

3-
Disabled by default. Use `--detect pess-uni-v2` to enable the detector.
3+
Looks for contracts inheritance. Use `--detect pess-uni-v2` to forcefully enable the detector.
44

55
## Configuration
66
* Check: `pess-uni-v2`

docs/public_vs_external.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Public vs External
2+
3+
## Configuration
4+
5+
- Check: `pess-public-vs-external`
6+
- Severity: `Low`
7+
- Confidence: `Medium`
8+
9+
## Description
10+
11+
Detects functions that have `public` modifiers and could be turned into `external` (not used in the contract)
12+
13+
### Potential Improvement
14+
15+
There could be FP's because of inheritance
16+
17+
## Vulnerable Scenario
18+
19+
[test scenarios](../tests/public_vs_external_test.sol)
20+
21+
## Recommendation
22+
23+
Mark `public` functions as `external` where it is possible to enhance control-flow readability.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
long_description_content_type="text/markdown",
1111
url="https://github.com/pessimistic-io/slitherin",
1212
author="Pessimistic.io",
13-
version="0.3.0",
13+
version="0.4.0",
1414
package_dir={"":"."},
1515
packages=find_packages(),
1616
license="AGPL-3.0",

slither_pess/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from slither_pess.detectors.uni_v2 import UniswapV2
2121
from slither_pess.detectors.token_fallback import TokenFallback
2222
from slither_pess.detectors.for_continue_increment import ForContinueIncrement
23+
from slither_pess.detectors.ecrecover import Ecrecover
24+
from slither_pess.detectors.public_vs_external import PublicVsExternal
2325

2426

2527
def make_plugin():
@@ -44,6 +46,8 @@ def make_plugin():
4446
TokenFallback,
4547
ForContinueIncrement,
4648
ArbitraryCall,
49+
Ecrecover,
50+
PublicVsExternal,
4751
]
4852
plugin_printers = []
4953

slither_pess/detectors/arbitrary_call.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from collections import namedtuple
2-
from dataclasses import dataclass
3-
from typing import Dict, List, Optional, Tuple, Set
1+
from typing import List, Tuple
42

53
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
6-
from slither.slithir.operations import TypeConversion, Operation, SolidityCall
4+
from slither.slithir.operations import SolidityCall
75
from slither.core.declarations import (
86
Contract,
97
SolidityVariableComposed,

slither_pess/detectors/before_token_transfer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import List
22
from slither.utils.output import Output
33
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
4-
from slither.core.declarations import Function
54

65

76
class BeforeTokenTransfer(AbstractDetector):

0 commit comments

Comments
 (0)