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