* Disable coloring if output is not a terminal
Color escape codes are most likely not expected if piping the output
of slither into a file or other tool. Check if stdout is a tty before
enabling colored output.
* Test cases for SSA IR generation
Attempts to verify a few basic properties of the generated SSA IR.
Currently these tests fail because of IR that seems to be incorrect.
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
* Update to gh super linter 4.9.2 + linters
This PR cleanup our CI to use a fix version of gh super linter, to avoid
breaking the CI on new super linter release. Additionally it update our linters, the new versions:
- pylint 2.13.4
- black 22.3.0
Similar to https://github.com/crytic/crytic-compile/pull/252
Additionally, update to use crytic-compile@master
* workflows: parser: use solc-select from pip
The hardcoded, manually-installed version is out of date. This updates
the workflow to install directly from pip now that it is available there.
* workflows: parser: Run tests also on Windows
* workflows: parser: bump solc-select to >=v1.0.0b1
This version introduces Windows support.
* workflows: parser: FIXME: install patched crytic-compile
* workflows: features: enable Windows runs
This enables runs on windows-2022 and updates solc-select to support
running on Windows.
* workflows: features: FIXME: install patched crytic-compile
* workflows: detectors: enable Windows runs
This enables runs on windows-2022 and updates solc-select to support
running on Windows.
* workflows: detectors, features, parser: disable fail-fast
Disable fail-fast so failures in one platform do not hide failures
in the other OS.
* tests: detectors: adjust GENERIC_PATH replacement for Windows
Backslashes are escaped in the string representation, so we need
to double them before replacing. Also change generic path to a constant
string to avoid it being converted to "\GENERIC_PATH" in Windows and
getting an invalid escape error from the JSON decoder later on.
* tests: use lf endings for test code
If autocrlf is enabled on Windows, it will rewrite solc code with
CRLF file endings and break tests that depend on byte offsets in
the code files.
* workflows: detectors: FIXME: install patched crytic-compile
* workflows: ci: enable Windows runs
This enables runs on windows-2022 and updates solc-select to support
running on Windows. Some tests with Linux requirements are excluded.
* workflows: ci: FIXME: install patched crytic-compile
* workflows: *: update actions/setup-python to v3
v1 does not install Python correctly on Windows. While at it, update
all instances to v3.
* workflows: ci: add msys2 tools to path
* workflows: ci: disable broken Windows workflows
* workflows: apply linter fixes
* workflows: ci: enable dapp test
* tests: dapp: fix test
* core: normalize paths on POSIX style
* workflows: ci: enable printers tests on Windows
These test files are a large part of the repository, and do not need to be
linted. The large number of files makes the enumeration slow when performed
by the Super Linter, which results in CI jobs taking considerably long.
This PR ignores said files in hopes to speed up the CI workflows.
It also switches the Super Linter image to the slim version, which should
be slightly faster to download.
Fixes: #1084
This adds a new GitHub Actions workflow. This workflow runs pip-audit
on the repository on each new commit and pull request to the `dev` and
`master` branches, as well as every Tuesday morning. If any known
vulnerable dependency is found, this workflow will fail.
This is a significant refactoring that will allow slither to have a
better support for codebases with naming collision (including contracts
and structures)
- Add core.scope.scope.FileScope, which represents all the objects accessible given a filename
- Use this scope everywhere an access to another object is needed during parsing
- Replace CallerExpression nammedtuple by a CallerContextExpression object. This cleans the python types and reduces the code complexity
- Add test_features which currently tests the contract name and structure name collision through the standard solc json input and import through node_modules
Fix#912
- core.source_mapping.SourceMapping is now a class (fix#695)
- Add slither.offset_to_objects to retrieve the object on a given
offset (WIP)
- Add slither.utils.source_mapping APIs to allow retrieving
definition/implementations/references informations from an offset (WIP)
Additionally this PR create a strict order for the detectors tests
output to ease the comparison in case in small changes in the json
output