-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from DFE-Digital/owasp-zap-ci
Add security tests workflow
- Loading branch information
Showing
3 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Security scanner tests | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Deploy to environment"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
run-tests-with-zap: | ||
name: Run Cypress tests with OWASP ZAP | ||
environment: development | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run tests with scanner | ||
env: | ||
API_KEY: ${{ secrets.TRAMS_API_KEY }} | ||
HTTP_PROXY: http://zap:8080 | ||
NO_PROXY: "*.google-analytics.com,*.googletagmanager.com,*.microsoftonline.com" | ||
URL: ${{ secrets.TRAMS_API_BASE_URL }} | ||
ZAP_API_KEY: ${{ secrets.ZAP_API_KEY }} | ||
run: | | ||
docker-compose -f CypressTests/docker-compose.yml up --exit-code-from cypress | ||
- name: Get git sha | ||
if: '!cancelled()' | ||
run: | | ||
CHECKED_OUT_SHA="$(git log -1 '--format=format:%H')" | ||
echo "checked_out_sha=${CHECKED_OUT_SHA}" >> $GITHUB_ENV | ||
- name: Azure login with SPN | ||
if: '!cancelled()' | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.OWASP_AZ_CREDENTIALS }} | ||
|
||
- name: Push report to blob storage | ||
if: '!cancelled()' | ||
uses: azure/CLI@v1 | ||
id: azure | ||
with: | ||
azcliversion: 2.49.0 | ||
inlineScript: | | ||
az storage blob upload \ | ||
--container-name ${{ secrets.OWASP_STORAGE_CONTAINER_NAME }} \ | ||
--account-name ${{ secrets.OWASP_STORAGE_ACCOUNT_NAME }} \ | ||
--file "CypressTests/reports/ZAP-Report.html" \ | ||
--name "TramsDataApi/${{ env.checked_out_sha }}/ZAP-Report.html" \ | ||
--auth-mode login \ | ||
--overwrite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters