Monitoring with Prometheus
local graph
Chapter 12 — Monitoring with Prometheus
Section titled “Chapter 12 — Monitoring with Prometheus”In this chapter, we will explore how to monitor using the Prometheus time series, and we will also run some automated security tests. The built-in security tests in GitLab are only available when running with a GitLab Ultimate license on-premises or with a Gold subscription on http://gitlab.com.
In this chapter, we will cover following topics:
- Setting up Prometheus
- Customizing monitoring
- The static analysis of security vulnerabilities
- Dynamic Application Security Testing (DAST)
- Dependency checking
To be able to manage Omnibus installs, there is one central configuration file required, called gitlab.rb. You need to create this file or copy an example. There is a template available at https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template. This file is not updated after upgrades. Throughout this chapter, we will quote and discuss elements of this file.
To follow along with the instructions in this chapter, please download the Git repository with examples, available at GitHub: https://github.com/PacktPublishing/Mastering-GitLab-12/tree/master/Chapter12.
You will also need to have Python installed to create the Python sample exporter.
Prometheus is an open source monitoring system inspired by Borgmon, Google’s production monitoring system. Since it was introduced in 2012, the project has built up an active community and has already been used by many companies. It is an example of a TSDB, a time-series monitoring database. This means that time is a deliberate X-axis in all of your measurements. Every new entry is an insert and not an update of a data-row.
This is best visualized in a table:
| Time(x) | Key | Value |
|---|---|---|
| 12.01.33 | ping-latency | 0.234556 |
| 12.03.33 | ping-latency | 0.223344 |
The two main advantages of this approach are as follows:
- Scalability: These databases are tuned to ingest data and do so very efficiently.
- Usability: They provide all kinds of tools and functions, for example, data retention and continuous queries.
Whereas most monitoring systems focus on measuring external system behaviors through health checks, Prometheus emphasizes measuring internal system behaviors by requesting metrics from the software itself. With Prometheus, you can set up monitoring dynamically, making it a valuable tool for gaining insight into distributed setups, such as software on a Kubernetes cluster.
The Prometheus project provides client librariesthat make it easier to export metrics from software. These libraries enable you to integrate monitoring as part of your software. It opens a port to metrics inside your application, so to speak.
You can also use functions and objects from client libraries to expose the metrics inside your application.
Another method is to run separate smaller programs that gather data that will be scraped by the Prometheus server. Some officially endorsed exporters are available in the Prometheus group on GitHub: https://github.com/prometheus.
GitLab is packaged with both methods. When enabled, it can expose metrics from within GitLab itself, but the omnibus package can also deliver extra exporter instances that are able to monitor a number of components. The monitoring architecture is as follows (as you can see, the functionality runs on the GitLab application server):

You can see several exporters in the image; let’s go through them:
- The (GitLab) Metrics Exporter: GitLab has incorporated the client functions into itself and can expose metrics if the setting is enabled. You can find this feature in the Admin | Settings | Metrics and profiling | Metrics Prometheus, as shown in the following screenshot:

This works by allowing you to view the exporters’ output on http://{your gitlab url}}/-/metrics?token=something. An example is given on the Health Check page via Monitoring | Health check, as shown in the following screenshot:

Make sure that you append the token to the request otherwise you won’t see any data. An example output shown when visiting the URL is as follows:

- The Redis Exporter: This is an external program you can find at https://github.com/oliver006/redis_exporter/blob/master/README.md#whats-exported. It is a Go binary that exposes metrics about Redis, the in-memory database and cache that GitLab uses for storing background job queues, and session state and UI caching.
When used together with Grafana, dashboards can be quickly set up, as shown in the following screenshot:

- The Postgres Exporter: Again, this is a Go binary and external project available at: https://github.com/wrouesnel/postgres_exporter.
- The GitLab Monitor: This exporter is a bit different in that it is built-in with Ruby and exposes metrics with the Sinatra web server gem. The project page is https://gitlab.com/gitlab-org/gitlab-monitor.
When you query the GitLab Monitor, you can provide different parameters, which represent the kind of metric you want to scrape; they include the following:
-
-
- Database: Provides information about tables, rows, and CI build - Git: Provides information about Git pulls - Process: Provides information about CPU, process count, sidekiq stats, and more
-
- The Node Exporter: This is perhaps one of the best-known exporters for Prometheus. It consists of a lot of basic metrics for an application node. Again, this exporter is written in Go and is available at https://github.com/prometheus/node_exporter.
- To enable the built-in Prometheus server on the GitLab application server, edit the /etc/gitlab/gitlab.rb file. Search for prometheus[‘enable’], uncomment it, and set it to true. There are several other options, but just enabling it will already deliver you a working instance.
The part of the gitlab.rb file you should change is as follows:
##! Docs: https://docs.gitlab.com/ce/administration/monitoring/prometheus/ ################################################################################# ## Prometheus
prometheus['enable'] = true # prometheus['monitor_kubernetes'] = true # prometheus['username'] = 'gitlab-prometheus' # prometheus['uid'] = nil # prometheus['gid'] = nilAfter changing gitlab.rb, you should run a reconfiguration to activate the changes. You will see messages explaining that certain exporters and the Prometheus server have been started.
You can navigate to the Prometheus console by going to the address configured in prometheus[‘listen_address’]. You will be presented with a query interface. If you click the drop-down list, you should see a list of metrics that can be queried, as shown in the following screenshot:

Once you have chosen a metric, it will display all values it has recorded in the database (including data that was actively scraped from Prometheus exporters). In this case, the chose view mode was probably Console. You can also view the data as a graph by clicking on Graph, as shown in the following screenshot:

If you are not using the omnibus package to manage GitLab or insist on using an external Prometheus server, the picture will be a bit different. You should be aware that the default security model that Prometheus uses is rather simple; it assumes that anyone can view the stored time series data, and the server provides no authentication, authorization, or encryption. If you need these features, you should prepare a reverse proxy in front of the Prometheus server to help. More information about this can be found at https://prometheus.io/docs/operating/security/.
The monitoring architecture for this situation is shown in the following diagram (as you can see, some functionality is running on a separate server):

Now we have to make sure we have an external Prometheus host configured that is ready to scrape the data. As we’ve previously mentioned, Prometheus is a single Go binary. To specify which configuration file to load, use the —config.file flag. This configuration file has to have the YAML format. How a single Prometheus server monitors the GitLab Metrics Exporter embedded in GitLab is shown in the following prometheus.yml example:
- job_name: 'git-metrics'params:token: [ gitlab_health_check_access_token ]metrics_path: /-/metricsscrape_interval: 5sscheme: httpstls_config:insecure_skip_verify: truefile_sd_configs:- files:- /etc/prometheus/sd/gitlab_metrics_exporter_sd.ymlThe gitlab_metrics_exporter_sd.yml file contains the following code:
- targets: ['gitlab.joustie.nl']labels:app: gitlabIf you put both files in /tmp, or elsewhere, and run Prometheus as a Docker container (as seen in the following example), you should have an external Prometheus ready for action. Of course, you can also install it from source and run it on a dedicated server somewhere else if preferred.
docker run -it --name my-prometheus \-v /tmp:/etc/prometheus \--publish 9090:9090 \prom/prometheusYou now know how Prometheus runs on the GitLab application server itself, as well as on a separate server.
Since GitLab 12.0 it also possible to enable a link to an external dashboard from inside of GitLab.
- Go to Settings | Operations and navigate to External dashboard
- Insert the location to your external dashboard and click on Save Changes:

There are several ways to create custom monitoring scripts that will supply time series data to your Prometheus server. As noted earlier in the Setting up Prometheus section,there are many client libraries available, such as https://github.com/prometheus/client_python.
In the following screenshot, you can see that the preceding project is not very big but does have stars on GitHub.

To use this library, install it using pip (a Python package manager for modules) with the following code:
$ pip install prometheus_clientCollecting prometheus_clientmatplotlib 1.3.1 requires nose, which is not installed.matplotlib 1.3.1 requires tornado, which is not installed.Installing collected packages: prometheus-clientSuccessfully installed prometheus-client-0.6.0You can also create a simple exporter by running the following code from a Python interpreter or via a file:
from prometheus_client import start_http_server, Summary import random import time# Create a metric to track time spent and requests made. REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')# Decorate function with metric. @REQUEST_TIME.time() def process_request(t): """A dummy function that takes some time.""" time.sleep(t)if __name__ == '__main__': # Start up the server to expose the metrics. start_http_server(8000) # Generate some requests. while True: process_request(random.random())The exporter will start on localhost, on port 8000, and the following page will appear when called:

You can add this exporter to your Prometheus server by adding the following code to prometheus.yml and restarting Prometheus with gitlab-ctl restart prometheus on an omnibus-installed GitLab application server, or you can use service prometheus restart on an externally-installed Prometheus:
job_name: 'python_gitlab'# Override the global default and scrape targets from this job every 5 seconds.scrape_interval: 5sstatic_configs:-targets: ['localhost:8000']You now have the option to modify your own Python application to report metrics, or you can create Python code that gathers metrics from your system. For instance, you may want to parse a log file for certain patterns and accumulate the relevant metrics.
Static Application Security Testing (SAST) is used to analyze source code or binaries and to detect holes or weak points in security. When automated, this contributes to making your DevOps methodology resemble DevSecOps, where security testing and awareness is part of the DevOps life cycle.
GitLab, in its Ultimate license model, provides automated testing as part of the development of your application.
Currently, the following languages and frameworks are supported:
| Language/Framework | Scan tool |
|---|---|
| .NET | Security Code Scan |
| C/C++ | Flawfinder |
| Go | gosec |
| Groovy (Gradle and Grail) | find-sec-bugs |
| Java (Maven and Gradle) | find-sec-bugs |
| JavaScript | ESLint security plugin |
| Node.js | NodeJsScan |
| PHP | phpcs-security-audit |
| Python | bandit |
| Ruby on Rails | brakeman |
| Scala (sbt) | find-sec-bugs |
| Typescript | TSLint Config Security |
First, you need GitLab Runner with a Docker-in-Docker executor.
This is a normal Docker executor, but it runs in privileged mode. This means it can run its own Docker daemon and therefore run containers itself.
You enable this functionality by changing the GitLab Runner configuration file (config.toml), making sure it has privileged = true. After changing this, restart the runner as follows:
[[runners]]executor = "docker"[runners.docker]privileged = trueSecondly, you need a specific .gitlab-ci.yml in your GitLab project folder to make the actual coupling, as shown in the following snippet:
sast: image: docker:stable variables: DOCKER_DRIVER: overlay2 allow_failure: true services: - docker:stable-dind script: - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - docker run --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" --volume "$PWD:/code" --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code artifacts: reports: sast: gl-sast-report.jsonAs an example, we downloaded the following code from https://github.com/CSPF-Founder/JavaVulnerableLab into our own project. We added .gitlab-ci.yml to run a scan. When the code was pushed, the workflow started and prepared for the scan:
[0KRunning with gitlab-runner 11.7.0 (8bb608ff)[0;m[0K on Joosts-MBP.fritz.box gGEycKK-[0;m[0KUsing Docker executor with image docker:stable ...[0;m[0KStarting service docker:stable-dind ...[0;m[0KPulling docker image docker:stable-dind ...[0;m[0KUsing docker image sha256:5b626cc3459ad077146e8aac1fbe25f7099d71c6765efd6552b9209ca7ea4dc1 for docker:stable-dind ...[0;m[0KWaiting for services to be up and running...[0;m[0KPulling docker image docker:stable ...[0;m[0KUsing docker image sha256:73d492654a095a2f91078b2dfacd0cfe1a1fe25412fac54b4eb2f5a9609ad418 for docker:stable ...[0;msection_start:1550847640:prepare_script[0KRunning on runner-gGEycKK--project-1-concurrent-0 via Joosts-MBP.fritz.box...section_end:1550847642:prepare_script[0Ksection_start:1550847642:get_sourcesIn the next stage, the repository containing the code to be scanned is cloned, shown as follows:
[0K[32;1mCloning repository...[0;mCloning into '/builds/mastering_gitlab/JavaVulnerableLab'...[32;1mChecking out 157b6e94 as master...[0;m[32;1mSkipping Git submodules setup[0;msection_end:1550847644:get_sources[0Ksection_start:1550847644:restore_cache[0Ksection_end:1550847646:restore_cache[0Ksection_start:1550847646:download_artifacts[0Ksection_end:1550847647:download_artifacts[0Ksection_start:1550847647:build_script[0K[32;1m$ export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')[0;m[32;1m$ docker run --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" --volume "$PWD:/code" --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code[0;mIn the next step, the run tries to get a specific Docker image for the scan. It will not find that locally and will instead try to get it from gitlab.org, as follows:
Unable to find image 'registry.gitlab.com/gitlab-org/security-products/sast:11-7-stable' locally11-7-stable: Pulling from gitlab-org/security-products/sast3f0edbe59eaa: Pulling fs layer3f0edbe59eaa: Download complete3f0edbe59eaa: Pull completeDigest: sha256:d31cbb2bfd200b60543ef99fa03638c2335a52597e0966b7347f896dbe4e78e7Status: Downloaded newer image for registry.gitlab.com/gitlab-org/security-products/sast:11-7-stableAfter successfully downloading the image, it will start the scan, as follows:
2019/02/22 15:00:52 Copy project directory to containers2019/02/22 15:00:52 [bandit] Detect project using plugin2019/02/22 15:00:52 [bandit] Project not compatible2019/02/22 15:00:52 [brakeman] Detect project using plugin2019/02/22 15:00:52 [brakeman] Project not compatible2019/02/22 15:00:52 [gosec] Detect project using plugin2019/02/22 15:00:52 [gosec] Project not compatible2019/02/22 15:00:52 [find-sec-bugs] Detect project using plugin2019/02/22 15:00:52 [find-sec-bugs] Project is compatible2019/02/22 15:00:52 [find-sec-bugs] Starting analyzer...After 10 minutes, the results should be as follows:
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar (640 kB at 882 kB/s)[INFO] Changes detected - recompiling the module![WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent![INFO] Compiling 15 source files to /tmp/app/target/classes[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 11.988 s[INFO] Finished at: 2019-02-22T15:24:25Z[INFO] ------------------------------------------------------------------------The scan will report on which plugin or module can be use (in other words, it checks project compatibility), as follows:
Warnings generated: 492019/02/22 15:24:33 [find-sec-bugs-gradle] Detect project using plugin2019/02/22 15:24:33 [find-sec-bugs-gradle] Project not compatible2019/02/22 15:24:33 [find-sec-bugs-sbt] Detect project using plugin2019/02/22 15:24:33 [find-sec-bugs-sbt] Project not compatible2019/02/22 15:24:33 [find-sec-bugs-groovy] Detect project using plugin2019/02/22 15:24:33 [find-sec-bugs-groovy] Project not compatible2019/02/22 15:24:33 [flawfinder] Detect project using plugin2019/02/22 15:24:33 [flawfinder] Project not compatible2019/02/22 15:24:33 [phpcs-security-audit] Detect project using plugin2019/02/22 15:24:33 [phpcs-security-audit] Project not compatible2019/02/22 15:24:33 [security-code-scan] Detect project using plugin2019/02/22 15:24:33 [security-code-scan] Project not compatible2019/02/22 15:24:33 [nodejs-scan] Detect project using plugin2019/02/22 15:24:33 [nodejs-scan] Project not compatibleYou should now see a report of the findings, as in the following example (which is not entirely complete):
+--------------------------------------------------------------------------------------+ | Severity | Tool | Location | +--------------------------------------------------------------------------------------+ | High | Find Security Bugs | src/main/java/org/cysecurity/cspf/jvl/controller/LoginValidator.java:64 | | | | HTTP cookie formed from untrusted input | +--------------------------------------------------------------------------------------+ | High | Find Security Bugs | src/main/java/org/cysecurity/cspf/jvl/controller/AddPage.java:45 | | | | Relative path traversal in servlet | +--------------------------------------------------------------------------------------+As you can see in the following snippet, a lot of security issues were discovered:
Uploading artifacts...gl-sast-report.json: found 1 matching filesUploading artifacts to coordinator... ok id=4 responseStatus=201 Created token=Sy_pRf1eJob succeededThe scan finally finishes by uploading the report.
Essentially, SAST tries to analyze your code and applies plugins based on which code could be scanned. It will look for security hazards in your code. The scan is done in a special container delivered by GitLab. After scanning, a report is available.
Dynamic Application Security Testing (DAST) runs PEN tests like scans of your application.
The test uses OWASP ZAProxy (https://github.com/zaproxy/zaproxy) to scan a running instance in your web application. It runs a passive scan, which means it only tries to discover your application by exploring links, will not find links created dynamically, and will not attack your application actively.
Before GitLab 12.0, this scan also used the Docker-in-Docker mechanism, but now it just retrieves and runs a container and the test. This means the image is cached on GitLab runners, and after retrieving the image for the first time, the security test will run faster.
As with SAST, you control how scanning happens through the .gitlab-ci.yml file, as follows:
dast:image: registry.gitlab.com/gitlab-org/security-products/zaproxyvariables:website: "https://blog.joustie.nl"allow_failure: truescript:- mkdir /zap/wrk/- /zap/zap-baseline.py -J gl-dast-report.json -t $website || true- cp /zap/wrk/gl-dast-report.json .artifacts:reports:dast: gl-dast-report.jsonWhen you push code to the repository, the DAST scan will start preparing, as shown in the following snippet. First, it will try to find the ZAProxy Docker container and pull it.
Running with gitlab-runner 11.7.0 (8bb608ff)on host gGEycKK-Using Docker executor with image registry.gitlab.com/gitlab-org/security-products/zaproxy ...Pulling docker image registry.gitlab.com/gitlab-org/security-products/zaproxy ...Using docker image sha256:cd12d3ce5fc66ef0c6b2cf0e6b745876b666aed7f9e859451eaef884b92cefa7 for registry.gitlab.com/gitlab-org/security-products/zaproxy ...The scan will start as follows:
Running on runner-gGEycKK--project-2-concurrent-0 via Joosts-MBP.fritz.box...Fetching changes...Removing zap.outHEAD is now at 6024894 Update .gitlab-ci.ymlFrom http://192.168.178.82/root/unsecure6024894..e6b26fe master -> origin/masterChecking out e6b26fe5 as master...Skipping Git submodules setup$ mkdir /zap/wrk/$ /zap/zap-baseline.py -J gl-dast-report.json -t $website || true2019-02-22 15:50:26,650 Params: ['zap-x.sh', '-daemon', '-port', '40096', '-host', '0.0.0.0', '-config', 'api.disablekey=true', '-config', 'api.addrs.addr.name=.*', '-config', 'api.addrs.addr.regex=true', '-config', 'spider.maxDuration=1', '-addonupdate', '-addoninstall', 'pscanrulesBeta']Feb 22, 2019 3:50:34 PM java.util.prefs.FileSystemPreferences$1 runINFO: Created user preferences directory.It will try to scan the whole website, as shown in the following example:
Total of 251 URLsPASS: Cookie No HttpOnly Flag [10010]PASS: Cookie Without Secure Flag [10011]PASS: Incomplete or No Cache-control and Pragma HTTP Header Set [10015]PASS: Content-Type Header Missing [10019]PASS: Information Disclosure - Debug Error Messages [10023]PASS: Information Disclosure - Sensitive Information in URL [10024]PASS: Information Disclosure - Sensitive Information in HTTP Referrer Header [10025]PASS: HTTP Parameter Override [10026]PASS: Information Disclosure - Suspicious Comments [10027]PASS: Viewstate Scanner [10032]PASS: Secure Pages Include Mixed Content [10040]PASS: CSP Scanner [10055]PASS: Weak Authentication Method [10105]PASS: Session ID in URL Rewrite [3]PASS: Script Passive Scan Rules [50001]PASS: Insecure JSF ViewState [90001]PASS: Charset Mismatch [90011]PASS: WSDL File Passive Scanner [90030]PASS: Loosely Scoped Cookie [90033]It will then report vulnerabilities immediately, as shown in the following snippet:
WARN-NEW: Web Browser XSS Protection Not Enabled [10016] x 112 http://blog.joustie.nl/ http://blog.joustie.nl/robots.txt http://blog.joustie.nl/sitemap.xml http://blog.joustie.nl http://blog.joustie.nl/atom.xml WARN-NEW: Cross-Domain JavaScript Source File Inclusion [10017] x 108 http://blog.joustie.nl/ http://blog.joustie.nl http://blog.joustie.nl/tags/personal/ http://blog.joustie.nl/2019/01/12/2018-05-29-personalblog/ http://blog.joustie.nl/2018/05/29/2018-05-20-met-zn-allen-1-wereld/ ..... FAIL-NEW: 0 FAIL-INPROG: 0 WARN-NEW: 7 WARN-INPROG: 0 INFO: 0 IGNORE: 0 PASS: 19After scanning, the report is created and uploaded as an artifact, as follows:
$ cp /zap/wrk/gl-dast-report.json .Uploading artifacts...gl-dast-report.json: found 1 matching filesUploading artifacts to coordinator... ok id=6 responseStatus=201 Created token=LbTRyRU-Job succeededAs you can see from the preceding examples, by utilizing GitLab Runners with Docker, it is very easy to start a dynamic security scan.
Known vulnerabilities in third-party components or dependencies are very common. They could even be part of the OWASP Top 10 List of Using Components with Known Vulnerabilities. The OWASP Web Malware Scanner (see https://www.owasp.org) is a malware scanner for web applications. It can be used to scan a web application by using signatures from a community build and a managed database. It works by testing each file of the web application for known signatures of malware.
These known vulnerable components should be identified at an early development stage. It is also good practice to perform vulnerability scanning of the dependency components not only in the development stage but also in the production stage on a regular basis.
Again, the dependency scan in your GitLab workflow is controlled through the .gitlab-ci.yml file. It also uses the Docker-in-Docker technique, as follows:
dependency_scanning: image: docker:stable variables: DOCKER_DRIVER: overlay2 allow_failure: true services: - docker:stable-dind script: - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - docker run --env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}" --volume "$PWD:/code" --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code artifacts: reports: dependency_scanning: gl-dependency-scanning-report.jsonFor this test, we used the same code (https://github.com/CSPF-Founder/JavaVulnerableLab) as we did in the SAST scan to show our results. Here, you can see the job as it prepares after being pushed some new code. It should pull the stable-dind image, as follows:
Running with gitlab-runner 11.7.0 (8bb608ff)on host gGEycKK-Using Docker executor with image docker:stable ...Starting service docker:stable-dind ...Pulling docker image docker:stable-dind ...Using docker image sha256:5b626cc3459ad077146e8aac1fbe25f7099d71c6765efd6552b9209ca7ea4dc1 for docker:stable-dind ...Waiting for services to be up and running...Pulling docker image docker:stable ...Using docker image sha256:73d492654a095a2f91078b2dfacd0cfe1a1fe25412fac54b4eb2f5a9609ad418 for docker:stable ...Running the image will execute the dependency scan, as shown in the following snippets:
Running on runner-gGEycKK--project-2-concurrent-0 via Joosts-MBP.fritz.box...Fetching changes...HEAD is now at e6b26fe Update .gitlab-ci.ymlFrom http://192.168.178.82/root/unsecuree6b26fe..3aa3162 master -> origin/masterChecking out 3aa3162f as master...Skipping Git submodules setup$ export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')$ docker run --env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}" --volume "$PWD:/code" --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code...The technology used was formerly called Gemnasium. It was bought by GitLab in 2018, as you can see in a statement at https://docs.gitlab.com/ee/user/project/import/gemnasium.html.
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/2.0.6/plexus-2.0.6.pom (17 kB at 621 kB/s)[INFO] Gemnasium Maven Plugin[INFO][INFO] Project's dependencies have been successfully dumped into: /tmp/app/gemnasium-maven-plugin.json[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 5.504 s[INFO] Finished at: 2019-02-23T11:45:49Z[INFO] ------------------------------------------------------------------------As you can see in the following code, some vulnerabilities in the MySQL library used were found:
+----------------------------------------------------------------------------------------+| Severity | Tool | Identifier |+----------------------------------------------------------------------------------------+| Unknown | Gemnasium | CVE-2015-7501 || || InvokerTransformer code execution during deserialization in commons || collections/commons-collections || Solution: Upgrade to the latest version || In pom.xml |+----------------------------------------------------------------------------------------+| Unknown | Gemnasium | CVE-2017-3523 || || Vulnerability in the MySQL Connectors in mysql/mysql-connector-java || Solution: Upgrade to the latest version || In pom.xml |+----------------------------------------------------------------------------------------+2019/02/23 11:45:51 [gemnasium-python] Detect project using plugin2019/02/23 11:45:51 [gemnasium-python] Project not compatible2019/02/23 11:45:51 [retire.js] Detect project using plugin2019/02/23 11:45:51 [retire.js] Project not compatibleUploading artifacts...gl-dependency-scanning-report.json: found 1 matching filesUploading artifacts to coordinator... ok id=7 responseStatus=201 Created token=1cdLFEJPJob succeededThe job ends by uploading the scan report.
Just like the other scans, dependency checking uses the same technique of running a specific scan program from inside a Docker container. In this case, the scan program in use is Gemnasium, which was taken over by GitLab last year. If a problematic dependency is found, it is displayed in the output and in the resulting report.
A nice feature of GitLab 12.0 is that after your conducted your dependency scan, the resulting list of dependencies is saved in your project. This is a much wanted feature by security/compliance teams to keep track of what dependencies are used throughout the enterprise:

In this chapter, we discussed the use of monitoring in the workflow, and the possibility to immediately integrate security monitoring. GitLab provides out-of-the-box opportunities to set up such things. In this chapter, we also looked at Prometheus and ways to write custom monitoring for it. In the next chapter, we will discuss integration options for GitLab, in case you need to connect to other tools.
- On which system is Prometheus inspired?
- What is the name of the Prometheus clients?
- On what path is the GitLab Metrics Exporter normally found?
- What language was used for the GitLab Monitor Exporter?
- How do you enable the built-in Prometheus server in the omnibus package?
- What does SAST mean?
- What does DAST mean?
- Which file is used to control security testing?
- Prometheus site: https://prometheus.io
- OWASP scan: https://www.owasp.org
- Practical Site Reliability Engineering, by Pethuru Raj Chelliah, Shreyash Naithani, and Shailender Singh:
- Hands-On Security in DevOps, by Tony Hsu:
- Industrial Internet Application Development, by Alena Traukina, Jayant Thomas, Prashant Tyagi, and Kishore Reddipalli: