From 9ba72589bda271d9e1a417511921253cdb72d87c Mon Sep 17 00:00:00 2001 From: Sai Kiran Akula Date: Fri, 28 Jan 2022 16:48:01 -0800 Subject: [PATCH 1/2] fix: add hooks to detect secrets --- .github/workflows/dotnet-core.yml | 10 ++++++++++ hooks/commit-msg | 2 ++ hooks/pre-commit | 2 ++ hooks/prepare-commit-msg | 2 ++ 4 files changed, 16 insertions(+) create mode 100644 hooks/commit-msg create mode 100644 hooks/pre-commit create mode 100644 hooks/prepare-commit-msg diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index c1726c1..2b16b30 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -13,6 +13,16 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Check for secrets leak on the repo + run: | + git clone https://github.com/awslabs/git-secrets.git target + cd target + ./install.ps1 + echo "Git-secrets installation completed" + git secrets --register-aws --global + echo "Added aws secret templates" + git secrets --scan -r ../ + echo "Repository scan completed" - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: diff --git a/hooks/commit-msg b/hooks/commit-msg new file mode 100644 index 0000000..89a0f2e --- /dev/null +++ b/hooks/commit-msg @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git secrets --commit_msg_hook -- "$@" diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100644 index 0000000..f30ae7e --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git secrets --pre_commit_hook -- "$@" diff --git a/hooks/prepare-commit-msg b/hooks/prepare-commit-msg new file mode 100644 index 0000000..3d6bf42 --- /dev/null +++ b/hooks/prepare-commit-msg @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git secrets --prepare_commit_msg_hook -- "$@" From 33852265d5d2345c5492e1859d5afe62b1c5afc1 Mon Sep 17 00:00:00 2001 From: Sai Kiran Akula Date: Sun, 30 Jan 2022 20:06:08 -0800 Subject: [PATCH 2/2] fix: workflow --- .github/workflows/dotnet-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 2b16b30..bf617fd 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -17,7 +17,7 @@ jobs: run: | git clone https://github.com/awslabs/git-secrets.git target cd target - ./install.ps1 + sudo make install echo "Git-secrets installation completed" git secrets --register-aws --global echo "Added aws secret templates"