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

sync master<>dev #2341

Merged
merged 110 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
cd3f2d4
Update Dockerfile
0xalpharush Oct 18, 2023
ea708cd
remove unused files
0xalpharush Oct 20, 2023
8d9199e
Update installation instrucitons
0xalpharush Oct 18, 2023
112786f
Update README.md
VIELITE Oct 23, 2023
0cd9efe
Bump actions/setup-node from 3 to 4
dependabot[bot] Oct 23, 2023
c1a1675
added update reachability to modifiers
Tiko7454 Oct 24, 2023
0994edf
Update modifier.py
Tiko7454 Oct 24, 2023
2940d26
Merge pull request #2198 from VIELITE/master
montyly Oct 26, 2023
78ba65b
Merge pull request #2189 from crytic/0xalpharush-patch-2
montyly Oct 26, 2023
c311054
Merge pull request #2188 from crytic/0xalpharush-patch-1
montyly Oct 26, 2023
fbd578a
Merge pull request #2199 from crytic/dependabot/github_actions/dev/ac…
montyly Oct 26, 2023
b7ba2c4
fix is_reentrant for internal vyper functions
0xalpharush Nov 1, 2023
4a33541
Add support top level events
smonicas Nov 6, 2023
912d6b2
Error when a missing contract is specified to read-storage. Previousl…
UsmannK Nov 16, 2023
456a414
Merge pull request #2235 from UsmannK/usmannk/add-missing-contract-error
0xalpharush Nov 18, 2023
a793c3f
Don't report if msg.value is in a conditional expression
smonicas Nov 20, 2023
80b624c
Bump cachix/install-nix-action from 23 to 24
dependabot[bot] Dec 4, 2023
4673fda
Bump actions/configure-pages from 3 to 4
dependabot[bot] Dec 4, 2023
11def5d
Bump actions/deploy-pages from 2 to 3
dependabot[bot] Dec 4, 2023
9b74e21
Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11
dependabot[bot] Dec 4, 2023
e5d2927
Merge pull request #2252 from crytic/dependabot/github_actions/dev/ca…
0xalpharush Dec 4, 2023
de29c2a
Merge pull request #2253 from crytic/dependabot/github_actions/dev/ac…
0xalpharush Dec 4, 2023
05310b4
Merge pull request #2254 from crytic/dependabot/github_actions/dev/ac…
0xalpharush Dec 4, 2023
b8456eb
Merge pull request #2255 from crytic/dependabot/github_actions/dev/py…
0xalpharush Dec 4, 2023
3e62ea6
Merge pull request #2197 from crytic/remove-unused-files
0xalpharush Dec 4, 2023
deebe36
Merge pull request #2211 from crytic/fix-vyper-is-reentrant
0xalpharush Dec 4, 2023
ff0e85d
Substituted the letter 'z' with 'x' in pre-declaration
ATREAY Dec 7, 2023
40536d8
Merge pull request #2258 from ATREAY/docs
0xalpharush Dec 8, 2023
a036598
updated mutator
vishnuram1999 Jan 2, 2024
37c23e1
Updated replace string logic
vishnuram1999 Jan 3, 2024
36eda1b
Added new mutant generators
vishnuram1999 Jan 6, 2024
67b95df
Added new mutators
vishnuram1999 Jan 9, 2024
df42cb6
Updated mutators
vishnuram1999 Jan 15, 2024
9db7167
Updated run_test_cmd
vishnuram1999 Jan 16, 2024
6ad193a
updated create patch
vishnuram1999 Jan 17, 2024
96e8adc
Added contract_names arg
vishnuram1999 Jan 18, 2024
48b6f6f
updated quick
vishnuram1999 Jan 20, 2024
799117d
Added README
vishnuram1999 Jan 21, 2024
5fb5f69
Updated arguments
vishnuram1999 Jan 24, 2024
71f970f
Updated mutators
vishnuram1999 Jan 24, 2024
c8462b2
Updated files
vishnuram1999 Jan 25, 2024
f0bb9d3
Updated with formatting
vishnuram1999 Jan 26, 2024
611150b
Add support Solidity 0.8.24
smonicas Jan 26, 2024
0dcab3b
Add BASEFEE for Yul
smonicas Jan 26, 2024
a8cb6be
Lint
smonicas Jan 26, 2024
c5f1537
Formatted mutators
vishnuram1999 Jan 26, 2024
360509f
Formatted test_patch
vishnuram1999 Jan 26, 2024
afa604d
Merge pull request #2278 from vishnuram1999/slither-mutate-upgrade
0xalpharush Jan 29, 2024
d6e40af
Bump cachix/cachix-action from 12 to 14 (#2275)
dependabot[bot] Jan 29, 2024
340cbe0
Bump actions/upload-artifact from 3 to 4 (#2265)
dependabot[bot] Jan 29, 2024
b83fa21
Bump actions/setup-python from 4 to 5 (#2259)
dependabot[bot] Jan 29, 2024
b292175
Detect also in modifiers (#2280)
smonicas Jan 29, 2024
28a921e
Fix/iterative update (#2206)
0xalpharush Jan 29, 2024
4454b3e
fix: detect selfdestruct in internal calls (#2232)
0xalpharush Jan 29, 2024
8399f97
Bump actions/deploy-pages from 3 to 4 (#2285)
dependabot[bot] Jan 30, 2024
1bd279a
Bump cachix/install-nix-action from 24 to 25 (#2286)
dependabot[bot] Jan 30, 2024
1b0d63b
Bump sigstore/gh-action-sigstore-python from 2.1.0 to 2.1.1 (#2293)
dependabot[bot] Feb 6, 2024
9bf4d07
Bump actions/upload-pages-artifact from 2 to 3 (#2294)
dependabot[bot] Feb 6, 2024
6620bc9
Fix using for when used with "this" (#2224)
smonicas Feb 6, 2024
4f09d23
Make triage database path customizable
elopez Feb 7, 2024
e876d61
fix: broken doc links (#2299)
mds1 Feb 8, 2024
044c6be
Merge branch 'crytic:dev' into dev
Tiko7454 Feb 13, 2024
247a90e
fixed immediate inheritance
Tiko7454 Feb 13, 2024
50f1b98
reformatted
Tiko7454 Feb 13, 2024
9fd6128
Changes to be committed:
sxhthreo Feb 15, 2024
b66b3e0
slither: utils: respect colorization state when printing tables
elopez Feb 16, 2024
3eebf49
Bump actions/download-artifact from 3 to 4
dependabot[bot] Dec 18, 2023
b107e9e
Bump actions/upload-artifact from 3 to 4
elopez Feb 16, 2024
4a6920a
ci: test: adjust to new artifact merging behavior
elopez Feb 16, 2024
4e52b40
Merge pull request #2264 from crytic/dependabot/github_actions/dev/ac…
0xalpharush Feb 16, 2024
029d5db
Merge pull request #2310 from elopez/dev-colorless
0xalpharush Feb 16, 2024
65fcb4b
Merge pull request #2219 from crytic/dev-tp-events
0xalpharush Feb 16, 2024
261182f
tools: properties: correct tool description and usage
elopez Feb 17, 2024
9996e4e
tools: documentation: correct tool description
elopez Feb 17, 2024
f2f7598
fmt
0xalpharush Feb 17, 2024
82645a9
Merge pull request #2311 from crytic/dev-slither-prop
0xalpharush Feb 17, 2024
9fa8e8e
Merge pull request #2312 from crytic/fix/example
0xalpharush Feb 17, 2024
4f4acae
feat: address issue #1644 and add new api to return state variables t…
dokzai Feb 18, 2024
591c4c0
Add test
smonicas Feb 19, 2024
350eef3
Merge branch 'dev' into dev-solidity-0.8.24
smonicas Feb 19, 2024
fda9935
Add ENDASSEMLBY node for solc < 0.6.0
smonicas Feb 19, 2024
f57c2ca
Detect only assembly blocks
smonicas Feb 19, 2024
18ec60e
Update tests
smonicas Feb 19, 2024
3163e24
Merge pull request #2298 from crytic/dev-triage-db
0xalpharush Feb 19, 2024
3ff3103
fix: support renaming in base inheritance and base constructor calls
0xalpharush Feb 20, 2024
e580b2f
pylint
0xalpharush Feb 20, 2024
052a30a
add regression test for https://github.com/crytic/slither/issues/2313
0xalpharush Feb 20, 2024
47fdb81
Delete file
smonicas Feb 20, 2024
a99f90b
remove unnecessary use of list comprehension
dokzai Feb 20, 2024
9c868e7
Merge pull request #2323 from dokzai/issue-1644
0xalpharush Feb 20, 2024
fc244e4
Merge pull request #2321 from crytic/test/modifier-data-dependency
0xalpharush Feb 20, 2024
4580844
Merge pull request #2281 from crytic/dev-solidity-0.8.24
0xalpharush Feb 20, 2024
942adb1
Merge pull request #2320 from crytic/fix/inheritance-renaming
0xalpharush Feb 20, 2024
dc2c8cb
Merge pull request #2239 from crytic/dev-msgvalue-loop-fps
0xalpharush Feb 20, 2024
5d140f7
Merge pull request #2315 from crytic/dev-shift-mixup
0xalpharush Feb 20, 2024
d592e76
Track storage variables read/written in assembly
smonicas Feb 20, 2024
123760a
Bump docker/metadata-action from 4 to 5
dependabot[bot] Feb 20, 2024
a9163d2
Add --include-paths option
smonicas Feb 20, 2024
c0d4dde
Lint
smonicas Feb 20, 2024
a844f2d
Merge pull request #2146 from crytic/dependabot/github_actions/dev/do…
0xalpharush Feb 20, 2024
665b630
fix: support inheritance resolution when contract name is reused
0xalpharush Feb 21, 2024
69d3c25
feat: add out-of-order-retryable ticket detector
0xalpharush Feb 28, 2024
04ff85f
make it interprocedural (only 1 call deep)
0xalpharush Feb 28, 2024
75c1159
add test showing two internal call example is caught
0xalpharush Feb 29, 2024
23c4cce
Merge pull request #2332 from crytic/fix/inheritance-resolving-duplic…
0xalpharush Feb 29, 2024
801a13e
add regression test for https://github.com/crytic/slither/issues/2325
0xalpharush Feb 29, 2024
1854c14
Merge pull request #2340 from crytic/feat/out-of-order-retryable-dete…
0xalpharush Feb 29, 2024
754d64d
Merge pull request #2329 from crytic/dev-constant-yul
0xalpharush Feb 29, 2024
a8915a8
update --inlude-paths help
0xalpharush Feb 29, 2024
a8dc50e
Merge pull request #2330 from crytic/dev-include-paths
0xalpharush Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/actions/upload-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ runs:
# This method has the limitation of 1 coverage file per run, limiting some coverage between online/offline tests.
- run: |
COVERAGE_UUID=$(python3 -c "import uuid; print(uuid.uuid4())")
echo "COVERAGE_UUID=${COVERAGE_UUID}" >> $GITHUB_OUTPUT
echo "COVERAGE_UUID=${COVERAGE_UUID}" >> "$GITHUB_OUTPUT"
if [ -f .coverage ]; then
mv .coverage .coverage.${COVERAGE_UUID}
fi
id: coverage-uuid
shell: bash
- uses: actions/upload-artifact@v3.1.0
- uses: actions/upload-artifact@v4
with:
name: coverage-data
name: coverage-data-${{ steps.coverage-uuid.outputs.COVERAGE_UUID }}
path: |
.coverage.*
*.lcov
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
Expand All @@ -67,11 +67,11 @@ jobs:

- name: Set up nix
if: matrix.type == 'dapp'
uses: cachix/install-nix-action@v23
uses: cachix/install-nix-action@v25

- name: Set up cachix
if: matrix.type == 'dapp'
uses: cachix/cachix-action@v12
uses: cachix/cachix-action@v14
with:
name: dapp

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Set Docker metadata
id: metadata
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
- uses: actions/setup-python@v4
uses: actions/configure-pages@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- run: pip install -e ".[doc]"
- run: pdoc -o html/ slither '!slither.tools' #TODO fix import errors on pdoc run
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
# Upload the doc
path: './html/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4

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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

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 @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'

Expand All @@ -23,7 +23,7 @@ jobs:
python -m pip install build
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: slither-dists
path: dist/
Expand All @@ -38,16 +38,16 @@ jobs:
- build-release
steps:
- name: fetch dists
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: slither-dists
path: dist/

- name: publish
uses: pypa/[email protected].10
uses: pypa/[email protected].11

- name: sign
uses: sigstore/[email protected].0
uses: sigstore/[email protected].1
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fetch-depth: 0

- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
Expand All @@ -40,7 +40,7 @@ jobs:
pip install ".[test]"

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
Expand Down Expand Up @@ -102,16 +102,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

- run: pip install coverage[toml]

- name: download coverage data
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
name: coverage-data
pattern: coverage-data-*
merge-multiple: true

- name: combine coverage data
id: combinecoverage
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ ENV PATH="/home/slither/.local/bin:${PATH}"
RUN --mount=type=bind,target=/mnt,source=/wheels,from=python-wheels \
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
RUN solc-select use latest --always-install

CMD /bin/bash
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Slither - Read the Docs](https://img.shields.io/badge/Slither-Read_the_Docs-2ea44f)](https://crytic.github.io/slither/slither.html)
[![Slither - Wiki](https://img.shields.io/badge/Slither-Wiki-2ea44f)](https://github.com/crytic/slither/wiki/SlithIR)

> Join the Empire Hacking Slack
> Join the Empire Hacking Slack
>
> [![Slack Status](https://slack.empirehacking.nyc/badge.svg)](https://slack.empirehacking.nyc/)
> > <sub><i>- Discussions and Support </i></sub>
Expand Down Expand Up @@ -46,7 +46,7 @@
* Correctly parses 99.9% of all public Solidity code
* Average execution time of less than 1 second per contract
* Integrates with Github's code scanning in [CI](https://github.com/marketplace/actions/slither-action)
* Support for Vyper
* Support for Vyper smart contracts

## Usage

Expand All @@ -73,14 +73,14 @@ If you're **not** going to use one of the [supported compilation frameworks](htt
### Using Pip

```console
pip3 install slither-analyzer
python3 -m pip install slither-analyzer
```

### Using Git

```bash
git clone https://github.com/crytic/slither.git && cd slither
python3 setup.py install
python3 -m pip install .
```

We recommend using a Python virtual environment, as detailed in the [Developer Installation Instructions](https://github.com/trailofbits/slither/wiki/Developer-installation), if you prefer to install Slither via git.
Expand Down Expand Up @@ -131,10 +131,10 @@ Num | Detector | What it Detects | Impact | Confidence
20 | `controlled-delegatecall` | [Controlled delegatecall destination](https://github.com/crytic/slither/wiki/Detector-Documentation#controlled-delegatecall) | High | Medium
21 | `delegatecall-loop` | [Payable functions using `delegatecall` inside a loop](https://github.com/crytic/slither/wiki/Detector-Documentation/#payable-functions-using-delegatecall-inside-a-loop) | High | Medium
22 | `incorrect-exp` | [Incorrect exponentiation](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-exponentiation) | High | Medium
23 | `incorrect-return` | [If a `return` is incorrectly used in assembly mode.](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-assembly-return) | High | Medium
23 | `incorrect-return` | [If a `return` is incorrectly used in assembly mode.](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-return-in-assembly) | High | Medium
24 | `msg-value-loop` | [msg.value inside a loop](https://github.com/crytic/slither/wiki/Detector-Documentation/#msgvalue-inside-a-loop) | High | Medium
25 | `reentrancy-eth` | [Reentrancy vulnerabilities (theft of ethers)](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities) | High | Medium
26 | `return-leave` | [If a `return` is used instead of a `leave`.](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-assembly-return) | High | Medium
26 | `return-leave` | [If a `return` is used instead of a `leave`.](https://github.com/crytic/slither/wiki/Detector-Documentation#return-instead-of-leave-in-assembly) | High | Medium
27 | `storage-array` | [Signed storage integer array compiler bug](https://github.com/crytic/slither/wiki/Detector-Documentation#storage-signed-integer-array) | High | Medium
28 | `unchecked-transfer` | [Unchecked tokens transfer](https://github.com/crytic/slither/wiki/Detector-Documentation#unchecked-transfer) | High | Medium
29 | `weak-prng` | [Weak PRNG](https://github.com/crytic/slither/wiki/Detector-Documentation#weak-PRNG) | High | Medium
Expand Down
14 changes: 14 additions & 0 deletions examples/scripts/data_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,17 @@
assert is_tainted(var_tainted, contract)
print(f"{var_not_tainted} is tainted: {is_tainted(var_not_tainted, contract)}")
assert not is_tainted(var_not_tainted, contract)

print("SimpleModifier contract")
contracts = slither.get_contract_from_name("SimpleModifier")
assert len(contracts) == 1
contract = contracts[0]
dependent_state_var = contract.get_state_variable_from_name("owner")
assert dependent_state_var
baz = contract.get_modifier_from_signature("baz()")
intermediate = baz.get_local_variable_from_name("intermediate")
assert intermediate
print(
f"{intermediate} depends on msg.sender: {is_dependent(intermediate, SolidityVariableComposed('msg.sender'), baz)}"
)
assert is_dependent(intermediate, SolidityVariableComposed("msg.sender"), baz)
9 changes: 9 additions & 0 deletions examples/scripts/data_dependency.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,12 @@ contract PropagateThroughReturnValue {
return (var_state);
}
}

contract SimpleModifier {
address owner;
modifier baz {
bool intermediate = msg.sender == owner;
require(intermediate);
_;
}
Comment on lines +119 to +125
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SimpleModifier contract introduces a baz modifier to check if msg.sender is the owner. This is a common pattern for access control. However, the owner variable is declared but not initialized, which means it will default to the zero address. Ensure that the owner is correctly initialized, typically in the constructor, to prevent unauthorized access.

contract SimpleModifier {
    address owner;
+   constructor() {
+       owner = msg.sender;
+   }
    modifier baz {
        bool intermediate = msg.sender == owner;
        require(intermediate);
        _;
    }
}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
contract SimpleModifier {
address owner;
modifier baz {
bool intermediate = msg.sender == owner;
require(intermediate);
_;
}
contract SimpleModifier {
address owner;
constructor() {
owner = msg.sender;
}
modifier baz {
bool intermediate = msg.sender == owner;
require(intermediate);
_;
}
}

}
3 changes: 2 additions & 1 deletion examples/scripts/possible_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def resolve_function(contract_name, function_name):
contract = contracts[0]
# Obtain the target function
target_function = next(
(function for function in contract.functions if function.name == function_name), None
(function for function in contract.functions_declared if function.name == function_name),
None,
)

# Verify we have resolved the function specified.
Expand Down
45 changes: 32 additions & 13 deletions slither/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ def choose_printers(
###################################################################################


def parse_filter_paths(args: argparse.Namespace) -> List[str]:
if args.filter_paths:
return args.filter_paths.split(",")
def parse_filter_paths(args: argparse.Namespace, filter_path: bool) -> List[str]:
paths = args.filter_paths if filter_path else args.include_paths
if paths:
return paths.split(",")
return []


Expand Down Expand Up @@ -307,6 +308,7 @@ def parse_args(
"Checklist (consider using https://github.com/crytic/slither-action)"
)
group_misc = parser.add_argument_group("Additional options")
group_filters = parser.add_mutually_exclusive_group()

group_detector.add_argument(
"--detect",
Expand Down Expand Up @@ -518,22 +520,22 @@ def parse_args(
default=defaults_flag_in_config["disable_color"],
)

group_misc.add_argument(
"--filter-paths",
help="Regex filter to exclude detector results matching file path e.g. (mocks/|test/)",
action="store",
dest="filter_paths",
default=defaults_flag_in_config["filter_paths"],
)

group_misc.add_argument(
"--triage-mode",
help="Run triage mode (save results in slither.db.json)",
help="Run triage mode (save results in triage database)",
action="store_true",
dest="triage_mode",
default=False,
)

group_misc.add_argument(
"--triage-database",
help="File path to the triage database (default: slither.db.json)",
action="store",
dest="triage_database",
default=defaults_flag_in_config["triage_database"],
)

group_misc.add_argument(
"--config-file",
help="Provide a config file (default: slither.config.json)",
Expand Down Expand Up @@ -571,6 +573,22 @@ def parse_args(
default=defaults_flag_in_config["no_fail"],
)

group_filters.add_argument(
"--filter-paths",
help="Regex filter to exclude detector results matching file path e.g. (mocks/|test/)",
action="store",
dest="filter_paths",
default=defaults_flag_in_config["filter_paths"],
)

group_filters.add_argument(
"--include-paths",
help="Regex filter to include detector results matching file path e.g. (src/|contracts/). Opposite of --filter-paths",
action="store",
dest="include_paths",
default=defaults_flag_in_config["include_paths"],
)

codex.init_parser(parser)

# debugger command
Expand Down Expand Up @@ -623,7 +641,8 @@ def parse_args(
args = parser.parse_args()
read_config_file(args)

args.filter_paths = parse_filter_paths(args)
args.filter_paths = parse_filter_paths(args, True)
args.include_paths = parse_filter_paths(args, False)

# Verify our json-type output is valid
args.json_types = set(args.json_types.split(",")) # type:ignore
Expand Down
Loading
Loading