slither icon indicating copy to clipboard operation
slither copied to clipboard

--filter-paths Flag Issue

Open chanharryhk opened this issue 4 years ago • 5 comments

Running the following variants, only the first path is excluded (paths specified are separated by commas like the help flag specified) slither --exclude-informational --filter-paths node_modules,lib . slither --exclude-informational --filter-paths node_modules,lib . slither --exclude-informational --filter-paths node_modules,contracts/lib .

ABDKMathQuad.fromInt(int256).msb (contracts/lib/ABDKMathQuad.sol#52) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.fromUInt(uint256).msb (contracts/lib/ABDKMathQuad.sol#102) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.from128x128(int256).msb (contracts/lib/ABDKMathQuad.sol#151) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.from64x64(int128).msb (contracts/lib/ABDKMathQuad.sol#203) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.toOctuple(bytes16).msb (contracts/lib/ABDKMathQuad.sol#291) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.fromDouble(bytes8).msb (contracts/lib/ABDKMathQuad.sol#321) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.add(bytes16,bytes16).msb (contracts/lib/ABDKMathQuad.sol#558) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.mul(bytes16,bytes16).msb (contracts/lib/ABDKMathQuad.sol#654-657) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.div(bytes16,bytes16).msb (contracts/lib/ABDKMathQuad.sol#761-764) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.sqrt(bytes16).msb (contracts/lib/ABDKMathQuad.sol#838) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
ABDKMathQuad.log_2(bytes16).msb (contracts/lib/ABDKMathQuad.sol#903) shadows:
	- ABDKMathQuad.msb(uint256) (contracts/lib/ABDKMathQuad.sol#1141-1156) (function)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#local-variable-shadowing

Issues from lib still appear. node_modules issues would still appear with lib path specified first.

chanharryhk avatar Feb 16 '21 01:02 chanharryhk

This still seems to be an issue in 0.8.0. It took me quite a while to figure out this is a bug in slither, and not my configuration.

Any chance to get this fixed?

axic avatar Aug 18 '21 15:08 axic

Hi @chanharryhk, @axic, thanks for reporting this. It looks like the cli flag description is not up to date.

The path filtering use python regular expression format (see the doc).

We will update the cli flag.

montyly avatar Aug 25 '21 08:08 montyly

Based on that, something like node_modules/@openzeppelin|contracts/mocks should work, right?

axic avatar Aug 25 '21 08:08 axic

Yes, it should, if it does not, can you share the repo where it happens?

montyly avatar Aug 25 '21 11:08 montyly

I cannot share the repo at this time, but no matter if I use it as --filter-path "node_modules/@openzeppelin|contracts/mocks" or filter-path: "node_modules/@openzeppelin|contracts/mocks" in the config, it will still try to iterate files in mocks. If I just delete the mocks directory then it will skip it.

To clarify probably the complexity here is that files in mocks use free functions and they fail on #911.

axic avatar Aug 27 '21 15:08 axic

@elopez Was this fixed by https://github.com/crytic/slither/pull/1196

0xalpharush avatar Jun 27 '23 20:06 0xalpharush

@0xalpharush I believe so! IIRC we switched the elements to a list instead of an iterable so they wouldn't get consumed on the first rounds of checks.

elopez avatar Jun 27 '23 20:06 elopez