Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
added workflow for secrets scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
rashley-iqt committed Feb 1, 2022
1 parent eac7043 commit dc703ad
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/config/whispers-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include:
files:
- "**/*"

exclude:
files:
- __pycache__|\.eggs|build|dev|\.vscode|\.git|\.github
- .*/(locale|spec|test|mock)s?/
- integration|node_modules
- (package(-lock)?|npm-shrinkwrap)\.json

keys:
- .*(public|project).*

values:
- ^(true|false|yes|no|1|0)$
- .*_(user|password|token|key|placeholder|name)$
- ^aws_(access_key_id|secret_access_key|session_token)$
- ^arn:aws:.*
- ^((cn?trl|alt|shift|del|ins|esc|tab|f[\d]+) ?[\+_\-\\/] ?)+[\w]+$
32 changes: 32 additions & 0 deletions .github/workflows/secrets-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: secrets

on: [push, pull_request]

jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: scan
run: |
export DEBIAN_FRONTEND=noninteractive && \
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections && \
sudo apt-get update && \
python3 -m pip install --upgrade pip && \
pip3 install whispers && \
mkdir /home/runner/reports/ && \
whispers --severity BLOCKER,CRITICAL -o /home/runner/reports/whispers.json -c ${GITHUB_WORKSPACE}/.github/workflows/config/whispers-config.yml ${GITHUB_WORKSPACE} && \
echo "::set-output name=found-count::$(wc -l /home/runner/reports/whispers.json | cut -d' ' -f1)"
- name: Fail if found
if: steps.scan.outputs.found-count != 0
uses: actions/github-script@v5
with:
script: |
echo {{steps.scan.outputs.found-count}} && \
core.setFailed('Secrets found. Please check the uploaded report')
- name: Upload scan reports
uses: actions/[email protected]
if: failure()
with:
name: whispers-report
path: /home/runner/reports/whispers.json

0 comments on commit dc703ad

Please sign in to comment.