GithubHelp home page GithubHelp logo

snyk / serverless-snyk Goto Github PK

View Code? Open in Web Editor NEW
40.0 8.0 4.0 25 KB

Serverless plugin for securing your dependencies with Snyk

License: Other

JavaScript 100.00%
snyk security serverless vulnerabilities

serverless-snyk's Introduction

Snyk logo

Build Status Known Vulnerabilities


Serverless Snyk Plugin

Around 14% of npm packages carry a known vulnerability, and new vulnerabilities are being discovered every day. The Serverless Snyk plugin helps you keep your application secure by allowing you to check the Node.js dependencies in your Serverless app for known vulnerabilities using Snyk.

Read more about Serverless security and how vulnerable open source packages affect it on the Snyk blog.

For Serverless v1 only.

How do I use it?

  1. Fix any existing vulnerable packages using Snyk's GitHub integration or Snyk wizard.

  2. Install the Serverless Snyk plugin using npm

    npm install serverless-snyk --save

    You should now have Serverless Snyk installed and ready to go. You can confirm that the plugin has been installed by running serverless from your command line. You should see the Snyk plugin in the list of installed plugins.

  3. Add the plugin to your Serverless config

    Next, you'll need to add the plugin to your serverless.yml file:

    plugins:
       - serverless-snyk
  4. Optional: Get a Snyk API Key

    To avoid running into API rate limits and to enable continuous monitoring, you'll need to sign up for a Snyk account (if you don't have one already) and copy the API token from your dashboard. Detailed instructions on how to include the API token in your configuration are included in the setting an API key section below.

That's it! Now when you deploy, the Serverless Snyk plugin will scan your application for known vulnerabilities.

Configuring

Setting an API key

To ensure you don't run into any API rate limits, or to enable continuous monitoring of the state of your application's security, you'll need to include a valid API token in your application.

You can do this by signing up for an account (if you don't have one already) and copying the API token from your dashboard.

Since the Serverless framework does not currently support environment variables, Serverless Snyk uses dotenv to store your token. You'll want to create a .env file in the root of your project, and then set a snykAuth variable with the value you copied from your dashboard:

snykAuth=YOUR_API_TOKEN

Deploying even if vulnerabilities are discovered

By default, Serverless Snyk will stop serverless from deploying if Snyk detects any vulnerabilities in your dependencies. Each vulnerability will also be outputted, and you'll be prompted to run snyk wizard to address the issues.

If you would like serverless to deploy your application even if Snyk finds known vulnerabilities, you can accomplish this by using a custom variable in your serverless.yml file.

custom:
  snyk:
    breakOnVuln: false

Snyk will still run and report any vulnerabilities, but the deploy will now continue on successfully.

Continuous monitoring

Snyk can take a snapshot of the current state of your dependencies each time you deploy, and proactively you of any newly discovered vulnerabilities that may impact them.

This feature requires an API token. If you've included the the API token as described above, the plugin will monitor your application by default.

There may be cases where you want to be authenticated to avoid API limits, but you don't want to monitor your application. You can turn off monitoring in the serverless.yml file:

custom:
  snyk:
    monitor: false

License

License: Apache License, Version 2.0

serverless-snyk's People

Contributors

tkadlec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-snyk's Issues

Getting error at serverless deploy

npm install serverless-snyk --save

serverless.yml

plugins:
   - serverless-snyk

Getting error on serverless deploy

 Error: Cannot find module 'snyk/lib'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
      at Function.Module._load (internal/modules/cjs/loader.js:506:25)
      at Module.require (internal/modules/cjs/loader.js:636:17)
      at require (internal/modules/cjs/helpers.js:20:18)

Support for Snyk Iac?

  • Does this not have Support for Snyk Iac?
  • Is that in the roadmap? or are there any workarounds for it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.