Coder Social home page Coder Social logo

ozontech / dtrack-audit Goto Github PK

View Code? Open in Web Editor NEW
49.0 12.0 16.0 3.54 MB

OWASP Dependency Track API client for intergration into CI/CD pipeline

License: GNU General Public License v3.0

Go 99.14% Makefile 0.86%
security security-tools component-analysis software-composition-analysis

dtrack-audit's Introduction

dtrack-audit

OWASP Dependency Track API client for your security CI/CD pipeline. See Dependency-Track docs: Continuous Integration & Delivery for use case.

Install

Local Installation

Go 1.16+

go install github.com/ozontech/dtrack-audit/cmd/dtrack-audit@latest

Go version < 1.16

go get github.com/ozontech/dtrack-audit/cmd/dtrack-audit

Features

  • Fully configurable via environment variables
  • Async and sync modes. In async mode dtrack-audit simply sends SBOM file to DTrack API (like cURL but in much more comfortable way). Sync mode means: upload SBOM file, wait for the scan result, show it and exit with non-zero code. So you can break corresponding CI/CD job to make developers pay attention to findings
  • You can filter the results. With Sync mode enabled show result and fail an audit if the results include a vulnerability with a severity of specified level or higher. Severity levels are: critical, high, medium, low, info, unassigned
  • Auto creation of projects. With this feautre you can configure SCA (with dtrack-audit) step globally for your CI/CD and it will create project, e.g. with name from environment variable like $CI_PROJECT_NAME. So you don't need to configure it manually for each project
  • Support for TeamCity CI output. You can use -T flag to enable JSON output. After that, activate the Golang build feature.

Sample output

$ cyclonedx-bom -o bom.xml
$ dtrack-audit -s -g high

SBOM file is successfully uploaded to DTrack API. Result token is 12345f5e-4ccb-45fe-b8fd-1234a8bf0081

2 vulnerabilities found!

 > HIGH: Arbitrary File Write
   Component: adm-zip 0.4.7
   More info: https://dtrack/vulnerability/?source=NPM&vulnId=994

 > CRITICAL: Prototype Pollution
   Component: handlebars 4.0.11
   More info: https://dtrack/vulnerability/?source=NPM&vulnId=755

dtrack-audit's People

Contributors

oxdef 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

dtrack-audit's Issues

How do you run the program?

It's not obvious to me how to run the program locally:

$ git clone https://github.com/ozonru/dtrack-audit.git
Cloning into 'dtrack-audit'...
remote: Enumerating objects: 104, done.
remote: Counting objects: 100% (104/104), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 104 (delta 39), reused 79 (delta 24), pack-reused 0
Receiving objects: 100% (104/104), 29.85 KiB | 5.97 MiB/s, done.
Resolving deltas: 100% (39/39), done.

$ go run cmd/dtrack-audit/main.go
package command-line-arguments
	cmd/dtrack-audit/main.go:6:2: use of internal package github.com/ozonru/dtrack-audit/internal/dtrack not allowed

Maybe I don't know something, but it's the thing I want to understand. Maybe you changed your local $GOPATH and have a special directory structure for this project?

Add auto-registration of projects

Common case for microservices world is when you have tons of it and want to integrate SCA security control for all of them. You can add manually each or make single and mandatory CI/CD step/job for all services. To make it works we need to implement auto-registration of projects with algorithm like:

  1. Search in DTrack for project with name PROJECT_NAME
  2. If it is already exists then use it ID
  3. If new one then register with PROJECT_NAME and optionally additional information (e.g. Slack channel for alerts)
  4. Run Dtrack in the job in async mode by default and give developers opportunity to switch on sync mode with breaking pipeline exit code.

couldnt figure out the issue while running

command used:
Users/thinksabin/go/bin/dtrack-audit -a -i bom.xml -k PBohV8SZab8Rel5j1FEHZEI9wjDMdC1g -u http://192.168.43.221:8080

error:

Send SBOM file to Dependency Track for audit.

Usage of program: ...... 
Fields marked with (*) are required.

Environment variable DTRACK_AUTO_CREATE_PROJECT is already set.
Help required. thanks.

feature request: set project tags

I propose to add a new environment, DTRACK_PROJECT_TAGS.

Setting it to tag1 tag2 would call:

PATCH /api/v1/project/<UUID>
{"tags": [{"name": "tag1"}, {"name": "tag2"}]}

after creating or updating the project.

go install error

How to reproduce:

docker run -it --rm node:lts-alpine /bin/sh
apk add --no-cache git go
export GOROOT=/usr/lib/go
export GOPATH=/go
export PATH=/go/bin:$PATH
go install github.com/ozontech/dtrack-audit/cmd/dtrack-audit@latest

Go version: 1.17.4-r0

Error:

go: downloading github.com/ozontech/dtrack-audit v1.0.0
go install: github.com/ozontech/dtrack-audit/cmd/dtrack-audit@latest: github.com/ozontech/[email protected]: parsing go.mod:
	module declares its path as: github.com/ozonru/dtrack-audit
	        but was required as: github.com/ozontech/dtrack-audit

Following command works:

go install github.com/ozonru/dtrack-audit/cmd/dtrack-audit@latest

Project auto creation fails for PROJECT_CREATION_UPLOAD permission

Dependency Track v3.2.0 introduced the PROJECT_CREATION_UPLOAD permission that reduced the access that PORTFOLIO_MANAGEMENT gave. I get the following error upon upload of a BOM for a non-existing project:

$ dtrack-audit -a -n $PROJECT_NAME -k $DTRACK_KEY -u $DTRACK_URL -i bom.xml
[Dtrack Audit Error]: Permission error. Check that you have all required permissions

I am using dtrack-audit v1.0.0 and Dependency Track v4.3.4.

It looks like dtrack-audit is querying for a project, then trying to create a new one if it doesn't exist. This will fail if the key only had PROJECT_CREATION_UPLOAD permission.

feature request: print project UUID

By including the project's UUID in the console output, a direct link to the project in Dependency Track can be easily constructed. This link can be, for example, added as a note to a merge request, where developers can triage issues found.

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.