Skip to content

Commit 1d8bfb3

Browse files
committed
Merge branch 'release/v2.23.0'
2 parents 8d8e086 + e766a20 commit 1d8bfb3

File tree

8 files changed

+116
-235
lines changed

8 files changed

+116
-235
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ Scripts for updating and debugging Kafka can be found [here](https://github.com/
4646
| MONGODB_IS_SSL | false | Switch to use (or not) TLS when connecting to mongodb |
4747
| SHUTDOWN_TIMEOUT | 5s | The graceful shutdown timeout (`time.Duration` format) |
4848
| DATASET_API_URL | http://localhost:22000 | The URL of the Dataset API |
49-
| DATASET_API_AUTH_TOKEN | FD0108EA-825D-411C-9B1D-41EF7727F465 | The token used to access the Dataset API |
5049
| HEALTHCHECK_INTERVAL | 30s | Time between self-healthchecks (`time.Duration` format) |
5150
| HEALTHCHECK_CRITICAL_TIMEOUT | 90s | The time taken for the health changes from warning state to critical due to subsystem check failures |
5251
| SERVICE_AUTH_TOKEN | FD0108EA-825D-411C-9B1D-41EF7727F465 | The token used to identify this service when authenticating |

api/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ func Setup(
113113
if cfg.EnablePrivateEndpoints {
114114
api.Router.Handle("/filter-outputs/{filter_output_id}", assert.FilterOutputType(http.HandlerFunc(api.updateFilterOutputHandler))).Methods("PUT")
115115
api.Router.HandleFunc("/filter-outputs/{filter_output_id}/events", api.addEventHandler).Methods("POST")
116+
} else if cfg.EnableFilterOutputs {
117+
// web journey
118+
//identityMiddleware := handlers.Identity(cfg.ZebedeeURL)
119+
api.Router.Handle("/filter-outputs/{filter_output_id}", assert.FilterOutputType(http.HandlerFunc(api.updateFilterOutputHandler))).Methods("PUT")
116120
}
117121

118122
return api

api/filter_outputs_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@ const (
2929
filterID3 = "123"
3030
)
3131

32+
/*
33+
func TestPutFilterOutputMiddleware(t *testing.T) {
34+
t.Parallel()
35+
filterFlexAPIMock := &apimock.FilterFlexAPIMock{}
36+
cfg := cfg()
37+
cfg.EnableFilterOutputs = true
38+
cfg.EnablePrivateEndpoints = false
39+
40+
Convey("Put filter output errors with wrong token", t, func() {
41+
r, err := http.NewRequest("PUT", "http://localhost:22100/filter-outputs/12345678", nil)
42+
So(err, ShouldBeNil)
43+
44+
w := httptest.NewRecorder()
45+
filterApi := api.Setup(cfg, mux.NewRouter(), &mock.DataStore{}, &mock.FilterJob{}, &mock.DatasetAPI{}, filterFlexAPIMock)
46+
filterApi.Router.ServeHTTP(w, r)
47+
So(w.Code, ShouldEqual, http.StatusUnauthorized)
48+
49+
})
50+
51+
}
52+
*/
3253
func TestSuccessfulGetFilterOutput(t *testing.T) {
3354
t.Parallel()
3455

ci/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ image_resource:
66
type: docker-image
77
source:
88
repository: golang
9-
tag: 1.18.3
9+
tag: 1.19.2
1010

1111
inputs:
1212
- name: dp-filter-api

ci/unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ image_resource:
66
type: docker-image
77
source:
88
repository: golang
9-
tag: 1.18.3
9+
tag: 1.19.2
1010

1111
inputs:
1212
- name: dp-filter-api

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package config
22

33
import (
4-
"time"
54
"fmt"
5+
"time"
66

77
mongodriver "github.com/ONSdigital/dp-mongodb/v3/mongodb"
88

@@ -24,7 +24,6 @@ type Config struct {
2424
KafkaSecSkipVerify bool `envconfig:"KAFKA_SEC_SKIP_VERIFY"`
2525
ShutdownTimeout time.Duration `envconfig:"SHUTDOWN_TIMEOUT"`
2626
DatasetAPIURL string `envconfig:"DATASET_API_URL"`
27-
DatasetAPIAuthToken string `envconfig:"DATASET_API_AUTH_TOKEN" json:"-"`
2827
HealthCheckInterval time.Duration `envconfig:"HEALTHCHECK_INTERVAL"`
2928
HealthCheckCriticalTimeout time.Duration `envconfig:"HEALTHCHECK_CRITICAL_TIMEOUT"`
3029
ServiceAuthToken string `envconfig:"SERVICE_AUTH_TOKEN" json:"-"`
@@ -38,6 +37,7 @@ type Config struct {
3837
DefaultMaxLimit int `envconfig:"DEFAULT_MAXIMUM_LIMIT"`
3938
AssertDatasetType bool `envconfig:"ASSERT_DATASET_TYPE"`
4039
FilterFlexAPIURL string `envconfig:"FILTER_FLEX_API_URL"`
40+
EnableFilterOutputs bool `envconfig:"ENABLE_FILTER_OUTPUTS_CHECK"`
4141
MongoConfig
4242
}
4343

@@ -70,7 +70,6 @@ func Get() (*Config, error) {
7070
KafkaMaxBytes: 2000000,
7171
ShutdownTimeout: 5 * time.Second,
7272
DatasetAPIURL: "http://localhost:22000",
73-
DatasetAPIAuthToken: "FD0108EA-825D-411C-9B1D-41EF7727F465",
7473
HealthCheckInterval: 30 * time.Second,
7574
HealthCheckCriticalTimeout: 90 * time.Second,
7675
MaxRequestOptions: 1000, // Maximum number of options acceptable in an incoming Patch request. Compromise between one option per call (inefficient) and an order of 100k options per call, for census data (memory and computationally expensive)
@@ -80,6 +79,7 @@ func Get() (*Config, error) {
8079
ServiceAuthToken: "FD0108EA-825D-411C-9B1D-41EF7727F465",
8180
ZebedeeURL: "http://localhost:8082",
8281
EnablePrivateEndpoints: true,
82+
EnableFilterOutputs: false,
8383
DownloadServiceURL: "http://localhost:23600",
8484
DownloadServiceSecretKey: "QB0108EZ-825D-412C-9B1D-41EF7747F462",
8585
AssertDatasetType: false,

go.mod

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
module github.com/ONSdigital/dp-filter-api
22

3-
go 1.18
3+
go 1.19
44

55
// to avoid 'sonatype-2021-4899' non-CVE Vulnerability
66
exclude github.com/gorilla/sessions v1.2.1
77

8+
//to avoide [CVE-2022-29153] CWE-918: Server-Side Request Forgery (SSRF)
9+
exclude github.com/hashicorp/consul/api v1.1.0
10+
811
require (
912
github.com/ONSdigital/dp-api-clients-go v1.43.0
10-
github.com/ONSdigital/dp-api-clients-go/v2 v2.145.0
13+
github.com/ONSdigital/dp-api-clients-go/v2 v2.186.0
1114
github.com/ONSdigital/dp-healthcheck v1.3.0
12-
github.com/ONSdigital/dp-kafka/v2 v2.5.0
15+
github.com/ONSdigital/dp-kafka/v2 v2.7.3
1316
github.com/ONSdigital/dp-mongodb-in-memory v1.3.1
14-
github.com/ONSdigital/dp-mongodb/v3 v3.0.2
15-
github.com/ONSdigital/dp-net v1.4.1
17+
github.com/ONSdigital/dp-mongodb/v3 v3.3.0
18+
github.com/ONSdigital/dp-net v1.5.0
1619
github.com/ONSdigital/dp-net/v2 v2.4.0
1720
github.com/ONSdigital/go-ns v0.0.0-20210916104633-ac1c1c52327e
1821
github.com/ONSdigital/log.go/v2 v2.2.0
@@ -22,47 +25,49 @@ require (
2225
github.com/pkg/errors v0.9.1
2326
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
2427
github.com/smartystreets/goconvey v1.7.2
25-
go.mongodb.org/mongo-driver v1.9.1
28+
go.mongodb.org/mongo-driver v1.10.3
2629
)
2730

2831
require (
29-
github.com/Shopify/sarama v1.34.1 // indirect
30-
github.com/aws/aws-sdk-go v1.44.44 // indirect
32+
github.com/Shopify/sarama v1.37.2 // indirect
33+
github.com/aws/aws-sdk-go v1.44.115 // indirect
3134
github.com/davecgh/go-spew v1.1.1 // indirect
3235
github.com/eapache/go-resiliency v1.3.0 // indirect
3336
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
3437
github.com/eapache/queue v1.1.0 // indirect
3538
github.com/fatih/color v1.13.0 // indirect
3639
github.com/go-avro/avro v0.0.0-20171219232920-444163702c11 // indirect
37-
github.com/go-stack/stack v1.8.1 // indirect
3840
github.com/golang/snappy v0.0.4 // indirect
39-
github.com/gopherjs/gopherjs v0.0.0-20220104163920-15ed2e8cf2bd // indirect
41+
github.com/google/uuid v1.3.0 // indirect
42+
github.com/gopherjs/gopherjs v1.17.2 // indirect
4043
github.com/hashicorp/errwrap v1.1.0 // indirect
4144
github.com/hashicorp/go-multierror v1.1.1 // indirect
4245
github.com/hashicorp/go-uuid v1.0.3 // indirect
4346
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
4447
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
4548
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
46-
github.com/jcmturner/gofork v1.0.0 // indirect
47-
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
49+
github.com/jcmturner/gofork v1.7.6 // indirect
50+
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
4851
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
4952
github.com/jmespath/go-jmespath v0.4.0 // indirect
5053
github.com/jtolds/gls v4.20.0+incompatible // indirect
51-
github.com/klauspost/compress v1.15.7 // indirect
52-
github.com/mattn/go-colorable v0.1.12 // indirect
53-
github.com/mattn/go-isatty v0.0.14 // indirect
54-
github.com/pierrec/lz4/v4 v4.1.15 // indirect
54+
github.com/klauspost/compress v1.15.11 // indirect
55+
github.com/mattn/go-colorable v0.1.13 // indirect
56+
github.com/mattn/go-isatty v0.0.16 // indirect
57+
github.com/montanaflynn/stats v0.6.6 // indirect
58+
github.com/pierrec/lz4/v4 v4.1.17 // indirect
5559
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
56-
github.com/smartystreets/assertions v1.2.1 // indirect
57-
github.com/spf13/afero v1.8.2 // indirect
60+
github.com/rogpeppe/go-internal v1.9.0 // indirect
61+
github.com/smartystreets/assertions v1.13.0 // indirect
62+
github.com/spf13/afero v1.9.2 // indirect
5863
github.com/square/mongo-lock v0.0.0-20220601164918-701ecf357cd7 // indirect
5964
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
6065
github.com/xdg-go/scram v1.1.1 // indirect
6166
github.com/xdg-go/stringprep v1.0.3 // indirect
6267
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
63-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
64-
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect
65-
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
66-
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect
67-
golang.org/x/text v0.3.7 // indirect
68+
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
69+
golang.org/x/net v0.0.0-20220927171203-f486391704dc // indirect
70+
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
71+
golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect
72+
golang.org/x/text v0.3.8 // indirect
6873
)

0 commit comments

Comments
 (0)