Discovering security vulnerabilities
There are many tools that help in identifying major security vulnerabilities in your Gin web application. In this section, we will cover two tools, out of a few, that you can adopt while building a Gin application: Snyk and Golang Security Checker (Gosec).
In the upcoming sections, we will demonstrate how to use these tools to inspect security vulnerabilities in a Gin application.
Gosec
Gosec is a tool written in Golang that inspects the source code for security problems by scanning the Go abstract syntax tree (AST). Before we inspect the Gin application code, we need to install the Gosec binary.
The binary can be downloaded with the following cURL command. Here, version 2.7.0 is being used:
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.7.0
Once the command is installed, run the following command on your project folder. The ./...
argument is set to recursively...