Commit 9b19f701 authored by Seth Berger's avatar Seth Berger Committed by Russell Dickenson

Added environment_url.txt example

parent e733d1f4
...@@ -91,12 +91,22 @@ There are two ways to define the URL to be scanned by DAST: ...@@ -91,12 +91,22 @@ There are two ways to define the URL to be scanned by DAST:
1. Set the `DAST_WEBSITE` [variable](../../../ci/yaml/README.md#variables). 1. Set the `DAST_WEBSITE` [variable](../../../ci/yaml/README.md#variables).
1. Add it in an `environment_url.txt` file at the root of your project. 1. Add it in an `environment_url.txt` file at the root of your project.
This is great for testing in dynamic environments. In order to run DAST against This is useful for testing in dynamic environments. To run DAST against an application
an app dynamically created during a GitLab CI/CD pipeline, have the app dynamically created during a GitLab CI/CD pipeline, a job that runs prior to the DAST scan must
persist its domain in an `environment_url.txt` file, and DAST persist the application's domain in an `environment_url.txt` file. DAST automatically parses the
automatically parses that file to find its scan target. `environment_url.txt` file to find its scan target.
You can see an [example](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml)
of this in our Auto DevOps CI YAML. For example, in a job that runs prior to DAST, you could include code that looks similar to:
```yaml
script:
- echo http://${CI_PROJECT_ID}-${CI_ENVIRONMENT_SLUG}.domain.com > environment_url.txt
artifacts:
paths: [environment_url.txt]
when: always
```
You can see an example of this in our [Auto DevOps CI YAML](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml) file.
If both values are set, the `DAST_WEBSITE` value takes precedence. If both values are set, the `DAST_WEBSITE` value takes precedence.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment