Skip to content

Commit 0b4048d

Browse files
committed
add working but unconfigurable trufflehog module
1 parent b8fafde commit 0b4048d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

modules/hooks.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3496,6 +3496,23 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
34963496
package = tools.pre-commit-hooks;
34973497
entry = "${hooks.trim-trailing-whitespace.package}/bin/trailing-whitespace-fixer";
34983498
};
3499+
trufflehog =
3500+
{
3501+
name = "trufflehog";
3502+
description = "Secrets scanner";
3503+
entry =
3504+
let
3505+
script = pkgs.writeShellScript "precommit-trufflehog" ''
3506+
set -e
3507+
${hooks.trufflehog.package}/bin/trufflehog --no-update git "file://$(git rev-parse --show-top-level)" --since-commit HEAD --only-verified --fail
3508+
'';
3509+
in
3510+
builtins.toString script;
3511+
package = pkgs.trufflehog;
3512+
3513+
# trufflehog expects to run across the whole repo, not particular files
3514+
pass_filenames = false;
3515+
};
34993516
typos =
35003517
{
35013518
name = "typos";

0 commit comments

Comments
 (0)