From 0df8428af9775a2431f8e818bee4455cd4d25ced Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Wed, 3 Jun 2026 11:46:59 +0200 Subject: [PATCH 1/2] bump reva to fork for adjusting tests --- go.mod | 2 ++ go.sum | 4 +-- .../grpc/services/gateway/authprovider.go | 30 ++++++++----------- .../grpc/services/gateway/storageprovider.go | 25 ++++------------ .../http/services/owncloud/ocdav/tus.go | 4 ++- vendor/modules.txt | 3 +- 6 files changed, 27 insertions(+), 41 deletions(-) diff --git a/go.mod b/go.mod index 34903a702c..46e268c3f9 100644 --- a/go.mod +++ b/go.mod @@ -415,3 +415,5 @@ replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/opencloud- // to get the logger injection (https://github.com/pablodz/inotifywaitgo/pull/11) replace github.com/pablodz/inotifywaitgo v0.0.9 => github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 + +replace github.com/opencloud-eu/reva/v2 => github.com/michaelstingl/opencloud-eu-reva/v2 v2.46.1-0.20260601003852-377c02bde8b3 diff --git a/go.sum b/go.sum index eed7225948..ddb205fa47 100644 --- a/go.sum +++ b/go.sum @@ -831,6 +831,8 @@ github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 h1:Z/i1e+gTZrmcGeZy github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103/go.mod h1:o9YPB5aGP8ob35Vy6+vyq3P3bWe7NQWzf+JLiXCiMaE= github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= +github.com/michaelstingl/opencloud-eu-reva/v2 v2.46.1-0.20260601003852-377c02bde8b3 h1:bPa54sSKCVGVq0qa5Cvj5kavppfMIqboeWYzO9CtnGo= +github.com/michaelstingl/opencloud-eu-reva/v2 v2.46.1-0.20260601003852-377c02bde8b3/go.mod h1:fWAzVpZlJQEY/qeIrd9d3U+LpqY9JGsjJ2dc0a1jCEs= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.40/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.68 h1:jsSRkNozw7G/mnmXULynzMNIsgY2dHC8LO6U6Ij2JEA= @@ -952,8 +954,6 @@ github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 h1:dIft github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9/go.mod h1:JWyDC6H+5oZRdUJUgKuaye+8Ph5hEs6HVzVoPKzWSGI= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d h1:JcqGDiyrcaQwVyV861TUyQgO7uEmsjkhfm7aQd84dOw= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= -github.com/opencloud-eu/reva/v2 v2.46.2 h1:1MNSZj8e2DEMGrzORvTlyCrwYQPnCgtRuPQT+bzD4DM= -github.com/opencloud-eu/reva/v2 v2.46.2/go.mod h1:V1bwCQXM1pGmswtjdSJVIweA9Vv5EmtUZr/7Cm5086A= github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 h1:l2oB/RctH+t8r7QBj5p8thfEHCM/jF35aAY3WQ3hADI= github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/authprovider.go b/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/authprovider.go index afbbc897c9..379ca29e9e 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/authprovider.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/authprovider.go @@ -28,14 +28,12 @@ import ( userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" - "github.com/opencloud-eu/reva/v2/pkg/appctx" ctxpkg "github.com/opencloud-eu/reva/v2/pkg/ctx" "github.com/opencloud-eu/reva/v2/pkg/errtypes" "github.com/opencloud-eu/reva/v2/pkg/rgrpc/status" "github.com/opencloud-eu/reva/v2/pkg/rgrpc/todo/pool" "github.com/opencloud-eu/reva/v2/pkg/sharedconf" - "github.com/pkg/errors" "google.golang.org/grpc/metadata" "google.golang.org/protobuf/proto" @@ -125,22 +123,20 @@ func (s *svc) Authenticate(ctx context.Context, req *gateway.AuthenticateRequest ctx = metadata.AppendToOutgoingContext(ctx, ctxpkg.TokenHeader, token) // TODO(jfd): hardcoded metadata key. use PerRPCCredentials? // create home directory - if res.User.GetId().GetType() != userpb.UserType_USER_TYPE_SERVICE && res.User.GetId().GetType() != userpb.UserType_USER_TYPE_LIGHTWEIGHT { - createHomeRes, err := s.CreateHome(ctx, &storageprovider.CreateHomeRequest{}) - if err != nil { - log.Err(err).Msg("error calling CreateHome") - return &gateway.AuthenticateResponse{ - Status: status.NewInternal(ctx, "error creating user home"), - }, nil - } + createHomeRes, err := s.CreateHome(ctx, &storageprovider.CreateHomeRequest{}) + if err != nil { + log.Err(err).Msg("error calling CreateHome") + return &gateway.AuthenticateResponse{ + Status: status.NewInternal(ctx, "error creating user home"), + }, nil + } - if createHomeRes.Status.Code != rpc.Code_CODE_OK && createHomeRes.Status.Code != rpc.Code_CODE_ALREADY_EXISTS { - err := status.NewErrorFromCode(createHomeRes.Status.Code, "gateway") - log.Err(err).Msg("error calling Createhome") - return &gateway.AuthenticateResponse{ - Status: status.NewInternal(ctx, "error creating user home"), - }, nil - } + if createHomeRes.Status.Code != rpc.Code_CODE_OK && createHomeRes.Status.Code != rpc.Code_CODE_ALREADY_EXISTS { + err := status.NewErrorFromCode(createHomeRes.Status.Code, "gateway") + log.Err(err).Msg("error calling Createhome") + return &gateway.AuthenticateResponse{ + Status: status.NewInternal(ctx, "error creating user home"), + }, nil } gwRes := &gateway.AuthenticateResponse{ diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/storageprovider.go b/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/storageprovider.go index bd505e0f65..69bed97c6b 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/storageprovider.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/grpc/services/gateway/storageprovider.go @@ -28,17 +28,20 @@ import ( "strings" "time" + "github.com/BurntSushi/toml" 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" collaborationv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1" linkv1beta1 "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" registry "github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1" typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + "github.com/opencloud-eu/reva/v2/pkg/conversions" + "github.com/rs/zerolog/log" + "google.golang.org/grpc/codes" + "github.com/golang-jwt/jwt/v5" "github.com/opencloud-eu/reva/v2/pkg/appctx" - "github.com/opencloud-eu/reva/v2/pkg/conversions" ctxpkg "github.com/opencloud-eu/reva/v2/pkg/ctx" "github.com/opencloud-eu/reva/v2/pkg/errtypes" "github.com/opencloud-eu/reva/v2/pkg/publicshare" @@ -48,12 +51,7 @@ import ( "github.com/opencloud-eu/reva/v2/pkg/share" "github.com/opencloud-eu/reva/v2/pkg/storagespace" "github.com/opencloud-eu/reva/v2/pkg/utils" - - "github.com/BurntSushi/toml" - "github.com/golang-jwt/jwt/v5" "github.com/pkg/errors" - "github.com/rs/zerolog/log" - "google.golang.org/grpc/codes" gstatus "google.golang.org/grpc/status" ) @@ -116,19 +114,6 @@ func (s *svc) CreateHome(ctx context.Context, req *provider.CreateHomeRequest) ( }, nil } - - if u.GetId().GetType() == userpb.UserType_USER_TYPE_SERVICE { - return &provider.CreateHomeResponse{ - Status: status.NewInvalid(ctx, "gateway: refusing to create home for service user"), - }, nil - } - - if u.GetId().GetType() == userpb.UserType_USER_TYPE_LIGHTWEIGHT { - return &provider.CreateHomeResponse{ - Status: status.NewInvalid(ctx, "gateway: refusing to create home for lightweight user"), - }, nil - } - quotaStr := utils.ReadPlainFromOpaque(req.Opaque, "quota") var quota *provider.Quota if quotaStr != "" { diff --git a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/tus.go b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/tus.go index f88dc2192d..47cf26170c 100644 --- a/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/tus.go +++ b/vendor/github.com/opencloud-eu/reva/v2/internal/http/services/owncloud/ocdav/tus.go @@ -107,7 +107,9 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http. return } if err := ValidateName(filename(meta["filename"]), s.nameValidators); err != nil { - w.WriteHeader(http.StatusPreconditionFailed) + w.WriteHeader(http.StatusBadRequest) + b, err := errors.Marshal(http.StatusBadRequest, err.Error(), "", "") + errors.HandleWebdavError(&log, w, b, err) return } diff --git a/vendor/modules.txt b/vendor/modules.txt index e77e796141..aca44c5cea 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1363,7 +1363,7 @@ github.com/opencloud-eu/icap-client # github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20260310090739-853d972b282d ## explicit; go 1.18 github.com/opencloud-eu/libre-graph-api-go -# github.com/opencloud-eu/reva/v2 v2.46.2 +# github.com/opencloud-eu/reva/v2 v2.46.2 => github.com/michaelstingl/opencloud-eu-reva/v2 v2.46.1-0.20260601003852-377c02bde8b3 ## explicit; go 1.25.0 github.com/opencloud-eu/reva/v2/cmd/revad/internal/grace github.com/opencloud-eu/reva/v2/cmd/revad/runtime @@ -2737,3 +2737,4 @@ stash.kopano.io/kgol/rndm # github.com/unrolled/secure => github.com/opencloud-eu/secure v0.0.0-20260312082735-b6f5cb2244e4 # go-micro.dev/v4 => github.com/butonic/go-micro/v4 v4.11.1-0.20241115112658-b5d4de5ed9b3 # github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a +# github.com/opencloud-eu/reva/v2 => github.com/michaelstingl/opencloud-eu-reva/v2 v2.46.1-0.20260601003852-377c02bde8b3 From ef00acab2d37544af3261248279324482ea0dbfa Mon Sep 17 00:00:00 2001 From: Michael Stingl Date: Wed, 3 Jun 2026 14:37:16 +0200 Subject: [PATCH 2/2] test(coreApiWebdavUploadTUS): expect 400 for invalid TUS upload names opencloud-eu/reva#655 changes the TUS create response for an invalid name from 412 to 400. Update the invalid-name scenario to match. Each example now carries its own expected status in an column. Names that fail ValidateName expect 400. The three folder/file rows stay 412: filename() applies path.Base first, so "folder/file" becomes the valid leaf "file" and never reaches the changed branch. lowLevelCreationExtension.feature is unchanged; its missing-Upload-Length case still returns 412. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../coreApiWebdavUploadTUS/uploadFile.feature | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature index dfd9c02660..ede615dad1 100644 --- a/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature +++ b/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature @@ -154,28 +154,28 @@ Feature: upload file | Upload-Length | 100 | | Upload-Metadata | filename | | Tus-Resumable | 1.0.0 | - Then the HTTP status code should be "412" + Then the HTTP status code should be "" And the following headers should not be set | header | | Location | And as "Alice" file should not exist Examples: - | dav-path-version | file-name | metadata | - | old | " " | IA== | - | old | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | - | old | "folder/file" | Zm9sZGVyL2ZpbGU= | - | old | "my\\file" | bXkMaWxl | - | old | ".." | Li4= | - | new | " " | IA== | - | new | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | - | new | "folder/file" | Zm9sZGVyL2ZpbGU= | - | new | "my\\file" | bXkMaWxl | - | new | ".." | Li4= | - | spaces | " " | IA== | - | spaces | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | - | spaces | "folder/file" | Zm9sZGVyL2ZpbGU= | - | spaces | "my\\file" | bXkMaWxl | - | spaces | ".." | Li4= | + | dav-path-version | file-name | metadata | http-status-code | + | old | " " | IA== | 400 | + | old | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | 400 | + | old | "folder/file" | Zm9sZGVyL2ZpbGU= | 412 | + | old | "my\\file" | bXkMaWxl | 400 | + | old | ".." | Li4= | 400 | + | new | " " | IA== | 400 | + | new | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | 400 | + | new | "folder/file" | Zm9sZGVyL2ZpbGU= | 412 | + | new | "my\\file" | bXkMaWxl | 400 | + | new | ".." | Li4= | 400 | + | spaces | " " | IA== | 400 | + | spaces | "filewithLF-and-CR\r\n" | ZmlsZXdpdGhMRi1hbmQtQ1INCgo= | 400 | + | spaces | "folder/file" | Zm9sZGVyL2ZpbGU= | 412 | + | spaces | "my\\file" | bXkMaWxl | 400 | + | spaces | ".." | Li4= | 400 | @issue-10346 Scenario Outline: upload a zero-byte file