Skip to content

Commit 42ee215

Browse files
committed
Merge remote-tracking branch 'cactus/master'
2 parents 3a2461f + 1f86cb5 commit 42ee215

File tree

9 files changed

+96
-147
lines changed

9 files changed

+96
-147
lines changed

.github/workflows/publish-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Go ${{ matrix.goVer }}
1313
uses: actions/setup-go@v1
1414
with:
15-
go-version: '1.17.x'
15+
go-version: '1.19.x'
1616
id: go
1717

1818
- name: Src Checkout

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Build
1111
strategy:
1212
matrix:
13-
go: ['1.17.x']
13+
go: ['1.19.x']
1414
platform: [ubuntu-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:
@@ -34,8 +34,8 @@ jobs:
3434
env:
3535
GOPROXY: "https://proxy.golang.org"
3636
run: |
37-
go get honnef.co/go/tools/cmd/staticcheck
38-
go get github.com/securego/gosec/cmd/gosec
37+
go install honnef.co/go/tools/cmd/staticcheck@2023.1.1
38+
go install github.com/securego/gosec/v2/cmd/gosec@latest
3939
hash -r
4040
make check
4141

CHANGELOG.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ toc::[]
1919

2020
== HEAD
2121

22+
== v2.4.3 - 2023-02-18
23+
* update library dependency golang.org/x/net. +
24+
refs:
25+
link:https://github.com/cactus/go-camo/security/dependabot/3[dependabot-3],
26+
link:https://github.com/cactus/go-camo/security/dependabot/4[dependabot-4]
27+
28+
== v2.4.2 - 2023-02-16
29+
* update library dependency prometheus, covering CVE-2022-21698. +
30+
Note that for go-camo, the issue in the prometheus library was exploitable
31+
only when the metrics option/flag (--metrics) is enabled.
32+
* build with go1.19.5
33+
34+
== v2.4.1 - 2022-09-28
35+
* Rebuild release with go-1.19.1
36+
2237
== v2.4.0 - 2022-01-30
2338
* Add support for internal address proxies (HTTP(S)_PROXY). +
2439
issue #55

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ setup-gox:
5454
@if [ -z "$(shell which gox)" ]; then \
5555
echo "* 'gox' command not found."; \
5656
echo " install (or otherwise ensure presence in PATH)"; \
57-
echo " go get github.com/mitchellh/gox"; \
57+
echo " go install github.com/mitchellh/gox"; \
5858
exit 1;\
5959
fi
6060

go.mod

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
module github.com/cactus/go-camo
22

3+
go 1.19
4+
35
require (
46
github.com/cactus/mlog v1.0.4
5-
github.com/jessevdk/go-flags v1.4.0
6-
github.com/prometheus/client_golang v1.11.0
7-
github.com/prometheus/common v0.26.0
7+
github.com/jessevdk/go-flags v1.5.0
8+
github.com/prometheus/client_golang v1.14.0
9+
github.com/prometheus/common v0.39.0
810
github.com/xlab/treeprint v1.1.0
9-
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
10-
gotest.tools/v3 v3.0.3
11+
golang.org/x/net v0.7.0
12+
gotest.tools/v3 v3.4.0
1113
)
1214

13-
go 1.13
15+
require (
16+
github.com/beorn7/perks v1.0.1 // indirect
17+
github.com/cactus/tai64 v1.0.1 // indirect
18+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
19+
github.com/golang/protobuf v1.5.2 // indirect
20+
github.com/google/go-cmp v0.5.8 // indirect
21+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
22+
github.com/prometheus/client_model v0.3.0 // indirect
23+
github.com/prometheus/procfs v0.8.0 // indirect
24+
golang.org/x/sys v0.5.0 // indirect
25+
golang.org/x/text v0.7.0 // indirect
26+
google.golang.org/protobuf v1.28.1 // indirect
27+
)

go.sum

Lines changed: 46 additions & 131 deletions
Large diffs are not rendered by default.

pkg/camo/helpers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package camo
66

77
import (
88
"fmt"
9-
"io/ioutil"
9+
"io"
1010
"net/http"
1111
"net/http/httptest"
1212
"testing"
@@ -74,7 +74,7 @@ func makeTestReq(testURL string, status int, config Config) (*http.Response, err
7474
}
7575

7676
func bodyAssert(t *testing.T, expected string, resp *http.Response) {
77-
body, err := ioutil.ReadAll(resp.Body)
77+
body, err := io.ReadAll(resp.Body)
7878
assert.Check(t, err)
7979
bodyString := string(body)
8080
assert.Check(t, is.Equal(expected, bodyString), "Expected 404 response body but got '%s' instead",

pkg/camo/proxy.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request) {
169169
resp, err := p.client.Do(nreq)
170170

171171
if resp != nil {
172-
defer resp.Body.Close()
172+
defer func() {
173+
if err:= resp.Body.Close(); err != nil {
174+
if mlog.HasDebug() {
175+
mlog.Debug("error on body close. ignoring.")
176+
}
177+
}
178+
}()
173179
}
174180

175181
if err != nil {

pkg/camo/proxy_timeout_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"bytes"
1010
"fmt"
1111
"io"
12-
"io/ioutil"
1312
"net"
1413
"net/http"
1514
"net/http/httptest"
@@ -242,7 +241,7 @@ func TestServerEarlyEOF(t *testing.T) {
242241
resp, err := processRequest(req, 200, c, nil)
243242
assert.Check(t, err)
244243

245-
body, err := ioutil.ReadAll(resp.Body)
244+
body, err := io.ReadAll(resp.Body)
246245
assert.Check(t, err)
247246
assert.Check(t, is.Len(body, 0))
248247
}

0 commit comments

Comments
 (0)