You will need a Snyk account to run scans. Snyk is available for free and all you need is a valid email address to register. Once you register, you can perform scans and view results locally or on the website.
You can register for a FREE account here.
Your Snyk access token must be protected and not shared with unauthorized parties to prevent exposure and unauthorized access.
You can read more about Snyk Access Token from their docs here.
The Snyk Command-Line-Interface (CLI) is highly portable and very popular with end users. We’ll use the Snyk CLI in this workshop to collect and send results about your vulnerabilities.
Start by downloading the Snyk CLI to your environment. In this workshop, we’ll prescribe steps to save time and you can find more details on the Snyk documentation site at: https://docs.snyk.io/snyk-cli/install-the-snyk-cli
At the Cloud9 prompt, enter these commands to download the binary for Linux and move them to your bin folder (/usr/local/bin):
curl https://static.snyk.io/cli/latest/snyk-linux -o snyk && \
chmod +x ./snyk && \
sudo mv ./snyk /usr/local/bin/
In Cloud9 environments, you will need to authenticate on the CLI with your API token. Previously, you should have created an API token. If not, navigate to your Snyk Account (https://app.snyk.io/account), and get your API_TOKEN by clicking into your Account Settings -> API Token section.
In the KEY field, click your “click to show” box to copy your API token.
You can then run this command where API_TOKEN is the value you copied.
snyk auth <API_TOKEN>
That should be it! Your response should look like the following:
snyk auth 12345678-abcd-efgh-1234head5678bead
Your account has been authenticated. Snyk is now ready to be used.
If you are not on a Cloud9 environment, then your CLI should be able to start up a web browser and you can authenticate with this command:
snyk auth
In this case, you’ll authenticate by logging on with the web UI of Snyk.
Great, you have created and safely stored your newly created Snyk access token, Now, let’s create the Terraform Cloud access token.