Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into master #1586

Merged
merged 167 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
f043990
Improve using for support
smonicas Aug 25, 2022
90520c5
Add parsing tests
smonicas Aug 26, 2022
cc3b342
Fix ir for top level function
smonicas Aug 27, 2022
928d7f2
Run black
smonicas Sep 19, 2022
aa68cac
Merge branch 'dev' into dev-fix-usingfor
montyly Oct 3, 2022
6571ada
run black
montyly Oct 3, 2022
3278417
Refactor parsing
smonicas Oct 3, 2022
2a6c145
upgradeability: include inherited private variables, ignore immutables
0xalpharush Nov 4, 2022
faed6d7
update constable-states to consider constructor vars which can be imm…
0xalpharush Nov 7, 2022
cf5d04f
ignore openzeppelin contracts
0xalpharush Nov 28, 2022
cfb53e8
support ternary in call value
0xalpharush Dec 3, 2022
e7aa92b
Use Codex to generate solidity documentation
montyly Dec 5, 2022
c38c4cb
Fix CI
montyly Dec 5, 2022
b484bde
Update ci.yml
montyly Dec 5, 2022
05fb191
Merge branch 'dev' into dev-doc
montyly Dec 6, 2022
f4299f7
Merge branch 'dev-doc' of github.com:crytic/slither into dev-doc
montyly Dec 6, 2022
2d64e16
Reenable dapp
montyly Dec 6, 2022
bc2b176
Merge branch 'dev' into dev-doc
montyly Dec 7, 2022
3537b95
Improvements
montyly Dec 7, 2022
eb49e39
support ternaries in both call options, refactor index access
0xalpharush Dec 10, 2022
a1a0abe
support parenthetical ternary expr and update tests
0xalpharush Dec 12, 2022
a1343a8
update function name
0xalpharush Dec 12, 2022
ca252f1
spelling and linting
0xalpharush Dec 12, 2022
59b9b03
analyze all inherited contracts' using for directives first
0xalpharush Dec 13, 2022
819fb77
Merge branch 'dev' into dev-fix-usingfor
0xalpharush Dec 13, 2022
2d41b96
rename FileScope.usingFor to using_for_directives
smonicas Dec 13, 2022
74122a6
fold binary expressions with constant operands for fuzzing guidance
0xalpharush Dec 16, 2022
fcd7b68
support bitwise and logical ops in constant folding, add tests
0xalpharush Dec 16, 2022
8870024
convert to int for operations not supported by Fraction
0xalpharush Dec 16, 2022
9d811e4
format tests
0xalpharush Dec 16, 2022
43aba2a
make pylint happy
0xalpharush Dec 16, 2022
e065fbe
emulate wrapped arithmetic behavior
0xalpharush Dec 16, 2022
a59f4f1
move folding logic out of Literal class
0xalpharush Dec 16, 2022
2684717
remove unnecessary return
0xalpharush Dec 20, 2022
e3c69e1
Merge branch 'dev' into dev-doc
montyly Dec 22, 2022
f12e367
Update to the latest crytic-compile source unit API
montyly Dec 22, 2022
9c339a6
Implement `--detect` and `--exclude`
webthethird Dec 23, 2022
194b1bd
Implement `--exclude-<impact>`
webthethird Dec 23, 2022
c66f2dc
Import `CheckClassification`
webthethird Dec 23, 2022
1965d26
Black
webthethird Dec 23, 2022
cd8c638
Don't sort checks by impact
webthethird Dec 23, 2022
d9ea635
Additional updates
montyly Jan 3, 2023
feafd9b
Improvements
montyly Jan 3, 2023
518137a
Use latest setuptools in CI
montyly Jan 3, 2023
217970f
Black
montyly Jan 3, 2023
af2fb96
Merge remote-tracking branch 'origin/dev-pip-audit-fix' into dev-sour…
montyly Jan 3, 2023
56096a2
Merge pull request #1542 from crytic/dev-pip-audit-fix
montyly Jan 3, 2023
2e1b508
Merge pull request #1528 from crytic/dev-source_unit
montyly Jan 3, 2023
1da0bdc
Merge branch 'dev-doc' of github.com:crytic/slither into dev
montyly Jan 3, 2023
53dfedd
Merge branch 'dev' into dev-doc
montyly Jan 3, 2023
45e90dc
Fix top level struct parsing
smonicas Jan 3, 2023
680c914
Add test
smonicas Jan 3, 2023
0494954
Minor
montyly Jan 3, 2023
656f214
chore(CI):removing solc-select install all lines
Pavan-Nambi Jan 3, 2023
df896e8
better error handling of malformed symbol alias AST node for solc <0.6.0
0xalpharush Jan 3, 2023
f92cb37
only check for local alias if foreign isn't dict
0xalpharush Jan 3, 2023
1b6acfa
format
0xalpharush Jan 3, 2023
3e67fff
update(#1546)
Pavan-Nambi Jan 3, 2023
4180607
update2(#1546)
Pavan-Nambi Jan 3, 2023
baf4143
move nested logic into functions
0xalpharush Jan 3, 2023
b68f4c1
pylint
0xalpharush Jan 3, 2023
222e382
Merge pull request #1545 from crytic/dev-top-level-struct
montyly Jan 4, 2023
bd3e450
Fix markdown@
montyly Jan 4, 2023
23d77e2
refractor(ver-in-path_filterin)
Pavan-Nambi Jan 4, 2023
8388597
Revert "refractor(ver-in-path_filterin)"
Pavan-Nambi Jan 4, 2023
9015e73
update(adding-more-installations)
Pavan-Nambi Jan 4, 2023
7067c6d
Merge branch 'dev' of github.com:crytic/slither into dev
montyly Jan 4, 2023
020d863
slither-doctor: remove LegacyVersion import, add `packaging` dependency
elopez Jan 4, 2023
4c759ca
slither-doctor: add new PATH checks
elopez Jan 4, 2023
c531681
ci: slither-doctor: add workflow
elopez Jan 4, 2023
b2ce731
slither-doctor: fix "unsupported format string passed to Version.__fo…
elopez Jan 4, 2023
21daf73
slither-doctor: log on stdout
elopez Jan 4, 2023
20198b9
slither-doctor: fix `is_relative_to` on Python 3.8
elopez Jan 4, 2023
e65031e
ci: slither-doctor: fix Windows venv execution
elopez Jan 4, 2023
21967c2
ci: slither-doctor: group output
elopez Jan 4, 2023
d753879
ci: slither-doctor: disable on branches, add dispatch
elopez Jan 4, 2023
b01ba03
ci: slither-doctor: disable Windows with Python 3.8
elopez Jan 4, 2023
407d35c
slither-doctor: fix lint error
elopez Jan 4, 2023
254f02b
Update expression_manipulations.py
montyly Jan 5, 2023
81c2a46
Merge pull request #1501 from crytic/call-value-ternary
montyly Jan 5, 2023
16ebaf6
Merge pull request #1532 from webthethird/dev-upgradeability-filter-c…
montyly Jan 5, 2023
75ee80c
Fix edge case + code quality
smonicas Jan 5, 2023
7798f47
make it easier to run specific tests and document
0xalpharush Jan 5, 2023
e524b72
typo
0xalpharush Jan 5, 2023
10085c1
add tests
0xalpharush Jan 5, 2023
92bad4c
add missing check in other places
0xalpharush Jan 5, 2023
8d3aa94
ci: etherscan: add output grouping
elopez Jan 5, 2023
52daece
lint
0xalpharush Jan 5, 2023
d72302f
ci: etherscan: sleep briefly when the API key is not available
elopez Jan 5, 2023
2109b5f
ci: etherscan: fix test check
elopez Jan 5, 2023
cc79f04
Merge branch 'dev' into handle-malformed-alias
0xalpharush Jan 5, 2023
ac624bf
ci: etherscan: re-enable test
elopez Jan 5, 2023
1c869df
Fix implicit conversion
smonicas Jan 5, 2023
2ee6d0a
Add tests
smonicas Jan 5, 2023
fe2b0ca
Merge branch 'dev' into dev-fix-usingfor
smonicas Jan 5, 2023
ea681f9
Fix testing feature
smonicas Jan 5, 2023
d4fd85a
fix overwriting test_file
0xalpharush Jan 5, 2023
f55cf6d
Merge pull request #1378 from crytic/dev-fix-usingfor
montyly Jan 5, 2023
4f0b74b
Merge branch 'dev' of github.com:crytic/slither into dev
montyly Jan 5, 2023
250c73e
Merge pull request #1451 from 0xalpharush/fix/upgradeability-private-…
montyly Jan 5, 2023
ed72163
Merge branch 'dev' of github.com:crytic/slither into dev
montyly Jan 5, 2023
c715463
WIP fix yul parsing
montyly Jan 5, 2023
0b99b34
minor
montyly Jan 5, 2023
d1b875d
update
Pavan-Nambi Jan 5, 2023
cbc3077
Fix using for with alias import
smonicas Jan 6, 2023
b595d8f
Create CODEOWNERS
montyly Jan 6, 2023
794b3b9
Add tests
smonicas Jan 6, 2023
53eea1d
Add missing file
montyly Jan 6, 2023
7c97d2e
Add --no-fail mode
montyly Jan 6, 2023
ed9cbf8
Fix types
montyly Jan 6, 2023
c81cc0c
Merge branch 'fix-usingfor' into dev-add-no-fail
montyly Jan 6, 2023
21384d1
Merge branch 'dev-fix-yul-parsing' into dev-add-no-fail
montyly Jan 6, 2023
8e4d388
improve import
montyly Jan 6, 2023
994cb5f
Merge pull request #1561 from crytic/codeowners
montyly Jan 6, 2023
bb19bce
Merge pull request #1556 from elopez/dev-fix-etherscan-test
montyly Jan 6, 2023
a9ee137
Merge pull request #1563 from crytic/fix-usingfor
montyly Jan 6, 2023
ceba99f
Merge pull request #1555 from crytic/feat/test-ids
montyly Jan 6, 2023
1c12f2a
tests: source_unit: add missing foundry submodule
elopez Jan 6, 2023
c23c0c4
Merge branch 'dev' into detect/add-immutable-opti
0xalpharush Jan 6, 2023
d875eff
Revert "tests: source_unit: add missing foundry submodule"
elopez Jan 6, 2023
afb7342
fix constructor var not detected as candidate, separate detectors
0xalpharush Jan 6, 2023
4685eac
parse semver
0xalpharush Jan 6, 2023
cfb5c4e
fix artifact
0xalpharush Jan 6, 2023
55c2428
tests: source_unit: remove submodule
elopez Jan 6, 2023
024729a
ci: fix Docker build
elopez Jan 6, 2023
48c7548
tests: source_unit: add skipif for requirements
elopez Jan 6, 2023
78caeb6
track type aliases at top level
0xalpharush Jan 7, 2023
c548dfd
Fix analyze library using for directives
smonicas Jan 7, 2023
f47f682
Run black
smonicas Jan 7, 2023
8670f17
Merge pull request #1568 from crytic/fix-usingfor-libraries
montyly Jan 9, 2023
d243fcc
Merge branch 'dev' of github.com:crytic/slither into dev
montyly Jan 9, 2023
36bad7c
Merge pull request #1494 from crytic/dev-doc
montyly Jan 9, 2023
5c375a8
Merge pull request #1564 from crytic/dev-fix-docker-build
montyly Jan 9, 2023
e492b29
Merge pull request #1547 from crytic/handle-malformed-alias
montyly Jan 9, 2023
a6ca165
Merge pull request #1546 from Pavan-Nambi/dev-ci
montyly Jan 9, 2023
cee26bc
Merge branch 'dev' of github.com:crytic/slither into dev
montyly Jan 9, 2023
17d3e8f
Merge branch 'dev' into dev-fix-yul-parsing
montyly Jan 9, 2023
0fd24c0
Merge pull request #1550 from crytic/dev-doctor-paths
montyly Jan 9, 2023
2263545
Update CODEOWNERS
montyly Jan 9, 2023
c5299d6
Update CODEOWNERS
montyly Jan 9, 2023
811dd78
Update literal.py
montyly Jan 9, 2023
b0b1c6a
Merge pull request #1569 from crytic/codeowner
montyly Jan 9, 2023
2e41679
Merge pull request #1508 from crytic/binary-constant-folding
montyly Jan 9, 2023
45c5ed9
Merge pull request #1455 from crytic/detect/add-immutable-opti
montyly Jan 9, 2023
aee2a78
Merge pull request #1559 from crytic/dev-fix-yul-parsing
montyly Jan 9, 2023
fac905b
Merge branch 'dev' into dev-add-no-fail
montyly Jan 9, 2023
5323860
Merge pull request #1571 from crytic/dev-add-no-fail
montyly Jan 9, 2023
7569131
fix type conversion of alias so library function can be found
0xalpharush Jan 9, 2023
b189951
resolve error referenced as member of contract
0xalpharush Jan 9, 2023
cf7c62b
add changes
0xalpharush Jan 9, 2023
e21d6eb
add ast test
0xalpharush Jan 9, 2023
1c63aa1
Merge pull request #1573 from crytic/type-alias-using-for
montyly Jan 10, 2023
4ed2a6a
Improve lookup for state variables
montyly Jan 10, 2023
33c1fd2
Add files
montyly Jan 10, 2023
2cb4985
Add type to type_alias
montyly Jan 10, 2023
20206a8
Improve convert_type_of_high_and_internal_level_call
montyly Jan 10, 2023
b8ff0b0
Merge pull request #1574 from crytic/contract-error-selector
montyly Jan 10, 2023
3646ea4
add tests
0xalpharush Jan 10, 2023
c2a397e
Merge branch 'dev' into top-level-type-aliases
0xalpharush Jan 10, 2023
4206739
add test case
0xalpharush Jan 10, 2023
fcf9367
Merge pull request #1577 from crytic/dev-convert_type_of_high_and_int…
montyly Jan 10, 2023
b8ee314
Merge pull request #1575 from crytic/dev-private-variable
montyly Jan 10, 2023
cacfefd
Merge pull request #1579 from crytic/top-level-type-aliases
montyly Jan 11, 2023
ac4742f
Merge pull request #1576 from crytic/dev-improve-type-alias
montyly Jan 11, 2023
e7cbfa9
Use crytic-compile@master
montyly Jan 11, 2023
7c3d8de
Update README
montyly Jan 11, 2023
9642d02
Merge pull request #1584 from crytic/README
montyly Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/IR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ jobs:
- name: Install dependencies
run: |
pip install ".[dev]"
solc-select install all
solc-select use 0.8.11
solc-select install 0.5.0
solc-select use 0.8.11 --always-install

- name: Install old solc
if: matrix.os == 'ubuntu-latest'
run: solc-select install 0.4.0


- name: Test with pytest
run: |
pytest tests/test_ssa_generation.py
pytest tests/test_ssa_generation.py
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# "embark",
"erc",
# "etherlime",
# "etherscan"
"etherscan",
"find_paths",
"flat",
"kspec",
Expand All @@ -55,8 +55,9 @@ jobs:
- name: Install dependencies
run: |
pip install ".[dev]"
solc-select install all
solc-select use 0.5.1
solc-select use 0.4.25 --always-install
solc-select use 0.8.0 --always-install
solc-select use 0.5.1 --always-install
pip install typing_extensions==4.1.1
pip install importlib_metadata==4.8.3

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/detectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ jobs:
run: |
pip install ".[dev]"

solc-select install all
solc-select use 0.7.3
solc-select use 0.7.3 --always-install
- name: Test with pytest
run: |
pytest tests/test_detectors.py
87 changes: 87 additions & 0 deletions .github/workflows/doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
name: CI

defaults:
run:
shell: bash

on:
workflow_dispatch:
pull_request:
paths:
- 'slither/tools/doctor/**'
- '.github/workflows/doctor.yml'

jobs:
slither-doctor:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
python: ["3.8", "3.9", "3.10", "3.11"]
exclude:
# strange failure
- os: windows-2022
python: 3.8
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Try system-wide Slither
run: |
echo "::group::Install slither"
pip3 install .
echo "::endgroup::"

# escape cwd so python doesn't pick up local module
cd /

echo "::group::Via module"
python3 -m slither.tools.doctor .
echo "::endgroup::"

echo "::group::Via binary"
slither-doctor .
echo "::endgroup::"

- name: Try user Slither
run: |
echo "::group::Install slither"
pip3 install --user .
echo "::endgroup::"

# escape cwd so python doesn't pick up local module
cd /

echo "::group::Via module"
python3 -m slither.tools.doctor .
echo "::endgroup::"

echo "::group::Via binary"
slither-doctor .
echo "::endgroup::"

- name: Try venv Slither
run: |
echo "::group::Install slither"
python3 -m venv venv
source venv/bin/activate || source venv/Scripts/activate
hash -r
pip3 install .
echo "::endgroup::"

# escape cwd so python doesn't pick up local module
cd /

echo "::group::Via module"
python3 -m slither.tools.doctor .
echo "::endgroup::"

echo "::group::Via binary"
slither-doctor .
echo "::endgroup::"
3 changes: 1 addition & 2 deletions .github/workflows/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ jobs:
run: |
pip install ".[dev]"

solc-select install all
solc-select use 0.8.0
solc-select use 0.8.0 --always-install

cd tests/test_node_modules/
npm install hardhat
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
python -m venv /tmp/pip-audit-env
source /tmp/pip-audit-env/bin/activate

python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install .

- name: Run pip-audit
Expand Down
6 changes: 6 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* @montyly @0xalpharush @smonicas
/slither/tools/read_storage/ @0xalpharush
/slither/tools/doctor/ @elopez
/slither/slithir/ @montyly
/slither/analyses/ @montyly
/.github/workflows/ @elopez
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ For each new detector, at least one regression tests must be present.
- If updating an existing detector, identify the respective json artifacts and then delete them, or run `python ./tests/test_detectors.py --overwrite` instead.
- Run `pytest ./tests/test_detectors.py` and check that everything worked.

To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/detectors --cov-branch --cov-report html`
To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/detectors --cov-branch --cov-report html`.
To run tests for a specific detector, run `pytest tests/test_detectors.py -k ReentrancyReadBeforeWritten` (the detector's class name is the argument).
To run tests for a specific version, run `pytest tests/test_detectors.py -k 0.7.6`.
The IDs of tests can be inspected using `pytest tests/test_detectors.py --collect-only`.

### Parser tests
- Create a test in `tests/ast-parsing`
Expand All @@ -73,6 +76,10 @@ To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/d
- Run `pytest ./tests/test_ast_parsing.py` and check that everything worked.

To see the tests coverage, run `pytest tests/test_ast_parsing.py --cov=slither/solc_parsing --cov-branch --cov-report html`
To run tests for a specific test case, run `pytest tests/test_ast_parsing.py -k user_defined_value_type` (the filename is the argument).
To run tests for a specific version, run `pytest tests/test_ast_parsing.py -k 0.8.12`.
To run tests for a specific compiler json format, run `pytest tests/test_ast_parsing.py -k legacy` (can be legacy or compact).
The IDs of tests can be inspected using ``pytest tests/test_ast_parsing.py --collect-only`.

### Synchronization with crytic-compile
By default, `slither` follows either the latest version of crytic-compile in pip, or `crytic-compile@master` (look for dependencies in [`setup.py`](./setup.py). If crytic-compile development comes with breaking changes, the process to update `slither` is:
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
FROM ubuntu:jammy AS python-wheels
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gcc \
git \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

COPY . /slither

RUN cd /slither && \
echo pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir --upgrade pip && \
pip3 wheel -w /wheels . solc-select pip setuptools wheel


Expand Down Expand Up @@ -44,7 +45,7 @@ ENV PATH="/home/slither/.local/bin:${PATH}"

# no-index ensures we install the freshly-built wheels
RUN --mount=type=bind,target=/mnt,source=/wheels,from=python-wheels \
pip3 install --user --no-cache-dir --upgrade --no-index --find-links /mnt pip slither-analyzer solc-select
pip3 install --user --no-cache-dir --upgrade --no-index --find-links /mnt --no-deps /mnt/*.whl

RUN solc-select install 0.4.25 && solc-select use 0.4.25

Expand Down
Loading