Skip to content

Commit 55ddde3

Browse files
paskalumputun
authored andcommitted
Update all dependencies to latest
Bump go-pkgz/testutils to 0.6.0, which moves testcontainers-go to 0.42 and migrates the docker client to the new moby/moby module. This drops github.com/docker/docker and google.golang.org/grpc from the graph entirely, clearing all open Dependabot alerts: - google.golang.org/grpc CVE-2026-33186 (critical, test-only) - github.com/docker/docker CVE-2026-34040 and related (high/medium, test-only) Also update mongo-driver, golang.org/x/net, otel and aws-sdk deps to latest within the go 1.25 requirement. Introduce constants for repeated mongo field names and operators to satisfy goconst. go test -race, go vet, golangci-lint and govulncheck all clean.
1 parent 0baca68 commit 55ddde3

724 files changed

Lines changed: 20066 additions & 30340 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

datastore/mongo.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ type Stores struct {
4545
// GetStores initialize collections and make indexes
4646
func (m *MongoServer) GetStores() Stores {
4747
rIndexes := []mongo.IndexModel{
48-
{Keys: bson.D{{Key: "enabled", Value: 1}, {Key: "domain", Value: 1}}},
49-
{Keys: bson.D{{Key: "user", Value: 1}, {Key: "domain", Value: 1}, {Key: "enabled", Value: 1}}},
50-
{Keys: bson.D{{Key: "domain", Value: 1}, {Key: "match_urls", Value: 1}}},
48+
{Keys: bson.D{{Key: fieldEnabled, Value: 1}, {Key: fieldDomain, Value: 1}}},
49+
{Keys: bson.D{{Key: "user", Value: 1}, {Key: fieldDomain, Value: 1}, {Key: fieldEnabled, Value: 1}}},
50+
{Keys: bson.D{{Key: fieldDomain, Value: 1}, {Key: "match_urls", Value: 1}}},
5151
}
5252

5353
return Stores{

datastore/rules.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ import (
1111
"go.mongodb.org/mongo-driver/v2/mongo/options"
1212
)
1313

14+
// mongo field names and operators reused across queries
15+
const (
16+
fieldDomain = "domain"
17+
fieldEnabled = "enabled"
18+
fieldID = "_id"
19+
opSet = "$set"
20+
)
21+
1422
// RulesDAO data-access obj for custom parsing rules, implements Rules
1523
type RulesDAO struct {
1624
*mongo.Collection
@@ -40,7 +48,7 @@ func (r RulesDAO) Get(ctx context.Context, rURL string) (Rule, bool) {
4048
}
4149

4250
var rules []Rule
43-
q := bson.M{"domain": u.Host, "enabled": true}
51+
q := bson.M{fieldDomain: u.Host, fieldEnabled: true}
4452
log.Printf("[DEBUG] query %v", q)
4553
cursor, err := r.Find(ctx, q)
4654
if err != nil {
@@ -59,13 +67,13 @@ func (r RulesDAO) Get(ctx context.Context, rURL string) (Rule, bool) {
5967
// GetByID returns record by id
6068
func (r RulesDAO) GetByID(ctx context.Context, id bson.ObjectID) (Rule, bool) {
6169
var rule Rule
62-
err := r.Collection.FindOne(ctx, bson.M{"_id": id}).Decode(&rule)
70+
err := r.Collection.FindOne(ctx, bson.M{fieldID: id}).Decode(&rule)
6371
return rule, err == nil
6472
}
6573

6674
// Save upsert rule
6775
func (r RulesDAO) Save(ctx context.Context, rule Rule) (Rule, error) {
68-
ch, err := r.UpdateOne(ctx, bson.M{"domain": rule.Domain}, bson.M{"$set": rule}, options.UpdateOne().SetUpsert(true))
76+
ch, err := r.UpdateOne(ctx, bson.M{fieldDomain: rule.Domain}, bson.M{opSet: rule}, options.UpdateOne().SetUpsert(true))
6977
if err != nil {
7078
log.Printf("[WARN] failed to save, error=%v, article=%v", err, rule)
7179
return rule, err
@@ -78,7 +86,7 @@ func (r RulesDAO) Save(ctx context.Context, rule Rule) (Rule, error) {
7886
// if rule was updated, we have no id, so try to find it by domain
7987
if rule.ID == bson.NilObjectID {
8088
var found Rule
81-
err = r.Collection.FindOne(ctx, bson.M{"domain": rule.Domain}).Decode(&found)
89+
err = r.Collection.FindOne(ctx, bson.M{fieldDomain: rule.Domain}).Decode(&found)
8290
if err == nil {
8391
rule.ID = found.ID
8492
}
@@ -88,7 +96,7 @@ func (r RulesDAO) Save(ctx context.Context, rule Rule) (Rule, error) {
8896

8997
// Disable marks enabled=false, by id
9098
func (r RulesDAO) Disable(ctx context.Context, id bson.ObjectID) error {
91-
_, err := r.UpdateOne(ctx, bson.M{"_id": id}, bson.M{"$set": bson.M{"enabled": false}})
99+
_, err := r.UpdateOne(ctx, bson.M{fieldID: id}, bson.M{opSet: bson.M{fieldEnabled: false}})
92100
return err
93101
}
94102

go.mod

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,39 @@ require (
77
github.com/go-pkgz/lgr v0.12.3
88
github.com/go-pkgz/rest v1.21.0
99
github.com/go-pkgz/routegroup v1.6.0
10-
github.com/go-pkgz/testutils v0.5.0
10+
github.com/go-pkgz/testutils v0.6.0
1111
github.com/jessevdk/go-flags v1.6.1
1212
github.com/kennygrant/sanitize v1.2.4
1313
github.com/mauidude/go-readability v0.0.0-20220221173116-a9b3620098b7
1414
github.com/stretchr/testify v1.11.1
15-
go.mongodb.org/mongo-driver/v2 v2.5.0
16-
golang.org/x/net v0.53.0
15+
go.mongodb.org/mongo-driver/v2 v2.7.0
16+
golang.org/x/net v0.56.0
1717
)
1818

1919
require (
2020
dario.cat/mergo v1.0.2 // indirect
2121
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
2222
github.com/Microsoft/go-winio v0.6.2 // indirect
23-
github.com/andybalholm/cascadia v1.3.3 // indirect
24-
github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect
25-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
26-
github.com/aws/aws-sdk-go-v2/config v1.32.13 // indirect
27-
github.com/aws/aws-sdk-go-v2/credentials v1.19.13 // indirect
28-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
29-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
30-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
31-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
32-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect
33-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
34-
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect
35-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
36-
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect
37-
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 // indirect
38-
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect
39-
github.com/aws/aws-sdk-go-v2/service/sso v1.30.14 // indirect
40-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.18 // indirect
41-
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
42-
github.com/aws/smithy-go v1.24.2 // indirect
23+
github.com/andybalholm/cascadia v1.3.4 // indirect
24+
github.com/aws/aws-sdk-go-v2 v1.41.6 // indirect
25+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.9 // indirect
26+
github.com/aws/aws-sdk-go-v2/config v1.32.16 // indirect
27+
github.com/aws/aws-sdk-go-v2/credentials v1.19.15 // indirect
28+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.22 // indirect
29+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect
30+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 // indirect
31+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.23 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.8 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.14 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.22 // indirect
35+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.22 // indirect
36+
github.com/aws/aws-sdk-go-v2/service/s3 v1.99.1 // indirect
37+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.10 // indirect
38+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.16 // indirect
39+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.20 // indirect
40+
github.com/aws/aws-sdk-go-v2/service/sts v1.42.0 // indirect
41+
github.com/aws/smithy-go v1.25.0 // indirect
4342
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
44-
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
4543
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4644
github.com/containerd/errdefs v1.0.0 // indirect
4745
github.com/containerd/errdefs/pkg v0.3.0 // indirect
@@ -50,8 +48,7 @@ require (
5048
github.com/cpuguy83/dockercfg v0.3.2 // indirect
5149
github.com/davecgh/go-spew v1.1.1 // indirect
5250
github.com/distribution/reference v0.6.0 // indirect
53-
github.com/docker/docker v28.5.2+incompatible // indirect
54-
github.com/docker/go-connections v0.6.0 // indirect
51+
github.com/docker/go-connections v0.7.0 // indirect
5552
github.com/docker/go-units v0.5.0 // indirect
5653
github.com/ebitengine/purego v0.10.0 // indirect
5754
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -60,32 +57,31 @@ require (
6057
github.com/go-ole/go-ole v1.3.0 // indirect
6158
github.com/golang/snappy v1.0.0 // indirect
6259
github.com/google/uuid v1.6.0 // indirect
63-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
6460
github.com/hashicorp/errwrap v1.1.0 // indirect
6561
github.com/hashicorp/go-multierror v1.1.1 // indirect
6662
github.com/jlaffaye/ftp v0.2.0 // indirect
67-
github.com/klauspost/compress v1.18.5 // indirect
63+
github.com/klauspost/compress v1.18.7 // indirect
6864
github.com/kr/fs v0.1.0 // indirect
69-
github.com/lufia/plan9stats v0.0.0-20260324052639-156f7da3f749 // indirect
65+
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
7066
github.com/magiconair/properties v1.8.10 // indirect
7167
github.com/moby/docker-image-spec v1.3.1 // indirect
7268
github.com/moby/go-archive v0.2.0 // indirect
69+
github.com/moby/moby/api v1.54.1 // indirect
70+
github.com/moby/moby/client v0.4.0 // indirect
7371
github.com/moby/patternmatcher v0.6.1 // indirect
7472
github.com/moby/sys/sequential v0.6.0 // indirect
7573
github.com/moby/sys/user v0.4.0 // indirect
7674
github.com/moby/sys/userns v0.1.0 // indirect
7775
github.com/moby/term v0.5.2 // indirect
7876
github.com/montanaflynn/stats v0.9.0 // indirect
79-
github.com/morikuni/aec v1.1.0 // indirect
8077
github.com/opencontainers/go-digest v1.0.0 // indirect
8178
github.com/opencontainers/image-spec v1.1.1 // indirect
82-
github.com/pkg/errors v0.9.1 // indirect
8379
github.com/pkg/sftp v1.13.10 // indirect
8480
github.com/pmezard/go-difflib v1.0.0 // indirect
8581
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
86-
github.com/shirou/gopsutil/v4 v4.26.2 // indirect
82+
github.com/shirou/gopsutil/v4 v4.26.3 // indirect
8783
github.com/sirupsen/logrus v1.9.4 // indirect
88-
github.com/testcontainers/testcontainers-go v0.41.0 // indirect
84+
github.com/testcontainers/testcontainers-go v0.42.0 // indirect
8985
github.com/tklauser/go-sysconf v0.3.16 // indirect
9086
github.com/tklauser/numcpus v0.11.0 // indirect
9187
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
@@ -95,17 +91,13 @@ require (
9591
github.com/yusufpapurcu/wmi v1.2.4 // indirect
9692
go.mongodb.org/mongo-driver v1.17.9 // indirect
9793
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
98-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
99-
go.opentelemetry.io/otel v1.42.0 // indirect
100-
go.opentelemetry.io/otel/metric v1.42.0 // indirect
101-
go.opentelemetry.io/otel/trace v1.42.0 // indirect
102-
golang.org/x/crypto v0.50.0 // indirect
103-
golang.org/x/sync v0.20.0 // indirect
104-
golang.org/x/sys v0.43.0 // indirect
105-
golang.org/x/text v0.36.0 // indirect
106-
google.golang.org/genproto/googleapis/api v0.0.0-20260311181403-84a4fc48630c // indirect
107-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect
108-
google.golang.org/grpc v1.79.1 // indirect
109-
google.golang.org/protobuf v1.36.11 // indirect
94+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect
95+
go.opentelemetry.io/otel v1.43.0 // indirect
96+
go.opentelemetry.io/otel/metric v1.43.0 // indirect
97+
go.opentelemetry.io/otel/trace v1.43.0 // indirect
98+
golang.org/x/crypto v0.53.0 // indirect
99+
golang.org/x/sync v0.21.0 // indirect
100+
golang.org/x/sys v0.46.0 // indirect
101+
golang.org/x/text v0.38.0 // indirect
110102
gopkg.in/yaml.v3 v3.0.1 // indirect
111103
)

0 commit comments

Comments
 (0)