Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow zap to create issues #39

Merged
merged 8 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Testing has only been done with public containers on ghcr.io (GitHub Container R
# Allow ZAProxy alerts to fail the workflow? [true/false]
penetration_test_fail: false

# Provide a name to enable ZAProxy issue creation; e.g. frontend, backend
penetration_test_issue: frontend

# Bash array to diff for build triggering
# Optional, defaults to nothing, which forces a build
triggers: ('frontend/')
Expand Down Expand Up @@ -102,7 +105,7 @@ deploys:

# Example, Matrix / Multiple Templates

Deploy multiple templates in parallel. This time penetration tests are enabled. Runs on pull requests (PRs).
Deploy multiple templates in parallel. This time penetration tests are enabled and issues created. Runs on pull requests (PRs).

```yaml
deploys:
Expand Down Expand Up @@ -142,6 +145,7 @@ steps:
-p COMMON_TEMPLATE_VAR=whatever-${{ github.event.number }}
${{ matrix.parameters }}
penetration_test: true
penetration_test_issue: ${{ matrix.name }}
triggers: ${{ matrix.triggers }}
```

Expand Down Expand Up @@ -174,7 +178,7 @@ deploys:

Deployment templates are parsed for a route. If found, those routes are verified with a curl command for status code 200 (success). This ensures that applications are accessible from outside their OpenShift namespace/project.

Provide `penetration_test: true` to instead run a penetration test using [OWASP ZAP (Zed Attack Proxy)](https://github.com/zaproxy/action-full-scan) against that route. `penetration_test_fail: false` can be used to fail pipelines where problems are found.
Provide `penetration_test: true` to instead run a penetration test using [OWASP ZAP (Zed Attack Proxy)](https://github.com/zaproxy/action-full-scan) against that route. `penetration_test_fail: false` can be used to fail pipelines where problems are found. `penetration_test_issue: name` creates issues and is generally preferable over failing pipelines.

# Troubleshooting

Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ inputs:
penetration_test_fail:
description: Allow ZAProxy alerts to fail the workflow? [true/false]
default: "false"
penetration_test_issue:
description: Provide a name to enable ZAProxy issue creation; e.g. frontend, backend
default: ""
triggers:
description: Omit to always build, otherwise trigger by path; e.g. ('./backend/', './frontend/)
verification_path:
Expand Down Expand Up @@ -183,7 +186,9 @@ runs:
target: https://${{ steps.vars.outputs.url }}
cmd_options: "-a"
fail_action: ${{ inputs.penetration_test_fail }}
allow_issue_writing: false
# allow_... is purposefully obscured - if a title is provided, then = true
allow_issue_writing: ${{ inputs.penetration_test_issue && true || false }}
issue_title: "ZAP: ${{ inputs.penetration_test_issue }}"

# Action repo needs to be present for cleanup/tests
- name: Checkout to make sure action.yml is present (tests)
Expand Down