diff --git a/changelog/unreleased/fix-reva-log.md b/changelog/unreleased/fix-reva-log.md new file mode 100644 index 00000000000..b7e4e511d02 --- /dev/null +++ b/changelog/unreleased/fix-reva-log.md @@ -0,0 +1,7 @@ +Bugfix: Fix the reva log interceptor + +Fix the reva log interceptor. Implemented the Unwrap interface to allow TUS middleware to handle correctly +SetReadDeadline and SetWriteDeadline functions and to avoid the error during the upload. + +https://github.com/owncloud/ocis/pull/11348 +https://github.com/owncloud/ocis/issues/10857 diff --git a/go.mod b/go.mod index 82262bafefb..7bcb1b9f87c 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ require ( github.com/open-policy-agent/opa v1.4.2 github.com/orcaman/concurrent-map v1.0.0 github.com/owncloud/libre-graph-api-go v1.0.5-0.20250217093259-fa3804be6c27 - github.com/owncloud/reva/v2 v2.0.0-20250502110034-f92362f1143d + github.com/owncloud/reva/v2 v2.0.0-20250523085723-637bba95d4ee github.com/pkg/errors v0.9.1 github.com/pkg/xattr v0.4.10 github.com/prometheus/client_golang v1.21.1 diff --git a/go.sum b/go.sum index ef80a938383..e0cd7c7c6ae 100644 --- a/go.sum +++ b/go.sum @@ -886,8 +886,8 @@ github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CF github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA= github.com/owncloud/libre-graph-api-go v1.0.5-0.20250217093259-fa3804be6c27 h1:ID8s5lGBntmrlI6TbDAjTzRyHucn3bVM2wlW+HBplv4= github.com/owncloud/libre-graph-api-go v1.0.5-0.20250217093259-fa3804be6c27/go.mod h1:+gT+x62AS9u2Farh9wE2uYmgdvTg0MQgsSI62D+xoRg= -github.com/owncloud/reva/v2 v2.0.0-20250502110034-f92362f1143d h1:tOtuFzGDsOoVf8Y9KbU9aDQvGvlUKctSBYf+jPYTXXE= -github.com/owncloud/reva/v2 v2.0.0-20250502110034-f92362f1143d/go.mod h1:vynpm6URhGypkIv9EVC7C+MHu3LwsqaINkMCSUnyZ0o= +github.com/owncloud/reva/v2 v2.0.0-20250523085723-637bba95d4ee h1:8CH2loM7QjPYli1RxuHhM1unpKj+vgE38gMwqZMXde0= +github.com/owncloud/reva/v2 v2.0.0-20250523085723-637bba95d4ee/go.mod h1:IKut/lONAPK0aNGSnI05tOq752YSMrRa2Sr+MFPuknk= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pablodz/inotifywaitgo v0.0.7 h1:1ii49dGBnRn0t1Sz7RGZS6/NberPEDQprwKHN49Bv6U= diff --git a/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/auth/auth.go b/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/auth/auth.go index 40242e995c5..f7b494c684d 100644 --- a/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/auth/auth.go +++ b/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/auth/auth.go @@ -31,6 +31,7 @@ import ( gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" + "github.com/mitchellh/mapstructure" "github.com/owncloud/reva/v2/internal/http/interceptors/auth/credential/registry" tokenregistry "github.com/owncloud/reva/v2/internal/http/interceptors/auth/token/registry" tokenwriterregistry "github.com/owncloud/reva/v2/internal/http/interceptors/auth/tokenwriter/registry" @@ -46,7 +47,6 @@ import ( "github.com/owncloud/reva/v2/pkg/token" tokenmgr "github.com/owncloud/reva/v2/pkg/token/manager/registry" "github.com/owncloud/reva/v2/pkg/utils" - "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "github.com/rs/zerolog" semconv "go.opentelemetry.io/otel/semconv/v1.20.0" @@ -186,13 +186,11 @@ func New(m map[string]interface{}, unprotected []string, tp trace.TracerProvider return } - log := appctx.GetLogger(r.Context()) isUnprotectedEndpoint := false // For unprotected URLs, we try to authenticate the request in case some service needs it, // but don't return any errors if it fails. if utils.Skip(r.URL.Path, unprotected) { - log.Info().Msg("skipping auth check for: " + r.URL.Path) isUnprotectedEndpoint = true } @@ -245,7 +243,11 @@ func authenticateUser(w http.ResponseWriter, r *http.Request, conf *config, toke } } - log.Warn().Msg("core access token not set") + if isUnprotectedEndpoint { + log.Info().Msgf("skipping auth check for: %s", r.URL.Path) + } else { + log.Warn().Msgf("core access token not set for URL %s", r.URL.Path) + } userAgentCredKeys := getCredsForUserAgent(r.UserAgent(), conf.CredentialsByUserAgent, conf.CredentialChain) diff --git a/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/log/log.go b/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/log/log.go index c7296a74b82..314bed30a39 100644 --- a/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/log/log.go +++ b/vendor/github.com/owncloud/reva/v2/internal/http/interceptors/log/log.go @@ -130,6 +130,7 @@ type commonLoggingResponseWriter interface { http.Flusher Status() int Size() int + Unwrap() http.ResponseWriter } // responseLogger is wrapper of http.ResponseWriter that keeps track of its HTTP @@ -170,6 +171,11 @@ func (l *responseLogger) Flush() { } } +// Unwrap returns the underlying wrapped http.ResponseWriter. +func (l responseLogger) Unwrap() http.ResponseWriter { + return l.w +} + type hijackLogger struct { responseLogger } @@ -183,6 +189,11 @@ func (l *hijackLogger) Hijack() (net.Conn, *bufio.ReadWriter, error) { return conn, rw, err } +// Unwrap returns the underlying wrapped http.ResponseWriter. +func (l hijackLogger) Unwrap() http.ResponseWriter { + return l.w +} + type closeNotifyWriter struct { loggingResponseWriter http.CloseNotifier @@ -193,3 +204,8 @@ type hijackCloseNotifier struct { http.Hijacker http.CloseNotifier } + +// Unwrap returns the underlying wrapped http.ResponseWriter. +func (l hijackCloseNotifier) Unwrap() http.ResponseWriter { + return l.loggingResponseWriter +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 684eabdc75a..556a4213df2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1235,7 +1235,7 @@ github.com/orcaman/concurrent-map # github.com/owncloud/libre-graph-api-go v1.0.5-0.20250217093259-fa3804be6c27 ## explicit; go 1.18 github.com/owncloud/libre-graph-api-go -# github.com/owncloud/reva/v2 v2.0.0-20250502110034-f92362f1143d +# github.com/owncloud/reva/v2 v2.0.0-20250523085723-637bba95d4ee ## explicit; go 1.24 github.com/owncloud/reva/v2/cmd/revad/internal/grace github.com/owncloud/reva/v2/cmd/revad/runtime