Giter VIP home page Giter VIP logo

rules_snyk's Introduction

Snyk logo

snyk-oss-category

Snyk Open Source rules for Bazel

build status

Rules to test and monitor your open source (external) dependencies with Snyk

Overview

Current support is limited to maven OSS for projects using rules_jvm_external

Support for additional OSS types is forthcoming, in order of priority:

  • go modules (rules_go)
  • pip (rules_python)
  • npm (rules_nodejs)
  • others in order of priority

Installation

Load the rules into your WORKSPACE to make them available

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
    name = "rules_snyk",
    remote = "https://github.com/snyk-labs/rules_snyk.git",
    commit = "1d9bd57",
)

load("@rules_snyk//:repositories.bzl", "rules_snyk_repos")
rules_snyk_repos()

load("@rules_python//python:pip.bzl", "pip_parse")

pip_parse(
    name = "snyk_py_deps",
    requirements_lock = "@rules_snyk//third_party:requirements.txt",
)

load("@snyk_py_deps//:requirements.bzl", install_snyk_deps = "install_deps")
install_snyk_deps()

Usage

via BUILD file

Maven example

load("@rules_snyk//:defs.bzl", "snyk_maven")

snyk_maven(
    name = "snyk",
    target = ":lib",
    snyk_organization_id = "<snyk_org_id>"
)

snyk_maven is a macro, such that when the target is built, e.g.

bazel build :lib

Additional targets will automatically be created for Snyk . In this example, those would be

:snyk_test
:snyk_monitor

Invocation

environment variables:

  • SNYK_TOKEN required to authenticate to Snyk
  • SNYK_ORG_ID not required if specifying snyk_organization_id in the BUILD file

To test for issues with Snyk

bazel run :snyk_test

To monitor the target in Snyk

bazel run :snyk_monitor

via --aspect

TBD

rules_snyk's People

Contributors

github-actions[bot] avatar scott-es avatar twheys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rules_snyk's Issues

[FEAT]: Support rules_js instead of rules_nodejs

Is there an existing feature request for this?

  • I have searched the existing feature requests

Description

rules_nodejs is no longer maintained. The code authors (Aspect.dev) have started a new ruleset known as rules_js which relies on pnpm as the locking mechanism and layout tool instead of yarn and npm. We currently are considering/moving to this rule set for the speed gains and better bazel interoperability. However, we want to make sure Snyk is still able to read our lockfiles and support of dependency vulnerability story.

Additional Information

Reach out to the maintainer in https://join.slack.com/t/bazelbuild/shared_invite/zt-1omx36ec7-nDHp5YM1hvZ3tkWfBjq~NQ in the #javascript channel or see https://aspect.build/ for more info

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.