Skip to content

Commit b0ae63f

Browse files
authored
Merge branch 'labstack:master' into pm/proxyheaders
2 parents 513ada9 + ee3e129 commit b0ae63f

Some content is hidden

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

90 files changed

+2849
-2748
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
### Issue Description
22

3-
### Checklist
3+
### Working code to debug
44

5-
- [ ] Dependencies installed
6-
- [ ] No typos
7-
- [ ] Searched existing issues and docs
5+
```go
6+
package main
87

9-
### Expected behaviour
8+
import (
9+
"github.com/labstack/echo/v4"
10+
"net/http"
11+
"net/http/httptest"
12+
"testing"
13+
)
1014

11-
### Actual behaviour
15+
func TestExample(t *testing.T) {
16+
e := echo.New()
1217

13-
### Steps to reproduce
18+
e.GET("/", func(c echo.Context) error {
19+
return c.String(http.StatusOK, "Hello, World!")
20+
})
1421

15-
### Working code to debug
22+
req := httptest.NewRequest(http.MethodGet, "/", nil)
23+
rec := httptest.NewRecorder()
1624

17-
```go
18-
package main
25+
e.ServeHTTP(rec, req)
1926

20-
func main() {
27+
if rec.Code != http.StatusOK {
28+
t.Errorf("got %d, want %d", rec.Code, http.StatusOK)
29+
}
2130
}
2231
```
2332

.github/workflows/checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ permissions:
1414

1515
env:
1616
# run static analysis only with the latest Go version
17-
LATEST_GO_VERSION: "1.21"
17+
LATEST_GO_VERSION: "1.23"
1818

1919
jobs:
2020
check:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout Code
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525

2626
- name: Set up Go ${{ matrix.go }}
27-
uses: actions/setup-go@v4
27+
uses: actions/setup-go@v5
2828
with:
2929
go-version: ${{ env.LATEST_GO_VERSION }}
3030
check-latest: true

.github/workflows/echo.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
env:
1616
# run coverage and benchmarks only with the latest Go version
17-
LATEST_GO_VERSION: "1.21"
17+
LATEST_GO_VERSION: "1.23"
1818

1919
jobs:
2020
test:
@@ -25,15 +25,15 @@ jobs:
2525
# Echo tests with last four major releases (unless there are pressing vulnerabilities)
2626
# As we depend on `golang.org/x/` libraries which only support last 2 Go releases we could have situations when
2727
# we derive from last four major releases promise.
28-
go: ["1.18", "1.19", "1.20", "1.21"]
28+
go: ["1.20", "1.21", "1.22", "1.23"]
2929
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
3030
runs-on: ${{ matrix.os }}
3131
steps:
3232
- name: Checkout Code
33-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3434

3535
- name: Set up Go ${{ matrix.go }}
36-
uses: actions/setup-go@v4
36+
uses: actions/setup-go@v5
3737
with:
3838
go-version: ${{ matrix.go }}
3939

@@ -53,18 +53,18 @@ jobs:
5353
runs-on: ubuntu-latest
5454
steps:
5555
- name: Checkout Code (Previous)
56-
uses: actions/checkout@v3
56+
uses: actions/checkout@v4
5757
with:
5858
ref: ${{ github.base_ref }}
5959
path: previous
6060

6161
- name: Checkout Code (New)
62-
uses: actions/checkout@v3
62+
uses: actions/checkout@v4
6363
with:
6464
path: new
6565

6666
- name: Set up Go ${{ matrix.go }}
67-
uses: actions/setup-go@v4
67+
uses: actions/setup-go@v5
6868
with:
6969
go-version: ${{ env.LATEST_GO_VERSION }}
7070

CHANGELOG.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,90 @@
11
# Changelog
22

3+
## v4.13.3 - 2024-12-19
4+
5+
**Security**
6+
7+
* Update golang.org/x/net dependency [GO-2024-3333](https://pkg.go.dev/vuln/GO-2024-3333) in https://github.com/labstack/echo/pull/2722
8+
9+
10+
## v4.13.2 - 2024-12-12
11+
12+
**Security**
13+
14+
* Update dependencies (dependabot reports [GO-2024-3321](https://pkg.go.dev/vuln/GO-2024-3321)) in https://github.com/labstack/echo/pull/2721
15+
16+
17+
## v4.13.1 - 2024-12-11
18+
19+
**Fixes**
20+
21+
* Fix BindBody ignoring `Transfer-Encoding: chunked` requests by @178inaba in https://github.com/labstack/echo/pull/2717
22+
23+
24+
25+
## v4.13.0 - 2024-12-04
26+
27+
**BREAKING CHANGE** JWT Middleware Removed from Core use [labstack/echo-jwt](https://github.com/labstack/echo-jwt) instead
28+
29+
The JWT middleware has been **removed from Echo core** due to another security vulnerability, [CVE-2024-51744](https://nvd.nist.gov/vuln/detail/CVE-2024-51744). For more details, refer to issue [#2699](https://github.com/labstack/echo/issues/2699). A drop-in replacement is available in the [labstack/echo-jwt](https://github.com/labstack/echo-jwt) repository.
30+
31+
**Important**: Direct assignments like `token := c.Get("user").(*jwt.Token)` will now cause a panic due to an invalid cast. Update your code accordingly. Replace the current imports from `"github.com/golang-jwt/jwt"` in your handlers to the new middleware version using `"github.com/golang-jwt/jwt/v5"`.
32+
33+
34+
Background:
35+
36+
The version of `golang-jwt/jwt` (v3.2.2) previously used in Echo core has been in an unmaintained state for some time. This is not the first vulnerability affecting this library; earlier issues were addressed in [PR #1946](https://github.com/labstack/echo/pull/1946).
37+
JWT middleware was marked as deprecated in Echo core as of [v4.10.0](https://github.com/labstack/echo/releases/tag/v4.10.0) on 2022-12-27. If you did not notice that, consider leveraging tools like [Staticcheck](https://staticcheck.dev/) to catch such deprecations earlier in you dev/CI flow. For bonus points - check out [gosec](https://github.com/securego/gosec).
38+
39+
We sincerely apologize for any inconvenience caused by this change. While we strive to maintain backward compatibility within Echo core, recurring security issues with third-party dependencies have forced this decision.
40+
41+
**Enhancements**
42+
43+
* remove jwt middleware by @stevenwhitehead in https://github.com/labstack/echo/pull/2701
44+
* optimization: struct alignment by @behnambm in https://github.com/labstack/echo/pull/2636
45+
* bind: Maintain backwards compatibility for map[string]interface{} binding by @thesaltree in https://github.com/labstack/echo/pull/2656
46+
* Add Go 1.23 to CI by @aldas in https://github.com/labstack/echo/pull/2675
47+
* improve `MultipartForm` test by @martinyonatann in https://github.com/labstack/echo/pull/2682
48+
* `bind` : add support of multipart multi files by @martinyonatann in https://github.com/labstack/echo/pull/2684
49+
* Add TemplateRenderer struct to ease creating renderers for `html/template` and `text/template` packages. by @aldas in https://github.com/labstack/echo/pull/2690
50+
* Refactor TestBasicAuth to utilize table-driven test format by @ErikOlson in https://github.com/labstack/echo/pull/2688
51+
* Remove broken header by @aldas in https://github.com/labstack/echo/pull/2705
52+
* fix(bind body): content-length can be -1 by @phamvinhdat in https://github.com/labstack/echo/pull/2710
53+
* CORS middleware should compile allowOrigin regexp at creation by @aldas in https://github.com/labstack/echo/pull/2709
54+
* Shorten Github issue template and add test example by @aldas in https://github.com/labstack/echo/pull/2711
55+
56+
57+
## v4.12.0 - 2024-04-15
58+
59+
**Security**
60+
61+
* Update golang.org/x/net dep because of [GO-2024-2687](https://pkg.go.dev/vuln/GO-2024-2687) by @aldas in https://github.com/labstack/echo/pull/2625
62+
63+
64+
**Enhancements**
65+
66+
* binder: make binding to Map work better with string destinations by @aldas in https://github.com/labstack/echo/pull/2554
67+
* README.md: add Encore as sponsor by @marcuskohlberg in https://github.com/labstack/echo/pull/2579
68+
* Reorder paragraphs in README.md by @aldas in https://github.com/labstack/echo/pull/2581
69+
* CI: upgrade actions/checkout to v4 by @aldas in https://github.com/labstack/echo/pull/2584
70+
* Remove default charset from 'application/json' Content-Type header by @doortts in https://github.com/labstack/echo/pull/2568
71+
* CI: Use Go 1.22 by @aldas in https://github.com/labstack/echo/pull/2588
72+
* binder: allow binding to a nil map by @georgmu in https://github.com/labstack/echo/pull/2574
73+
* Add Skipper Unit Test In BasicBasicAuthConfig and Add More Detail Explanation regarding BasicAuthValidator by @RyoKusnadi in https://github.com/labstack/echo/pull/2461
74+
* fix some typos by @teslaedison in https://github.com/labstack/echo/pull/2603
75+
* fix: some typos by @pomadev in https://github.com/labstack/echo/pull/2596
76+
* Allow ResponseWriters to unwrap writers when flushing/hijacking by @aldas in https://github.com/labstack/echo/pull/2595
77+
* Add SPDX licence comments to files. by @aldas in https://github.com/labstack/echo/pull/2604
78+
* Upgrade deps by @aldas in https://github.com/labstack/echo/pull/2605
79+
* Change type definition blocks to single declarations. This helps copy… by @aldas in https://github.com/labstack/echo/pull/2606
80+
* Fix Real IP logic by @cl-bvl in https://github.com/labstack/echo/pull/2550
81+
* Default binder can use `UnmarshalParams(params []string) error` inter… by @aldas in https://github.com/labstack/echo/pull/2607
82+
* Default binder can bind pointer to slice as struct field. For example `*[]string` by @aldas in https://github.com/labstack/echo/pull/2608
83+
* Remove maxparam dependence from Context by @aldas in https://github.com/labstack/echo/pull/2611
84+
* When route is registered with empty path it is normalized to `/`. by @aldas in https://github.com/labstack/echo/pull/2616
85+
* proxy middleware should use httputil.ReverseProxy for SSE requests by @aldas in https://github.com/labstack/echo/pull/2624
86+
87+
388
## v4.11.4 - 2023-12-20
489

590
**Security**

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ benchmark: ## Run benchmarks
3131
help: ## Display this help screen
3232
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
3333

34-
goversion ?= "1.17"
35-
test_version: ## Run tests inside Docker with given version (defaults to 1.17 oldest supported). Example: make test_version goversion=1.17
34+
goversion ?= "1.20"
35+
test_version: ## Run tests inside Docker with given version (defaults to 1.20 oldest supported). Example: make test_version goversion=1.20
3636
@docker run --rm -it -v $(shell pwd):/project golang:$(goversion) /bin/sh -c "cd /project && make init check"

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<a href="https://echo.labstack.com"><img height="80" src="https://cdn.labstack.com/images/echo-logo.svg"></a>
2-
31
[![Sourcegraph](https://sourcegraph.com/github.com/labstack/echo/-/badge.svg?style=flat-square)](https://sourcegraph.com/github.com/labstack/echo?badge)
42
[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/labstack/echo/v4)
53
[![Go Report Card](https://goreportcard.com/badge/github.com/labstack/echo?style=flat-square)](https://goreportcard.com/report/github.com/labstack/echo)
@@ -9,20 +7,18 @@
97
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/labstack)
108
[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/labstack/echo/master/LICENSE)
119

12-
## Supported Go versions
10+
## Echo
1311

14-
Latest version of Echo supports last four Go major [releases](https://go.dev/doc/devel/release) and might work with
15-
older versions.
12+
High performance, extensible, minimalist Go web framework.
1613

17-
As of version 4.0.0, Echo is available as a [Go module](https://github.com/golang/go/wiki/Modules).
18-
Therefore a Go version capable of understanding /vN suffixed imports is required:
14+
* [Official website](https://echo.labstack.com)
15+
* [Quick start](https://echo.labstack.com/docs/quick-start)
16+
* [Middlewares](https://echo.labstack.com/docs/category/middleware)
1917

20-
Any of these versions will allow you to import Echo as `github.com/labstack/echo/v4` which is the recommended
21-
way of using Echo going forward.
18+
Help and questions: [Github Discussions](https://github.com/labstack/echo/discussions)
2219

23-
For older versions, please use the latest v3 tag.
2420

25-
## Feature Overview
21+
### Feature Overview
2622

2723
- Optimized HTTP router which smartly prioritize routes
2824
- Build robust and scalable RESTful APIs
@@ -38,6 +34,18 @@ For older versions, please use the latest v3 tag.
3834
- Automatic TLS via Let’s Encrypt
3935
- HTTP/2 support
4036

37+
## Sponsors
38+
39+
<div>
40+
<a href="https://encore.dev" style="display: inline-flex; align-items: center; gap: 10px">
41+
<img src="https://user-images.githubusercontent.com/78424526/214602214-52e0483a-b5fc-4d4c-b03e-0b7b23e012df.svg" height="28px" alt="encore icon"></img>
42+
<b>Encore – the platform for building Go-based cloud backends</b>
43+
</a>
44+
</div>
45+
<br/>
46+
47+
Click [here](https://github.com/sponsors/labstack) for more information on sponsorship.
48+
4149
## Benchmarks
4250

4351
Date: 2020/11/11<br>
@@ -57,6 +65,7 @@ The benchmarks above were run on an Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
5765
// go get github.com/labstack/echo/{version}
5866
go get github.com/labstack/echo/v4
5967
```
68+
Latest version of Echo supports last four Go major [releases](https://go.dev/doc/devel/release) and might work with older versions.
6069

6170
### Example
6271

@@ -66,6 +75,7 @@ package main
6675
import (
6776
"github.com/labstack/echo/v4"
6877
"github.com/labstack/echo/v4/middleware"
78+
"log/slog"
6979
"net/http"
7080
)
7181

@@ -81,7 +91,9 @@ func main() {
8191
e.GET("/", hello)
8292

8393
// Start server
84-
e.Logger.Fatal(e.Start(":1323"))
94+
if err := e.Start(":8080"); err != nil && !errors.Is(err, http.ErrServerClosed) {
95+
slog.Error("failed to start server", "error", err)
96+
}
8597
}
8698

8799
// Handler
@@ -117,10 +129,6 @@ of middlewares in this list.
117129

118130
Please send a PR to add your own library here.
119131

120-
## Help
121-
122-
- [Forum](https://github.com/labstack/echo/discussions)
123-
124132
## Contribute
125133

126134
**Use issues for everything**

0 commit comments

Comments
 (0)