Getting started overview

Deepcode's technology is integrated into Snyk Code, a static application security testing (SAST) tool that helps developers find and fix vulnerabilities in their proprietary code. This guide outlines the process of initiating a Snyk account, obtaining necessary authentication credentials, and executing an initial code analysis. The primary interaction points for Deepcode's functionality through Snyk are the Snyk CLI, IDE plugins, and integrations within Continuous Integration/Continuous Delivery (CI/CD) pipelines Snyk homepage.

The process generally involves these steps:

  1. Create a Snyk Account: Register for a Snyk account, which provides access to the Deepcode-powered Snyk Code features.
  2. Obtain API Token: Generate an API token from your Snyk account settings for authentication with the Snyk CLI or CI/CD environments.
  3. Install Snyk CLI or IDE Plugin: Set up the Snyk Command Line Interface or integrate a Snyk plugin into your preferred Integrated Development Environment.
  4. Run a Scan: Execute a scan on your project to identify security vulnerabilities.
  5. Review Results: Analyze the reported vulnerabilities and recommended fixes.

This reference provides the foundational steps to begin using Snyk Code's capabilities to integrate security into your development workflow.

Create an account and get keys

To access Deepcode's features via Snyk Code, you need a Snyk account. Snyk offers a free plan for developers, which includes 100 tests per month and limited features, suitable for initial exploration. Paid plans, such as the Team plan, start from $19 per developer per month for expanded capabilities Snyk pricing page.

Account Creation

  1. Navigate to the Snyk website.
  2. Click on the "Sign Up" or "Get Started Free" button.
  3. You can register using an existing GitHub, Google, or Microsoft account, or by providing an email address and creating a password.
  4. Follow the on-screen prompts to complete your account setup. This may include verifying your email address.

Obtaining Your API Token

The Snyk API token is essential for authenticating requests made through the Snyk CLI or CI/CD integrations. This token acts as your API key.

  1. Log in to your newly created Snyk account.
  2. In the Snyk dashboard, navigate to the "Settings" section, typically found by clicking on your profile icon or organization name.
  3. Within Settings, locate "API Keys" or "General Settings" (the exact path may vary slightly based on UI updates).
  4. Your API token will be displayed. Copy this token securely. It is a sensitive credential and should be treated like a password.
  5. For CLI usage, you will typically set this token as an environment variable or use the snyk auth command, which will prompt you for the token.

Your first request

Your "first request" with Deepcode's technology through Snyk Code typically involves running a scan using the Snyk CLI on a local project. This demonstrates how the SAST capabilities analyze your code for vulnerabilities.

Prerequisites

  • A Snyk account with your API token obtained.
  • Node.js installed on your system (Snyk CLI is an npm package).
  • A local code repository (e.g., a simple Node.js, Python, Java, or Go project).

Step-by-step: Snyk CLI Scan

  1. Install Snyk CLI: Open your terminal or command prompt and install the Snyk CLI globally using npm:
    npm install -g snyk
  2. Authenticate Snyk CLI: Authenticate the CLI with your Snyk account using the API token you obtained:
    snyk auth
    This command will open a browser window to complete the authentication process or prompt you to paste your API token.
  3. Navigate to your Project: Change directory into the root of your local code repository:
    cd /path/to/your/project
  4. Run a Snyk Code Scan: Execute the snyk code test command to scan your project for vulnerabilities. This command specifically triggers the SAST capabilities powered by Deepcode technology.
    snyk code test
    The CLI will analyze your source code and report any identified vulnerabilities directly in your terminal. It will also provide links to more detailed information on the Snyk platform.
  5. Review Results: Examine the output in your terminal. Snyk Code will list vulnerabilities, their severity, and often suggest remediation steps. For instance, it might identify a potential SQL injection vulnerability or an insecure use of cryptographic functions. The Snyk documentation provides a comprehensive Snyk CLI for Snyk Code guide for further details on commands and options.

Example Output (Illustrative)


✔ Test completed.


Tested /path/to/your/project for known security vulnerabilities.


✗ [High Severity] Insecure Random Number Generation
  Path: src/utils.js:15
  Details: Using Math.random() for security-sensitive operations can lead to predictable outputs. Consider crypto.randomBytes.
  CWE: CWE-330 (Use of Insufficiently Random Values)
  Fix: Upgrade to a more secure random number generator.
  Info: https://security.snyk.io/vuln/SNYK-JS-MATHRANDOM-12345


Found 1 vulnerability in your code.

Common next steps

After successfully running your first Snyk Code scan, consider these common next steps to integrate security more deeply into your development lifecycle:

  • Explore IDE Integrations: Install the Snyk plugin for your Integrated Development Environment (IDE) (e.g., VS Code, IntelliJ IDEA). This allows you to see security vulnerabilities and fixes directly as you code, providing real-time feedback Snyk Code IDE plugins documentation.
  • Integrate with CI/CD: Implement Snyk Code scans into your Continuous Integration/Continuous Delivery pipeline. This automates security checks on every code commit or build, preventing vulnerabilities from reaching production. Snyk offers integrations with popular CI/CD platforms like Jenkins, GitLab CI, GitHub Actions, and Azure DevOps Snyk CI/CD integrations guide.
  • Configure Project Settings: Access your project on the Snyk web dashboard to configure settings, such as ignoring specific vulnerabilities, setting custom policies, or inviting team members.
  • Scan Open Source Dependencies: While Snyk Code focuses on your proprietary code, Snyk also offers Snyk Open Source to identify vulnerabilities in your project's third-party dependencies. Running snyk test (without code) will scan your dependencies.
  • Review Remediation Guidance: For each identified vulnerability, Snyk provides detailed remediation advice, including code examples and links to relevant Common Weakness Enumeration (CWE) entries. Understanding these recommendations is crucial for effective vulnerability resolution. The MITRE CWE list is a widely recognized standard for categorizing software weaknesses.
  • Set up Reporting and Alerts: Configure Snyk to send alerts for new vulnerabilities or policy violations, and generate reports to track your security posture over time.

Troubleshooting the first call

Encountering issues during your initial Snyk Code scan is common. Here are some troubleshooting tips:

Issue What to do Where to check
snyk: command not found Snyk CLI is not installed or not in your system's PATH.
  • Re-run npm install -g snyk.
  • Ensure Node.js and npm are correctly installed and configured.
  • Check your system's PATH environment variable.
Authentication failure (e.g., "Unauthorized") Incorrect or expired API token.
  • Run snyk auth again to re-authenticate.
  • Verify your API token from your Snyk account settings.
  • Ensure no leading/trailing spaces when pasting the token.
No vulnerabilities found (unexpectedly) Project too simple, Snyk Code not configured for language, or scan scope limited.
  • Try scanning a project known to have vulnerabilities or a more complex codebase.
  • Ensure your project's language is supported by Snyk Code Snyk Code supported languages.
  • Check for specific file exclusions or configurations that might limit the scan.
Scan takes too long or hangs Large codebase, network issues, or resource constraints.
  • Ensure a stable internet connection.
  • For very large projects, consider scanning specific directories using snyk code test --scan-code-only --target-directory=<path>.
  • Check system resources (CPU, memory).
Error: "No supported projects found" Snyk couldn't detect a recognizable project type in the directory.
  • Ensure you are in the root directory of a supported project (e.g., with a package.json, pom.xml, requirements.txt).
  • Verify the project structure aligns with Snyk's expectations for that language.

For further assistance, consult the Snyk documentation or Snyk's community support channels.