Skip to content

Commit

Permalink
Merge pull request #400 from lafrenierejm/ripsecrets
Browse files Browse the repository at this point in the history
Add ripsecrets hook
  • Loading branch information
domenkozar authored Mar 25, 2024
2 parents e611897 + b54aac8 commit db656fc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,20 @@ in
};
};
};
ripsecrets = mkOption {
description = lib.mdDoc "ripsecrets hook";
type = types.submodule {
imports = hookModule;
options.settings = {
additionalPatterns =
mkOption {
type = types.listOf types.str;
description = lib.mdDoc "Additional regex patterns used to find secrets. If there is a matching group in the regex the matched group will be tested for randomness before being reported as a secret.";
default = [ ];
};
};
};
};
rome = mkOption {
description = lib.mdDoc "rome hook";
type = types.submodule {
Expand Down Expand Up @@ -2677,6 +2691,26 @@ in
# all file names in a single run.
require_serial = true;
};
ripsecrets =
{
name = "ripsecrets";
description = "Prevent committing secret keys into your source code";
package = tools.ripsecrets;
entry =
let
cmdArgs = mkCmdArgs (
with hooks.ripsecrets.settings; [
[ true "--strict-ignore" ]
[
(additionalPatterns != [ ])
"--additional-pattern ${lib.strings.concatStringsSep " --additional-pattern " additionalPatterns}"
]
]
);
in
"${hooks.ripsecrets.package}/bin/ripsecrets ${cmdArgs}";
types = [ "text" ];
};
rome =
{
name = "rome";
Expand Down
2 changes: 2 additions & 0 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
, pre-commit-hook-ensure-sops ? null
, python3Packages
, php82Packages
, ripsecrets ? null
, ruff ? null
, runCommand
, rustfmt
Expand Down Expand Up @@ -135,6 +136,7 @@ in
ormolu
pre-commit-hook-ensure-sops
revive
ripsecrets
ruff
rustfmt
shellcheck
Expand Down

0 comments on commit db656fc

Please sign in to comment.