mirror of
https://github.com/datarhei/core.git
synced 2025-10-07 00:43:39 +08:00
Update dependencies
This update includes a newer version of the RTMP server that supports the enhances RTMP specification, i.e. HEVC, VP9, and AV1.
This commit is contained in:
41
vendor/github.com/labstack/echo/v4/CHANGELOG.md
generated
vendored
41
vendor/github.com/labstack/echo/v4/CHANGELOG.md
generated
vendored
@@ -1,5 +1,46 @@
|
||||
# Changelog
|
||||
|
||||
## v4.11.4 - 2023-12-20
|
||||
|
||||
**Security**
|
||||
|
||||
* Upgrade golang.org/x/crypto to v0.17.0 to fix vulnerability [issue](https://pkg.go.dev/vuln/GO-2023-2402) [#2562](https://github.com/labstack/echo/pull/2562)
|
||||
|
||||
**Enhancements**
|
||||
|
||||
* Update deps and mark Go version to 1.18 as this is what golang.org/x/* use [#2563](https://github.com/labstack/echo/pull/2563)
|
||||
* Request logger: add example for Slog https://pkg.go.dev/log/slog [#2543](https://github.com/labstack/echo/pull/2543)
|
||||
|
||||
|
||||
## v4.11.3 - 2023-11-07
|
||||
|
||||
**Security**
|
||||
|
||||
* 'c.Attachment' and 'c.Inline' should escape filename in 'Content-Disposition' header to avoid 'Reflect File Download' vulnerability. [#2541](https://github.com/labstack/echo/pull/2541)
|
||||
|
||||
**Enhancements**
|
||||
|
||||
* Tests: refactor context tests to be separate functions [#2540](https://github.com/labstack/echo/pull/2540)
|
||||
* Proxy middleware: reuse echo request context [#2537](https://github.com/labstack/echo/pull/2537)
|
||||
* Mark unmarshallable yaml struct tags as ignored [#2536](https://github.com/labstack/echo/pull/2536)
|
||||
|
||||
|
||||
## v4.11.2 - 2023-10-11
|
||||
|
||||
**Security**
|
||||
|
||||
* Bump golang.org/x/net to prevent CVE-2023-39325 / CVE-2023-44487 HTTP/2 Rapid Reset Attack [#2527](https://github.com/labstack/echo/pull/2527)
|
||||
* fix(sec): randomString bias introduced by #2490 [#2492](https://github.com/labstack/echo/pull/2492)
|
||||
* CSRF/RequestID mw: switch math/random usage to crypto/random [#2490](https://github.com/labstack/echo/pull/2490)
|
||||
|
||||
**Enhancements**
|
||||
|
||||
* Delete unused context in body_limit.go [#2483](https://github.com/labstack/echo/pull/2483)
|
||||
* Use Go 1.21 in CI [#2505](https://github.com/labstack/echo/pull/2505)
|
||||
* Fix some typos [#2511](https://github.com/labstack/echo/pull/2511)
|
||||
* Allow CORS middleware to send Access-Control-Max-Age: 0 [#2518](https://github.com/labstack/echo/pull/2518)
|
||||
* Bump dependancies [#2522](https://github.com/labstack/echo/pull/2522)
|
||||
|
||||
## v4.11.1 - 2023-07-16
|
||||
|
||||
**Fixes**
|
||||
|
2
vendor/github.com/labstack/echo/v4/README.md
generated
vendored
2
vendor/github.com/labstack/echo/v4/README.md
generated
vendored
@@ -3,7 +3,7 @@
|
||||
[](https://sourcegraph.com/github.com/labstack/echo?badge)
|
||||
[](https://pkg.go.dev/github.com/labstack/echo/v4)
|
||||
[](https://goreportcard.com/report/github.com/labstack/echo)
|
||||
[](https://travis-ci.org/labstack/echo)
|
||||
[](https://github.com/labstack/echo/actions)
|
||||
[](https://codecov.io/gh/labstack/echo)
|
||||
[](https://github.com/labstack/echo/discussions)
|
||||
[](https://twitter.com/labstack)
|
||||
|
2
vendor/github.com/labstack/echo/v4/binder.go
generated
vendored
2
vendor/github.com/labstack/echo/v4/binder.go
generated
vendored
@@ -1323,7 +1323,7 @@ func (b *ValueBinder) unixTime(sourceParam string, dest *time.Time, valueMustExi
|
||||
case time.Second:
|
||||
*dest = time.Unix(n, 0)
|
||||
case time.Millisecond:
|
||||
*dest = time.Unix(n/1e3, (n%1e3)*1e6) // TODO: time.UnixMilli(n) exists since Go1.17 switch to that when min version allows
|
||||
*dest = time.UnixMilli(n)
|
||||
case time.Nanosecond:
|
||||
*dest = time.Unix(0, n)
|
||||
}
|
||||
|
4
vendor/github.com/labstack/echo/v4/context.go
generated
vendored
4
vendor/github.com/labstack/echo/v4/context.go
generated
vendored
@@ -584,8 +584,10 @@ func (c *context) Inline(file, name string) error {
|
||||
return c.contentDisposition(file, name, "inline")
|
||||
}
|
||||
|
||||
var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
|
||||
|
||||
func (c *context) contentDisposition(file, name, dispositionType string) error {
|
||||
c.response.Header().Set(HeaderContentDisposition, fmt.Sprintf("%s; filename=%q", dispositionType, name))
|
||||
c.response.Header().Set(HeaderContentDisposition, fmt.Sprintf(`%s; filename="%s"`, dispositionType, quoteEscaper.Replace(name)))
|
||||
return c.File(file)
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/labstack/echo/v4/echo.go
generated
vendored
2
vendor/github.com/labstack/echo/v4/echo.go
generated
vendored
@@ -259,7 +259,7 @@ const (
|
||||
|
||||
const (
|
||||
// Version of Echo
|
||||
Version = "4.11.1"
|
||||
Version = "4.11.4"
|
||||
website = "https://echo.labstack.com"
|
||||
// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo
|
||||
banner = `
|
||||
|
10
vendor/github.com/labstack/echo/v4/middleware/body_limit.go
generated
vendored
10
vendor/github.com/labstack/echo/v4/middleware/body_limit.go
generated
vendored
@@ -23,9 +23,8 @@ type (
|
||||
|
||||
limitedReader struct {
|
||||
BodyLimitConfig
|
||||
reader io.ReadCloser
|
||||
read int64
|
||||
context echo.Context
|
||||
reader io.ReadCloser
|
||||
read int64
|
||||
}
|
||||
)
|
||||
|
||||
@@ -80,7 +79,7 @@ func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc {
|
||||
|
||||
// Based on content read
|
||||
r := pool.Get().(*limitedReader)
|
||||
r.Reset(req.Body, c)
|
||||
r.Reset(req.Body)
|
||||
defer pool.Put(r)
|
||||
req.Body = r
|
||||
|
||||
@@ -102,9 +101,8 @@ func (r *limitedReader) Close() error {
|
||||
return r.reader.Close()
|
||||
}
|
||||
|
||||
func (r *limitedReader) Reset(reader io.ReadCloser, context echo.Context) {
|
||||
func (r *limitedReader) Reset(reader io.ReadCloser) {
|
||||
r.reader = reader
|
||||
r.context = context
|
||||
r.read = 0
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/labstack/echo/v4/middleware/context_timeout.go
generated
vendored
2
vendor/github.com/labstack/echo/v4/middleware/context_timeout.go
generated
vendored
@@ -13,7 +13,7 @@ type ContextTimeoutConfig struct {
|
||||
// Skipper defines a function to skip middleware.
|
||||
Skipper Skipper
|
||||
|
||||
// ErrorHandler is a function when error aries in middeware execution.
|
||||
// ErrorHandler is a function when error aries in middleware execution.
|
||||
ErrorHandler func(err error, c echo.Context) error
|
||||
|
||||
// Timeout configures a timeout for the middleware, defaults to 0 for no timeout
|
||||
|
13
vendor/github.com/labstack/echo/v4/middleware/cors.go
generated
vendored
13
vendor/github.com/labstack/echo/v4/middleware/cors.go
generated
vendored
@@ -39,7 +39,7 @@ type (
|
||||
// See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
|
||||
//
|
||||
// Optional.
|
||||
AllowOriginFunc func(origin string) (bool, error) `yaml:"allow_origin_func"`
|
||||
AllowOriginFunc func(origin string) (bool, error) `yaml:"-"`
|
||||
|
||||
// AllowMethods determines the value of the Access-Control-Allow-Methods
|
||||
// response header. This header specified the list of methods allowed when
|
||||
@@ -99,8 +99,9 @@ type (
|
||||
// MaxAge determines the value of the Access-Control-Max-Age response header.
|
||||
// This header indicates how long (in seconds) the results of a preflight
|
||||
// request can be cached.
|
||||
// The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response.
|
||||
//
|
||||
// Optional. Default value 0. The header is set only if MaxAge > 0.
|
||||
// Optional. Default value 0 - meaning header is not sent.
|
||||
//
|
||||
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
|
||||
MaxAge int `yaml:"max_age"`
|
||||
@@ -159,7 +160,11 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
|
||||
allowMethods := strings.Join(config.AllowMethods, ",")
|
||||
allowHeaders := strings.Join(config.AllowHeaders, ",")
|
||||
exposeHeaders := strings.Join(config.ExposeHeaders, ",")
|
||||
maxAge := strconv.Itoa(config.MaxAge)
|
||||
|
||||
maxAge := "0"
|
||||
if config.MaxAge > 0 {
|
||||
maxAge = strconv.Itoa(config.MaxAge)
|
||||
}
|
||||
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
@@ -282,7 +287,7 @@ func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc {
|
||||
res.Header().Set(echo.HeaderAccessControlAllowHeaders, h)
|
||||
}
|
||||
}
|
||||
if config.MaxAge > 0 {
|
||||
if config.MaxAge != 0 {
|
||||
res.Header().Set(echo.HeaderAccessControlMaxAge, maxAge)
|
||||
}
|
||||
return c.NoContent(http.StatusNoContent)
|
||||
|
4
vendor/github.com/labstack/echo/v4/middleware/csrf.go
generated
vendored
4
vendor/github.com/labstack/echo/v4/middleware/csrf.go
generated
vendored
@@ -6,7 +6,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/gommon/random"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -103,6 +102,7 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
|
||||
if config.TokenLength == 0 {
|
||||
config.TokenLength = DefaultCSRFConfig.TokenLength
|
||||
}
|
||||
|
||||
if config.TokenLookup == "" {
|
||||
config.TokenLookup = DefaultCSRFConfig.TokenLookup
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
|
||||
|
||||
token := ""
|
||||
if k, err := c.Cookie(config.CookieName); err != nil {
|
||||
token = random.String(config.TokenLength) // Generate token
|
||||
token = randomString(config.TokenLength)
|
||||
} else {
|
||||
token = k.Value // Reuse token
|
||||
}
|
||||
|
4
vendor/github.com/labstack/echo/v4/middleware/proxy.go
generated
vendored
4
vendor/github.com/labstack/echo/v4/middleware/proxy.go
generated
vendored
@@ -359,6 +359,10 @@ func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc {
|
||||
c.Set("_error", nil)
|
||||
}
|
||||
|
||||
// This is needed for ProxyConfig.ModifyResponse and/or ProxyConfig.Transport to be able to process the Request
|
||||
// that Balancer may have replaced with c.SetRequest.
|
||||
req = c.Request()
|
||||
|
||||
// Proxy
|
||||
switch {
|
||||
case c.IsWebSocket():
|
||||
|
5
vendor/github.com/labstack/echo/v4/middleware/request_id.go
generated
vendored
5
vendor/github.com/labstack/echo/v4/middleware/request_id.go
generated
vendored
@@ -2,7 +2,6 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/gommon/random"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -12,7 +11,7 @@ type (
|
||||
Skipper Skipper
|
||||
|
||||
// Generator defines a function to generate an ID.
|
||||
// Optional. Default value random.String(32).
|
||||
// Optional. Defaults to generator for random string of length 32.
|
||||
Generator func() string
|
||||
|
||||
// RequestIDHandler defines a function which is executed for a request id.
|
||||
@@ -73,5 +72,5 @@ func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc {
|
||||
}
|
||||
|
||||
func generator() string {
|
||||
return random.String(32)
|
||||
return randomString(32)
|
||||
}
|
||||
|
24
vendor/github.com/labstack/echo/v4/middleware/request_logger.go
generated
vendored
24
vendor/github.com/labstack/echo/v4/middleware/request_logger.go
generated
vendored
@@ -8,6 +8,30 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// Example for `slog` https://pkg.go.dev/log/slog
|
||||
// logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
// e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
||||
// LogStatus: true,
|
||||
// LogURI: true,
|
||||
// LogError: true,
|
||||
// HandleError: true, // forwards error to the global error handler, so it can decide appropriate status code
|
||||
// LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
|
||||
// if v.Error == nil {
|
||||
// logger.LogAttrs(context.Background(), slog.LevelInfo, "REQUEST",
|
||||
// slog.String("uri", v.URI),
|
||||
// slog.Int("status", v.Status),
|
||||
// )
|
||||
// } else {
|
||||
// logger.LogAttrs(context.Background(), slog.LevelError, "REQUEST_ERROR",
|
||||
// slog.String("uri", v.URI),
|
||||
// slog.Int("status", v.Status),
|
||||
// slog.String("err", v.Error.Error()),
|
||||
// )
|
||||
// }
|
||||
// return nil
|
||||
// },
|
||||
// }))
|
||||
//
|
||||
// Example for `fmt.Printf`
|
||||
// e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
||||
// LogStatus: true,
|
||||
|
2
vendor/github.com/labstack/echo/v4/middleware/rewrite.go
generated
vendored
2
vendor/github.com/labstack/echo/v4/middleware/rewrite.go
generated
vendored
@@ -27,7 +27,7 @@ type (
|
||||
// Example:
|
||||
// "^/old/[0.9]+/": "/new",
|
||||
// "^/api/.+?/(.*)": "/v2/$1",
|
||||
RegexRules map[*regexp.Regexp]string `yaml:"regex_rules"`
|
||||
RegexRules map[*regexp.Regexp]string `yaml:"-"`
|
||||
}
|
||||
)
|
||||
|
||||
|
46
vendor/github.com/labstack/echo/v4/middleware/util.go
generated
vendored
46
vendor/github.com/labstack/echo/v4/middleware/util.go
generated
vendored
@@ -1,7 +1,11 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"crypto/rand"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func matchScheme(domain, pattern string) bool {
|
||||
@@ -52,3 +56,45 @@ func matchSubdomain(domain, pattern string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// https://tip.golang.org/doc/go1.19#:~:text=Read%20no%20longer%20buffers%20random%20data%20obtained%20from%20the%20operating%20system%20between%20calls
|
||||
var randomReaderPool = sync.Pool{New: func() interface{} {
|
||||
return bufio.NewReader(rand.Reader)
|
||||
}}
|
||||
|
||||
const randomStringCharset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
const randomStringCharsetLen = 52 // len(randomStringCharset)
|
||||
const randomStringMaxByte = 255 - (256 % randomStringCharsetLen)
|
||||
|
||||
func randomString(length uint8) string {
|
||||
reader := randomReaderPool.Get().(*bufio.Reader)
|
||||
defer randomReaderPool.Put(reader)
|
||||
|
||||
b := make([]byte, length)
|
||||
r := make([]byte, length+(length/4)) // perf: avoid read from rand.Reader many times
|
||||
var i uint8 = 0
|
||||
|
||||
// security note:
|
||||
// we can't just simply do b[i]=randomStringCharset[rb%len(randomStringCharset)],
|
||||
// len(len(randomStringCharset)) is 52, and rb is [0, 255], 256 = 52 * 4 + 48.
|
||||
// make the first 48 characters more possibly to be generated then others.
|
||||
// So we have to skip bytes when rb > randomStringMaxByte
|
||||
|
||||
for {
|
||||
_, err := io.ReadFull(reader, r)
|
||||
if err != nil {
|
||||
panic("unexpected error happened when reading from bufio.NewReader(crypto/rand.Reader)")
|
||||
}
|
||||
for _, rb := range r {
|
||||
if rb > randomStringMaxByte {
|
||||
// Skip this number to avoid bias.
|
||||
continue
|
||||
}
|
||||
b[i] = randomStringCharset[rb%randomStringCharsetLen]
|
||||
i++
|
||||
if i == length {
|
||||
return string(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user