Remove submodule to use live version of pyre-check (#3)
Previously we used a very old state of pyre-check repository as a submodule to run Github Actions against and test the action in this repository.
Currently, pyre-check has moved forward and current python module of pyre-check fails to detect issues based on the submodule. Also, since we want the action to be upto date with pyre-check it only makes sense to use git clone during the workflows instead of a submodule fixed on a particular instance of the pyre-check repository.
Signed-off-by: Abishek V Ashok abishekvashok@gmail.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Pysa Github Action
Python Static Analyzer (Pysa) is a security-focused static analysis tool that tracks flows of data from where they originate to where they terminate in a dangerous location. Pysa has been used to detect and disclose security issues on open source Python projects in the past, such as CVE-2019-19775.
The Pysa GitHub Action enables you to run Pysa in CI and view the results on GitHub Security code scanning UI.
Usage
See the test workflows in this repository for more examples
Dependencies
Pysa Action relies on SAPP Action to post process and filter Pysa results
Inputs
repo-directoryRequired, Path to the python source code you want to analyze. If you want to analyze the root of your repo, use
'./'. The default will be to analyze the root of your repository.Since Pysa relies on Pyre, Pysa Action will also look for a
.pyre_configurationin the root of yourrepo-directory. If Pysa Action can’t find a.pyre_configurationfile in the root of yourrepo-directory, it will create the default Pyre configuration to use. If you notice any missing flows involving your project dependencies, it can be likely fixed by committing the default.pyre_configurationto your repo and updating thetaint_models_pathto point to where your dependencies are installedrequirements-pathRequired, Path to file containing your python code’s dependencies relative to
repo-directory. The default will look forrequirements.txtin the root of the directory you specified inrepo-directory.Pysa Action will install all your project dependencies before the taint analysis stage and may miss flows for any dependencies not present in
sys.path, so it is important to specify all your project dependencies in yourrequirements.txtuse-nightlyWhen set to
true, the action will use the nightly version of Pysa to analyze your python code. The nightly version of Pysa tends to be unstable is not recommended you set this option to true unless you are adventurous. By default, the action will use the latest stable version of Pysa.pysa-versionThe version number of Pysa you would like to use to analyze your python code. By default, the action will use the latest version of Pysa.
infer-typesIf this value is
true, the action will runpyre inferin-place to add type annotations to your python code. Unless your python code is sufficiently type annotated, it is highly recommended you setinfer-typestotrue, since it’ll greatly improve the quality and quantity of data flows Pysa is able to found.Note that while viewing Pysa results, you may see that your source code has changed. Those changes are limited to your workflow run of Pysa and will not be committed to your repo. As a precaution to prevent confusion, the default for
infer-typesis false, however as mentioned earlier, it’s strongly recommended you setinfer-typestotrue.sapp-versionThe version number of SAPP you would like to use to post process Pysa results. By default, the action will use the latest version of SAPP.
sapp-filters-directoryPath relative to
repo-directorywhere the SAPP filters you wrote that you want applied to filter the results of your Pysa runs are.A description and guide to writing your own filters is available on the SAPP Github Repo. The description of what features are is available on the Pysa documentation.
See the
test/custom-filtersin this repo for a exampleinclude-default-sapp-filtersWhen set to
true, SAPP will filter your Pysa runs with the default filters shipped with Pysa. The SAPP filters shipped with Pysa are intended to filter out false positives even at the cost of false negatives to ensure Pysa results are as high signal as possible.By default, Pysa Action will use the default SAPP filters to filter its results. There are a few use cases where you might want to set
include-default-sapp-filterstofalse. For example:sapp-filters-directoryuse-poetryWhen set to
true, Pysa Action will install poetry with the Python Package installer and use it to install dependencies.By default, it is set to
falseand the requirements file is used as a source of requirements to be installed by the Python Package Installer (pip).License
Pysa Action is licensed under the MIT license.