Skip to content

Commit

Permalink
NEWRELIC-4009 fix(dependencies): removed golangci and bumped dependen…
Browse files Browse the repository at this point in the history
…cies (#197)

This commit does the following:
 - Fix #189
 - Removing GolangCi to reduce false positives.
 - Updates sarama library and re-generate code for the interface change
  • Loading branch information
paologallinaharbur authored Oct 18, 2022
1 parent f609a22 commit 6dd86cf
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 1,945 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Security Scan

on:
push:
branches:
- master
- main
pull_request:
schedule:
- cron: "0 3 * * *"

jobs:
trivy:
name: Trivy security scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.7.1
if: ${{ ! github.event.schedule }} # Do not run inline checks when running periodically
with:
scan-type: fs
ignore-unfixed: true
exit-code: 1
severity: 'HIGH,CRITICAL'
skip-files: 'tests/integration/consumer-producer/pom.xml'

- name: Run Trivy vulnerability scanner sarif output
uses: aquasecurity/trivy-action@0.7.1
if: ${{ github.event.schedule }} # Generate sarif when running periodically
with:
scan-type: fs
ignore-unfixed: true
severity: 'HIGH,CRITICAL'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
skip-files: 'tests/integration/consumer-producer/pom.xml'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: ${{ github.event.schedule }} # Upload sarif when running periodically
with:
sarif_file: 'trivy-results.sarif'
13 changes: 3 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ INTEGRATION := kafka
BINARY_NAME = nri-$(INTEGRATION)
GO_PKGS := $(shell go list ./... | grep -v "/vendor/")
GO_FILES := ./src/
GOFLAGS = -mod=readonly
GOLANGCI_LINT = github.com/golangci/golangci-lint/cmd/golangci-lint
GOFLAGS = -mod=readonly

all: build

build: clean validate test compile
build: clean test compile

generate:
@echo "=== $(INTEGRATION) === [ generate ]: Generating mocks..."
Expand All @@ -22,12 +21,6 @@ clean:
@echo "=== $(INTEGRATION) === [ clean ]: Removing binaries and coverage file..."
@rm -rfv bin coverage.xml $(TARGET)

validate:
@printf "=== $(INTEGRATION) === [ validate ]: running golangci-lint & semgrep... "
@go run $(GOFLAGS) $(GOLANGCI_LINT) run --verbose
@[ -f .semgrep.yml ] && semgrep_config=".semgrep.yml" || semgrep_config="p/golang" ; \
docker run --rm -v "${PWD}:/src:ro" --workdir /src returntocorp/semgrep -c "$$semgrep_config"

compile:
@echo "=== $(INTEGRATION) === [ compile ]: Building $(BINARY_NAME)..."
@go build -o bin/$(BINARY_NAME) ./src
Expand All @@ -51,4 +44,4 @@ integration-test:
include $(CURDIR)/build/ci.mk
include $(CURDIR)/build/release.mk

.PHONY: all build clean validate compile test
.PHONY: all build clean compile test
8 changes: 0 additions & 8 deletions build/ci.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ ci/debug-container: ci/deps
-e GPG_PRIVATE_KEY_BASE64 \
$(BUILDER_TAG) bash

.PHONY : ci/validate
ci/validate: ci/deps
@docker run --rm -t \
--name "nri-$(INTEGRATION)-validate" \
-v $(CURDIR):/go/src/github.com/newrelic/nri-$(INTEGRATION) \
-w /go/src/github.com/newrelic/nri-$(INTEGRATION) \
$(BUILDER_TAG) make validate

.PHONY : ci/test
ci/test: ci/deps
@docker run --rm -t \
Expand Down
21 changes: 12 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/newrelic/nri-kafka
go 1.18

require (
github.com/Shopify/sarama v1.36.0
github.com/Shopify/sarama v1.37.2
github.com/newrelic/infra-integrations-sdk v3.7.3+incompatible
github.com/newrelic/nrjmx/gojmx v0.0.0-20220818135048-2c786ece1d31
github.com/newrelic/nrjmx/gojmx v0.0.0-20221004104925-6819f176e889
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
github.com/stretchr/testify v1.8.0
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c
github.com/xdg-go/scram v1.1.1
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7
)

require (
Expand All @@ -28,17 +28,20 @@ require (
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/xdg/stringprep v1.0.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/net v0.0.0-20220927171203-f486391704dc // indirect
golang.org/x/text v0.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6dd86cf

Please sign in to comment.