Skip to content

Commit 57d6fb6

Browse files
authored
Merge pull request #9 from ben741/main
Make authentication environment variables available in docker container
2 parents f4ba6f3 + a5d6c63 commit 57d6fb6

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
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
### Added
10+
- Support for authentication environment variables.
11+
912
## [0.1.1] - 2022-05-23
1013

1114
### Fixed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ You do not have to create a dedicated token. Make sure to use the GitHub's defau
5757
**Optional** By default ZAP Docker container will fail with an [exit code](https://github.com/zaproxy/zaproxy/blob/7abbd57f6894c2abf4f1ed00fb95e99c34ef2e28/docker/zap-api-scan.py#L35),
5858
if it identifies any alerts. Set this option to `true` if you want to fail the status of the GitHub Scan if ZAP identifies any alerts during the scan.
5959

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

6271
** Basic **

dist/index.js

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

38343834
await exec.exec(`docker pull ${docker_name} -q`);
3835-
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" ` +
3835+
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 ` +
38363836
`-t ${docker_name} zap-api-scan.py -t ${target} -f ${format} -J ${jsonReportName} -w ${mdReportName} -r ${htmlReportName} ${cmdOptions}`);
38373837

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

index.js

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

4747
await exec.exec(`docker pull ${docker_name} -q`);
48-
let command = (`docker run -v ${workspace}:/zap/wrk/:rw --network="host" ` +
48+
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 ` +
4949
`-t ${docker_name} zap-api-scan.py -t ${target} -f ${format} -J ${jsonReportName} -w ${mdReportName} -r ${htmlReportName} ${cmdOptions}`);
5050

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

0 commit comments

Comments
 (0)