1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, gibberish-detector
5, mock
6, pkgs
7, pyahocorasick
8, pytestCheckHook
9, pythonOlder
10, pyyaml
11, requests
12, responses
13, unidiff
14}:
15
16buildPythonPackage rec {
17 pname = "bc-detect-secrets";
18 version = "1.4.30";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "bridgecrewio";
25 repo = "detect-secrets";
26 rev = "refs/tags/${version}";
27 hash = "sha256-wq+SKOiMcVO7OiK+RdRk4RNsjSAT7lBdAjLHfurSIRo=";
28 };
29
30 propagatedBuildInputs = [
31 pyyaml
32 requests
33 unidiff
34 ];
35
36 passthru.optional-dependencies = {
37 word_list = [
38 pyahocorasick
39 ];
40 gibberish = [
41 gibberish-detector
42 ];
43 };
44
45 nativeCheckInputs = [
46 mock
47 pkgs.gitMinimal
48 pytestCheckHook
49 responses
50 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
51
52 preCheck = ''
53 export HOME=$(mktemp -d);
54 '';
55
56 disabledTests = [
57 # Tests are failing for various reasons (missing git repo, missing test data, etc.)
58 "test_baseline_filters_out_known_secrets"
59 "test_make_decisions"
60 "test_saves_to_baseline"
61 "test_start_halfway"
62 "TestCreate"
63 "TestDiff"
64 "TestGetFilesToScan"
65 "TestLineNumberChanges"
66 "TestModifiesBaselineFromVersionChange"
67 ];
68
69 pythonImportsCheck = [
70 "detect_secrets"
71 ];
72
73 meta = with lib; {
74 description = "Tool to detect secrets in the code";
75 homepage = "https://github.com/bridgecrewio/detect-secrets";
76 license = licenses.asl20;
77 maintainers = with maintainers; [ fab ];
78 };
79}
80