Skip to content

Commit

Permalink
Merge pull request #465 from ministryofjustice/issue13
Browse files Browse the repository at this point in the history
Adds the redact of sensitive data items from test workflow output.
  • Loading branch information
mikereiddigital authored Jun 28, 2024
2 parents a748599 + 02a2282 commit 4859f76
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 4859f76

Please sign in to comment.