debian-mirror-gitlab/doc/user/application_security/generate_test_vulnerabilities/index.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1.6 KiB
Markdown
Raw Normal View History

2022-08-13 15:12:31 +05:30
---
type: reference, howto
2022-10-11 01:57:18 +05:30
stage: Govern
2022-08-13 15:12:31 +05:30
group: Threat Insights
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2022-08-13 15:12:31 +05:30
---
# Generate test vulnerabilities
2022-11-25 23:54:43 +05:30
You can generate test vulnerabilities for the [Vulnerability Report](../vulnerability_report/index.md) to test GitLab
vulnerability management features without running a pipeline.
2022-08-13 15:12:31 +05:30
2022-11-25 23:54:43 +05:30
1. Login in to GitLab.
2022-08-13 15:12:31 +05:30
1. Go to `/-/profile/personal_access_tokens` and generate a personal access token with `api` permissions.
1. Go to your project page and find the project ID. You can find the project ID below the project title.
2022-11-25 23:54:43 +05:30
1. [Clone the GitLab repository](../../../gitlab-basics/start-using-git.md#clone-a-repository) to your local machine.
1. Open a terminal and go to `gitlab/qa` directory.
1. Run `bundle install`
2022-08-13 15:12:31 +05:30
1. Run the following command:
```shell
2022-11-25 23:54:43 +05:30
GITLAB_QA_ACCESS_TOKEN=<your_personal_access_token> GITLAB_URL="<address:port>" bundle exec rake vulnerabilities:setup\[<your_project_id>,<vulnerability_count>\] --trace
2022-08-13 15:12:31 +05:30
```
Make sure you do the following:
- Replace `<your_personal_access_token>` with the token you generated in step one.
2022-11-25 23:54:43 +05:30
- Double check the `GITLAB_URL`. It should point to address and port of your GitLab instance, for example `http://localhost:3000` if you are running GDK
- Replace `<your_project_id>` with the ID you obtained in step three above.
2022-08-13 15:12:31 +05:30
- Replace `<vulnerability_count>` with the number of vulnerabilities you'd like to generate.
2022-11-25 23:54:43 +05:30
The script creates the specified number of placeholder vulnerabilities in the project.