go.mod: github.com/emicklei/go-restful/v3 v3.10.2

https://github.com/emicklei/go-restful/compare/v3.10.1...v3.10.2

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2023-07-23 02:37:11 +09:00
parent 90e050298c
commit 0f033b6125
7 changed files with 36 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
# Change history of go-restful
## [v3.10.2] - 2023-03-09
- introduced MergePathStrategy to be able to revert behaviour of path concatenation to 3.9.0
see comment in Readme how to customize this behaviour.
## [v3.10.1] - 2022-11-19
- fix broken 3.10.0 by using path package for joining paths

View File

@@ -96,6 +96,10 @@ There are several hooks to customize the behavior of the go-restful package.
- Compression
- Encoders for other serializers
- Use [jsoniter](https://github.com/json-iterator/go) by building this package using a build tag, e.g. `go build -tags=jsoniter .`
- Use the variable `MergePathStrategy` to change the behaviour of composing the Route path given a root path and a local route path
- versions >= 3.10.1 has set the value to `PathJoinStrategy` that fixes a reported [security issue](https://github.com/advisories/GHSA-r48q-9g5r-8q2h) but may cause your services not to work correctly anymore.
- versions <= 3.9 had the behaviour that can be restored in newer versions by setting the value to `TrimSlashStrategy`.
- you can set value to a custom implementation (must implement MergePathStrategyFunc)
## Resources

View File

@@ -353,8 +353,28 @@ func (b *RouteBuilder) Build() Route {
return route
}
func concatPath(path1, path2 string) string {
return path.Join(path1, path2)
type MergePathStrategyFunc func(rootPath, routePath string) string
var (
// behavior >= 3.10
PathJoinStrategy = func(rootPath, routePath string) string {
return path.Join(rootPath, routePath)
}
// behavior <= 3.9
TrimSlashStrategy = func(rootPath, routePath string) string {
return strings.TrimRight(rootPath, "/") + "/" + strings.TrimLeft(routePath, "/")
}
// MergePathStrategy is the active strategy for merging a Route path when building the routing of all WebServices.
// The value is set to PathJoinStrategy
// PathJoinStrategy is a strategy that is more strict [Security - PRISMA-2022-0227]
MergePathStrategy = PathJoinStrategy
)
// merge two paths using the current (package global) merge path strategy.
func concatPath(rootPath, routePath string) string {
return MergePathStrategy(rootPath, routePath)
}
var anonymousFuncCount int32

2
vendor/modules.txt vendored
View File

@@ -206,7 +206,7 @@ github.com/docker/go-metrics
# github.com/docker/go-units v0.5.0
## explicit
github.com/docker/go-units
# github.com/emicklei/go-restful/v3 v3.10.1
# github.com/emicklei/go-restful/v3 v3.10.2
## explicit; go 1.13
github.com/emicklei/go-restful/v3
github.com/emicklei/go-restful/v3/log