Skip to content

Commit

Permalink
Merge pull request #195 from ministryofjustice/issue13
Browse files Browse the repository at this point in the history
Adds redact to the unit test workflow log.
  • Loading branch information
mikereiddigital authored Jun 28, 2024
2 parents 5ce3fb5 + d686f67 commit a84ca5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/go-terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ jobs:
run: go mod download
- name: Run Go Tests
working-directory: test
run: go test -v
run: |
chmod 700 ../scripts/redact-output.sh
go test -v | ../scripts/redact-output.sh
11 changes: 11 additions & 0 deletions scripts/redact-output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Based on: https://github.com/ministryofjustice/opg-org-infra/blob/main/scripts/redact_output.sh

sed -e 's/AWS_SECRET_ACCESS_KEY".*/<REDACTED>/g' \
-e 's/AWS_ACCESS_KEY_ID".*/<REDACTED>/g' \
-e 's/$AWS_SECRET_ACCESS_KEY".*/<REDACTED>/g' \
-e 's/$AWS_ACCESS_KEY_ID".*/<REDACTED>/g' \
-e 's/\[id=.*\]/\[id=<REDACTED>\]/g' \
-e 's/::[0-9]\{12\}:/::REDACTED:/g' \
-e 's/:[0-9]\{12\}:/:REDACTED:/g'

0 comments on commit a84ca5a

Please sign in to comment.