Skip to content

Commit 24e12cc

Browse files
committed
Pass ZAP auth env vars to the Docker container
Allow to do the scans authenticated with manual auth. Same as zaproxy/action-api-scan#9. Signed-off-by: thc202 <thc202@gmail.com>
1 parent 32502a8 commit 24e12cc

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this GitHub action will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
## [Unreleased]
7+
### Added
8+
- Support for authentication environment variables.
9+
710
### Fixed
811
- Update Crowdin link.
912

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ if it identifies any alerts. Set this option to `true` if you want to fail the s
5656

5757
**Optional** By default the baseline action will attach the report to the build with the name `zap_scan`. Set this to a different string to name it something else. Consult [GitHub's documentation](https://github.com/actions/toolkit/blob/main/packages/artifact/docs/additional-information.md#non-supported-characters) for which artifact names are allowed.
5858

59+
## Environment variables
60+
61+
If set, the following [ZAP authentication environment variables](https://www.zaproxy.org/docs/authentication/handling-auth-yourself/#authentication-env-vars)
62+
will be copied into the docker container:
63+
64+
- `ZAP_AUTH_HEADER_VALUE`
65+
- `ZAP_AUTH_HEADER`
66+
- `ZAP_AUTH_HEADER_SITE`
67+
5968
## Example usage
6069

6170
** Basic **

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38370,7 +38370,7 @@ async function run() {
3837038370
await exec.exec(`chmod a+w ${jsonReportName} ${mdReportName} ${htmlReportName}`);
3837138371

3837238372
await exec.exec(`docker pull ${docker_name} -q`);
38373-
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" ` +
38373+
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" -e ZAP_AUTH_HEADER -e ZAP_AUTH_HEADER_VALUE -e ZAP_AUTH_HEADER_SITE ` +
3837438374
`-t ${docker_name} zap-baseline.py -t ${target} -J ${jsonReportName} -w ${mdReportName} -r ${htmlReportName} ${cmdOptions}`);
3837538375

3837638376
if (plugins.length !== 0) {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async function run() {
5151
await exec.exec(`chmod a+w ${jsonReportName} ${mdReportName} ${htmlReportName}`);
5252

5353
await exec.exec(`docker pull ${docker_name} -q`);
54-
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" ` +
54+
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" -e ZAP_AUTH_HEADER -e ZAP_AUTH_HEADER_VALUE -e ZAP_AUTH_HEADER_SITE ` +
5555
`-t ${docker_name} zap-baseline.py -t ${target} -J ${jsonReportName} -w ${mdReportName} -r ${htmlReportName} ${cmdOptions}`);
5656

5757
if (plugins.length !== 0) {

0 commit comments

Comments
 (0)