2021-02-05 17:12:51 +00:00
{ pkgs , lib , python3 , fetchFromGitHub }:
2021-01-17 00:15:33 +00:00
let
pname = " c h e c k o v " ;
version = " 1 . 0 . 6 7 4 " ;
src = fetchFromGitHub {
owner = " b r i d g e c r e w i o " ;
repo = pname ;
rev = version ;
sha256 = " / S 8 i c 5 Z V x A 2 v d / r j R P X 5 g s l b m n U L L 7 B S x 3 4 v g W I s h e Q = " ;
} ;
disabled = pkgs . python3Packages . pythonOlder " 3 . 7 " ;
# CheckOV only work with `dpath 1.5.0`
dpath = pkgs . python3Packages . buildPythonPackage rec {
pname = " d p a t h " ;
version = " 1 . 5 . 0 " ;
src = pkgs . python3Packages . fetchPypi {
inherit pname version ;
sha256 = " S W Y V t O q E I 2 0 Y 4 N K G E i 3 n S G m m D g + H 4 s f s Z 4 f / K G x I N h s = " ;
} ;
doCheck = false ;
} ;
in
python3 . pkgs . buildPythonPackage rec {
inherit pname version disabled src ;
nativeBuildInputs = with python3 . pkgs ; [ setuptools_scm ] ;
propagatedBuildInputs = with python3 . pkgs ; [
pytest
coverage
bandit
bc-python-hcl2
deep_merge
tabulate
colorama
termcolor
junit-xml
dpath
pyyaml
boto3
GitPython
six
jmespath
tqdm
update_checker
semantic-version
packaging
] ;
# Both of these tests are pulling from external srouces (https://github.com/bridgecrewio/checkov/blob/f03a4204d291cf47e3753a02a9b8c8d805bbd1be/.github/workflows/build.yml)
preCheck = ''
rm - rf integration_tests /*
rm - rf tests/terraform /*
'' ;
# Wrap the executable so that the python packages are available
# it's just a shebang script which calls `python -m checkov "$@"`
postFixup = ''
wrapProgram $ out/bin/checkov \
- - set PYTHONPATH $ PYTHONPATH
'' ;
meta = with lib ; {
homepage = " h t t p s : / / g i t h u b . c o m / b r i d g e c r e w i o / c h e c k o v " ;
description = " S t a t i c c o d e a n a l y s i s t o o l f o r i n f r a s t r u c t u r e - a s - c o d e " ;
longDescription = ''
Prevent cloud misconfigurations during build-time for Terraform , Cloudformation , Kubernetes , Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew .
'' ;
license = licenses . asl20 ;
maintainers = with maintainers ; [ anhdle14 ] ;
} ;
}