Skip to content

Commit

Permalink
Bump vendors to fix vulnerabilities (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahmily authored Sep 12, 2024
1 parent 58422e3 commit 70557d3
Show file tree
Hide file tree
Showing 55 changed files with 1,117 additions and 741 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
timeout-minutes:
required: false
type: number
default: 30
default: 60

jobs:
test:
Expand Down
8 changes: 5 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ linters:
- exhaustive
# TODO:// enable this lint
# - exhaustruct
- exportloopref
- gci
- goconst
- gocritic
Expand Down Expand Up @@ -88,7 +87,7 @@ linters-settings:
sections:
- standard
- default
- prefix(github.com/apache/skywalking-banyandb/)
- prefix(github.com/apache/skywalking-banyandb/)
gocritic:
enabled-checks:
- appendCombine
Expand Down Expand Up @@ -116,6 +115,9 @@ linters-settings:
# toplevel - for top level comments;
# all - for all comments.
scope: toplevel
gosec:
excludes:
- G115 # integer overflow conversion (TODO: verify these)
staticcheck:
checks: ["all", "-ST1000", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
exhaustive:
Expand All @@ -129,7 +131,7 @@ linters-settings:
- 'cobra\.Command$'

run:
go: "1.22"
go: "1.23"
issues:
exclude-rules:
- path: ".*\\.pb\\.go"
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Release Notes.
- Push "skywalking-banyandb:<tag>-testing" image for e2e and stress test. This image contains bydbctl to do a health check.
- Set etcd-client log level to "error" and etcd-server log level to "warn".
- Push "skywalking-banyandb:<tag>-slim" image for the production environment. This image doesn't contain bydbctl and Web UI.
- Bump go to 1.23.

## 0.6.1

Expand Down Expand Up @@ -122,6 +123,7 @@ Release Notes.
- Bump all dependencies of Go and Node.
- Combine banyand and bydbctl Dockerfile.
- Update readme for bydbctl
- Introduce the go vulnerability check to "pre-push" task.

## 0.5.0

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Once we've discussed your changes and you've got your code ready, make sure that

Users who want to build a binary from sources have to set up:

* Go 1.22
* Go 1.23
* Node 20.12
* Git >= 2.30
* Linux, macOS or Windows + WSL2
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ check-req: ## Check the requirements
@$(MAKE) -C scripts/ci/check test
@$(MAKE) -C ui check-version

include scripts/build/vuln.mk

vuln-check: $(GOVULNCHECK)
$(GOVULNCHECK) -show color,verbose ./...

check: ## Check that the status is consistent with CI
$(MAKE) license-check
$(MAKE) format
Expand All @@ -123,6 +128,7 @@ pre-push: ## Check source files before pushing to the remote repo
$(MAKE) lint
$(MAKE) license-dep
$(MAKE) check
$(MAKE) vuln-check

##@ License targets

Expand Down
2 changes: 1 addition & 1 deletion api/proto/banyandb/property/v1/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ service PropertyService {
rpc List(ListRequest) returns (ListResponse) {
option (google.api.http) = {
get: "/v1/property/lists/{container.group}/{container.name}/{ids}/{tags}"
additional_bindings {get: "/v1/property/lists/{container.group}"}
additional_bindings: {get: "/v1/property/lists/{container.group}"}
};
}
rpc KeepAlive(KeepAliveRequest) returns (KeepAliveResponse) {
Expand Down
4 changes: 2 additions & 2 deletions api/proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ deps:
- buf.build/envoyproxy/protoc-gen-validate
lint:
use:
- DEFAULT
- STANDARD
breaking:
use:
- FILE
- FILE
25 changes: 21 additions & 4 deletions banyand/metadata/schema/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package schema

import (
"context"
"math"
"path"
"time"

Expand Down Expand Up @@ -180,11 +181,27 @@ func (e *etcdSchemaRegistry) replaceProperty(ctx context.Context, key string, pr
if err != nil {
return false, 0, 0, err
}
return true, uint32(len(property.Tags)), leaseID, nil
var tagCount uint32
if tagCount, err = tagLen(property); err != nil {
return false, 0, 0, err
}
return true, tagCount, leaseID, nil
}

func tagLen(property *propertyv1.Property) (uint32, error) {
tagsCount := len(property.Tags)
if tagsCount < 0 || tagsCount > math.MaxUint32 {
return 0, errors.New("integer overflow: tags count exceeds uint32 range")
}
tagsNum := uint32(tagsCount)
return tagsNum, nil
}

func (e *etcdSchemaRegistry) mergeProperty(ctx context.Context, key string, property *propertyv1.Property, ttl int64) (bool, uint32, int64, error) {
tagsNum := uint32(len(property.Tags))
tagCount, err := tagLen(property)
if err != nil {
return false, 0, 0, err
}
existed, err := e.GetProperty(ctx, property.Metadata, nil)
if errors.Is(err, ErrGRPCResourceNotFound) {
return e.replaceProperty(ctx, key, property, ttl)
Expand All @@ -199,7 +216,7 @@ func (e *etcdSchemaRegistry) mergeProperty(ctx context.Context, key string, prop
}
merge := func(existed *propertyv1.Property) (*propertyv1.Property, error) {
tags := make([]*modelv1.Tag, 0)
for i := 0; i < int(tagsNum); i++ {
for i := 0; i < int(tagCount); i++ {
t := property.Tags[i]
tagExisted := false
for _, et := range existed.Tags {
Expand Down Expand Up @@ -262,7 +279,7 @@ func (e *etcdSchemaRegistry) mergeProperty(ctx context.Context, key string, prop
if prevLeaseID > 0 {
_, _ = e.client.Revoke(ctx, clientv3.LeaseID(prevLeaseID))
}
return false, tagsNum, leaseID, nil
return false, tagCount, leaseID, nil
}

func (e *etcdSchemaRegistry) grant(ctx context.Context, ttl int64) (int64, error) {
Expand Down
4 changes: 2 additions & 2 deletions banyand/queue/pub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (p *pub) OnAddOrUpdate(md schema.Metadata) {
if _, ok := p.evictable[name]; ok {
return
}
conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
conn, err := grpc.NewClient(address, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
if err != nil {
p.log.Error().Err(err).Msg("failed to connect to grpc server")
return
Expand Down Expand Up @@ -248,7 +248,7 @@ func (p *pub) checkClientHealthAndReconnect(conn *grpc.ClientConn, md schema.Met
for {
select {
case <-time.After(backoff):
connEvict, errEvict := grpc.Dial(node.GrpcAddress, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
connEvict, errEvict := grpc.NewClient(node.GrpcAddress, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
if errEvict == nil && p.healthCheck(en.n, connEvict) {
func() {
p.mu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion banyand/queue/sub/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type server struct {
log *logger.Logger
ser *grpclib.Server
listeners map[bus.Topic]bus.MessageListener
*clusterv1.UnimplementedServiceServer
clusterv1.UnimplementedServiceServer
metrics *metrics
clientCloser context.CancelFunc
host string
Expand Down
4 changes: 2 additions & 2 deletions banyand/stream/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (dbs *databaseSupplier) SupplyTSDB() io.Closer {
return nil
}

func generateRandomNumber(max int64) int {
n, _ := rand.Int(rand.Reader, big.NewInt(max))
func generateRandomNumber(maxValue int64) int {
n, _ := rand.Int(rand.Reader, big.NewInt(maxValue))
return int(n.Int64()) + 1
}

Expand Down
4 changes: 2 additions & 2 deletions bydbctl/internal/cmd/measure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ var _ = Describe("Measure Data Query", func() {
})

It("query all measure data", func() {
conn, err := grpclib.Dial(
conn, err := grpclib.NewClient(
grpcAddr,
grpclib.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down Expand Up @@ -242,7 +242,7 @@ tagProjection:
})

DescribeTable("query measure data with time range flags", func(timeArgs ...string) {
conn, err := grpclib.Dial(
conn, err := grpclib.NewClient(
grpcAddr,
grpclib.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
4 changes: 2 additions & 2 deletions bydbctl/internal/cmd/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ var _ = Describe("Stream Data Query", func() {
})

It("query stream all data", func() {
conn, err := grpclib.Dial(
conn, err := grpclib.NewClient(
grpcAddr,
grpclib.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down Expand Up @@ -243,7 +243,7 @@ projection:
})

DescribeTable("query stream data with time range flags", func(timeArgs ...string) {
conn, err := grpclib.Dial(
conn, err := grpclib.NewClient(
grpcAddr,
grpclib.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
Loading

0 comments on commit 70557d3

Please sign in to comment.