mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-08 05:09:46 -06:00
test infinity changes
Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
2
go.mod
2
go.mod
@@ -340,3 +340,5 @@ require (
|
||||
replace github.com/cs3org/go-cs3apis => github.com/2403905/go-cs3apis v0.0.0-20230517122726-727045414fd1
|
||||
|
||||
// replace github.com/cs3org/reva/v2 => github.com/micbar/reva/v2 v2.0.0-20230626125956-c381fe19a108
|
||||
|
||||
replace github.com/cs3org/reva/v2 => github.com/dragonchaser/reva/v2 v2.4.1-0.20230721092423-decf58981cfd
|
||||
|
||||
4
go.sum
4
go.sum
@@ -625,8 +625,6 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo
|
||||
github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4=
|
||||
github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc=
|
||||
github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA=
|
||||
github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9 h1:ycV7H1siLmMiRmc9kaS0WonysHYUT7irvH4FDDAghqQ=
|
||||
github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w=
|
||||
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
|
||||
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
|
||||
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
|
||||
@@ -659,6 +657,8 @@ github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyG
|
||||
github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg=
|
||||
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
|
||||
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/dragonchaser/reva/v2 v2.4.1-0.20230721092423-decf58981cfd h1:ngsy/v6TBnhJ2CqrXUmQBhlEhUs3y/TOMu7e2kSuonY=
|
||||
github.com/dragonchaser/reva/v2 v2.4.1-0.20230721092423-decf58981cfd/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e h1:rcHHSQqzCgvlwP0I/fQ8rQMn/MpHE5gWSLdtpxtP6KQ=
|
||||
|
||||
38
vendor/github.com/cs3org/reva/v2/internal/http/services/datagateway/datagateway.go
generated
vendored
38
vendor/github.com/cs3org/reva/v2/internal/http/services/datagateway/datagateway.go
generated
vendored
@@ -58,8 +58,8 @@ func init() {
|
||||
global.Register("datagateway", New)
|
||||
}
|
||||
|
||||
// TransferClaims are custom claims for a JWT token to be used between the metadata and data gateways.
|
||||
type TransferClaims struct {
|
||||
// transferClaims are custom claims for a JWT token to be used between the metadata and data gateways.
|
||||
type transferClaims struct {
|
||||
jwt.StandardClaims
|
||||
Target string `json:"target"`
|
||||
}
|
||||
@@ -161,24 +161,7 @@ func addCorsHeader(res http.ResponseWriter) {
|
||||
headers.Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS, HEAD")
|
||||
}
|
||||
|
||||
// Verify a transfer token against the given secret
|
||||
func Verify(ctx context.Context, token string, secret string) (*TransferClaims, error) {
|
||||
j, err := jwt.ParseWithClaims(token, &TransferClaims{}, func(token *jwt.Token) (interface{}, error) {
|
||||
return []byte(secret), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error parsing token")
|
||||
}
|
||||
|
||||
if claims, ok := j.Claims.(*TransferClaims); ok && j.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
err = errtypes.InvalidCredentials("token invalid")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (s *svc) verify(ctx context.Context, r *http.Request) (*TransferClaims, error) {
|
||||
func (s *svc) verify(ctx context.Context, r *http.Request) (*transferClaims, error) {
|
||||
// Extract transfer token from request header. If not existing, assume that it's the last path segment instead.
|
||||
token := r.Header.Get(TokenTransportHeader)
|
||||
if token == "" {
|
||||
@@ -186,7 +169,20 @@ func (s *svc) verify(ctx context.Context, r *http.Request) (*TransferClaims, err
|
||||
r.Header.Set(TokenTransportHeader, token)
|
||||
}
|
||||
|
||||
return Verify(ctx, token, s.conf.TransferSharedSecret)
|
||||
j, err := jwt.ParseWithClaims(token, &transferClaims{}, func(token *jwt.Token) (interface{}, error) {
|
||||
return []byte(s.conf.TransferSharedSecret), nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error parsing token")
|
||||
}
|
||||
|
||||
if claims, ok := j.Claims.(*transferClaims); ok && j.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
err = errtypes.InvalidCredentials("token invalid")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (s *svc) doHead(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/avatars.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/avatars.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
||||
"encoding/hex"
|
||||
"net/http"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp/router"
|
||||
@@ -31,7 +32,7 @@ import (
|
||||
type AvatarsHandler struct {
|
||||
}
|
||||
|
||||
func (h *AvatarsHandler) init(c *Config) error {
|
||||
func (h *AvatarsHandler) init(c *config.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
88
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config/config.go
generated
vendored
Normal file
88
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config/config.go
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
package config
|
||||
|
||||
import "github.com/cs3org/reva/v2/pkg/sharedconf"
|
||||
|
||||
// Config holds the config options that need to be passed down to all ocdav handlers
|
||||
type Config struct {
|
||||
Prefix string `mapstructure:"prefix"`
|
||||
// FilesNamespace prefixes the namespace, optionally with user information.
|
||||
// Example: if FilesNamespace is /users/{{substr 0 1 .Username}}/{{.Username}}
|
||||
// and received path is /docs the internal path will be:
|
||||
// /users/<first char of username>/<username>/docs
|
||||
FilesNamespace string `mapstructure:"files_namespace"`
|
||||
// WebdavNamespace prefixes the namespace, optionally with user information.
|
||||
// Example: if WebdavNamespace is /users/{{substr 0 1 .Username}}/{{.Username}}
|
||||
// and received path is /docs the internal path will be:
|
||||
// /users/<first char of username>/<username>/docs
|
||||
WebdavNamespace string `mapstructure:"webdav_namespace"`
|
||||
SharesNamespace string `mapstructure:"shares_namespace"`
|
||||
GatewaySvc string `mapstructure:"gatewaysvc"`
|
||||
Timeout int64 `mapstructure:"timeout"`
|
||||
Insecure bool `mapstructure:"insecure"`
|
||||
// If true, HTTP COPY will expect the HTTP-TPC (third-party copy) headers
|
||||
EnableHTTPTpc bool `mapstructure:"enable_http_tpc"`
|
||||
PublicURL string `mapstructure:"public_url"`
|
||||
FavoriteStorageDriver string `mapstructure:"favorite_storage_driver"`
|
||||
FavoriteStorageDrivers map[string]map[string]interface{} `mapstructure:"favorite_storage_drivers"`
|
||||
Version string `mapstructure:"version"`
|
||||
VersionString string `mapstructure:"version_string"`
|
||||
Edition string `mapstructure:"edition"`
|
||||
Product string `mapstructure:"product"`
|
||||
ProductName string `mapstructure:"product_name"`
|
||||
ProductVersion string `mapstructure:"product_version"`
|
||||
AllowPropfindDepthInfinitiy bool `mapstructure:"allow_depth_infinity"`
|
||||
|
||||
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
|
||||
|
||||
NameValidation NameValidation `mapstructure:"validation"`
|
||||
|
||||
MachineAuthAPIKey string `mapstructure:"machine_auth_apikey"`
|
||||
}
|
||||
|
||||
// NameValidation is the validation configuration for file and folder names
|
||||
type NameValidation struct {
|
||||
InvalidChars []string `mapstructure:"invalid_chars"`
|
||||
MaxLength int `mapstructure:"max_length"`
|
||||
}
|
||||
|
||||
// Init initializes the configuration
|
||||
func (c *Config) Init() {
|
||||
// note: default c.Prefix is an empty string
|
||||
c.GatewaySvc = sharedconf.GetGatewaySVC(c.GatewaySvc)
|
||||
|
||||
if c.FavoriteStorageDriver == "" {
|
||||
c.FavoriteStorageDriver = "memory"
|
||||
}
|
||||
|
||||
if c.Version == "" {
|
||||
c.Version = "10.0.11.5"
|
||||
}
|
||||
|
||||
if c.VersionString == "" {
|
||||
c.VersionString = "10.0.11"
|
||||
}
|
||||
|
||||
if c.Product == "" {
|
||||
c.Product = "reva"
|
||||
}
|
||||
|
||||
if c.ProductName == "" {
|
||||
c.ProductName = "reva"
|
||||
}
|
||||
|
||||
if c.ProductVersion == "" {
|
||||
c.ProductVersion = "10.0.11"
|
||||
}
|
||||
|
||||
if c.Edition == "" {
|
||||
c.Edition = "community"
|
||||
}
|
||||
|
||||
if c.NameValidation.InvalidChars == nil {
|
||||
c.NameValidation.InvalidChars = []string{"\f", "\r", "\n", "\\"}
|
||||
}
|
||||
|
||||
if c.NameValidation.MaxLength == 0 {
|
||||
c.NameValidation.MaxLength = 255
|
||||
}
|
||||
}
|
||||
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/dav.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/dav.go
generated
vendored
@@ -28,6 +28,7 @@ import (
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
@@ -57,7 +58,7 @@ type DavHandler struct {
|
||||
SharesHandler *WebDavHandler
|
||||
}
|
||||
|
||||
func (h *DavHandler) init(c *Config) error {
|
||||
func (h *DavHandler) init(c *config.Config) error {
|
||||
h.AvatarsHandler = new(AvatarsHandler)
|
||||
if err := h.AvatarsHandler.init(c); err != nil {
|
||||
return err
|
||||
|
||||
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/meta.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/meta.go
generated
vendored
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop"
|
||||
@@ -41,7 +42,7 @@ type MetaHandler struct {
|
||||
VersionsHandler *VersionsHandler
|
||||
}
|
||||
|
||||
func (h *MetaHandler) init(c *Config) error {
|
||||
func (h *MetaHandler) init(c *config.Config) error {
|
||||
h.VersionsHandler = new(VersionsHandler)
|
||||
return h.VersionsHandler.init(c)
|
||||
}
|
||||
|
||||
101
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/ocdav.go
generated
vendored
101
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/ocdav.go
generated
vendored
@@ -29,6 +29,7 @@ import (
|
||||
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/pkg/appctx"
|
||||
ctxpkg "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
@@ -37,7 +38,6 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp"
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp/global"
|
||||
"github.com/cs3org/reva/v2/pkg/rhttp/router"
|
||||
"github.com/cs3org/reva/v2/pkg/sharedconf"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/favorite"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/favorite/registry"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/utils/templates"
|
||||
@@ -57,91 +57,8 @@ func init() {
|
||||
global.Register("ocdav", New)
|
||||
}
|
||||
|
||||
// Config holds the config options that need to be passed down to all ocdav handlers
|
||||
type Config struct {
|
||||
Prefix string `mapstructure:"prefix"`
|
||||
// FilesNamespace prefixes the namespace, optionally with user information.
|
||||
// Example: if FilesNamespace is /users/{{substr 0 1 .Username}}/{{.Username}}
|
||||
// and received path is /docs the internal path will be:
|
||||
// /users/<first char of username>/<username>/docs
|
||||
FilesNamespace string `mapstructure:"files_namespace"`
|
||||
// WebdavNamespace prefixes the namespace, optionally with user information.
|
||||
// Example: if WebdavNamespace is /users/{{substr 0 1 .Username}}/{{.Username}}
|
||||
// and received path is /docs the internal path will be:
|
||||
// /users/<first char of username>/<username>/docs
|
||||
WebdavNamespace string `mapstructure:"webdav_namespace"`
|
||||
SharesNamespace string `mapstructure:"shares_namespace"`
|
||||
GatewaySvc string `mapstructure:"gatewaysvc"`
|
||||
Timeout int64 `mapstructure:"timeout"`
|
||||
Insecure bool `mapstructure:"insecure"`
|
||||
// If true, HTTP COPY will expect the HTTP-TPC (third-party copy) headers
|
||||
EnableHTTPTpc bool `mapstructure:"enable_http_tpc"`
|
||||
PublicURL string `mapstructure:"public_url"`
|
||||
FavoriteStorageDriver string `mapstructure:"favorite_storage_driver"`
|
||||
FavoriteStorageDrivers map[string]map[string]interface{} `mapstructure:"favorite_storage_drivers"`
|
||||
Version string `mapstructure:"version"`
|
||||
VersionString string `mapstructure:"version_string"`
|
||||
Edition string `mapstructure:"edition"`
|
||||
Product string `mapstructure:"product"`
|
||||
ProductName string `mapstructure:"product_name"`
|
||||
ProductVersion string `mapstructure:"product_version"`
|
||||
// optional, if set will unpack the transfer token and directly send uploads to the data provider
|
||||
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
|
||||
|
||||
NameValidation NameValidation `mapstructure:"validation"`
|
||||
|
||||
MachineAuthAPIKey string `mapstructure:"machine_auth_apikey"`
|
||||
}
|
||||
|
||||
// NameValidation is the validation configuration for file and folder names
|
||||
type NameValidation struct {
|
||||
InvalidChars []string `mapstructure:"invalid_chars"`
|
||||
MaxLength int `mapstructure:"max_length"`
|
||||
}
|
||||
|
||||
func (c *Config) init() {
|
||||
// note: default c.Prefix is an empty string
|
||||
c.GatewaySvc = sharedconf.GetGatewaySVC(c.GatewaySvc)
|
||||
|
||||
if c.FavoriteStorageDriver == "" {
|
||||
c.FavoriteStorageDriver = "memory"
|
||||
}
|
||||
|
||||
if c.Version == "" {
|
||||
c.Version = "10.0.11.5"
|
||||
}
|
||||
|
||||
if c.VersionString == "" {
|
||||
c.VersionString = "10.0.11"
|
||||
}
|
||||
|
||||
if c.Product == "" {
|
||||
c.Product = "reva"
|
||||
}
|
||||
|
||||
if c.ProductName == "" {
|
||||
c.ProductName = "reva"
|
||||
}
|
||||
|
||||
if c.ProductVersion == "" {
|
||||
c.ProductVersion = "10.0.11"
|
||||
}
|
||||
|
||||
if c.Edition == "" {
|
||||
c.Edition = "community"
|
||||
}
|
||||
|
||||
if c.NameValidation.InvalidChars == nil {
|
||||
c.NameValidation.InvalidChars = []string{"\f", "\r", "\n", "\\"}
|
||||
}
|
||||
|
||||
if c.NameValidation.MaxLength == 0 {
|
||||
c.NameValidation.MaxLength = 255
|
||||
}
|
||||
}
|
||||
|
||||
type svc struct {
|
||||
c *Config
|
||||
c *config.Config
|
||||
webDavHandler *WebDavHandler
|
||||
davHandler *DavHandler
|
||||
favoritesManager favorite.Manager
|
||||
@@ -153,17 +70,17 @@ type svc struct {
|
||||
nameValidators []Validator
|
||||
}
|
||||
|
||||
func (s *svc) Config() *Config {
|
||||
func (s *svc) Config() *config.Config {
|
||||
return s.c
|
||||
}
|
||||
|
||||
func getFavoritesManager(c *Config) (favorite.Manager, error) {
|
||||
func getFavoritesManager(c *config.Config) (favorite.Manager, error) {
|
||||
if f, ok := registry.NewFuncs[c.FavoriteStorageDriver]; ok {
|
||||
return f(c.FavoriteStorageDrivers[c.FavoriteStorageDriver])
|
||||
}
|
||||
return nil, errtypes.NotFound("driver not found: " + c.FavoriteStorageDriver)
|
||||
}
|
||||
func getLockSystem(c *Config) (LockSystem, error) {
|
||||
func getLockSystem(c *config.Config) (LockSystem, error) {
|
||||
// TODO in memory implementation
|
||||
selector, err := pool.GatewaySelector(c.GatewaySvc)
|
||||
if err != nil {
|
||||
@@ -174,12 +91,12 @@ func getLockSystem(c *Config) (LockSystem, error) {
|
||||
|
||||
// New returns a new ocdav service
|
||||
func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error) {
|
||||
conf := &Config{}
|
||||
conf := &config.Config{}
|
||||
if err := mapstructure.Decode(m, conf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
conf.init()
|
||||
conf.Init()
|
||||
|
||||
fm, err := getFavoritesManager(conf)
|
||||
if err != nil {
|
||||
@@ -194,9 +111,9 @@ func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error)
|
||||
}
|
||||
|
||||
// NewWith returns a new ocdav service
|
||||
func NewWith(conf *Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger, selector pool.Selectable[gateway.GatewayAPIClient]) (global.Service, error) {
|
||||
func NewWith(conf *config.Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger, selector pool.Selectable[gateway.GatewayAPIClient]) (global.Service, error) {
|
||||
// be safe - init the conf again
|
||||
conf.init()
|
||||
conf.Init()
|
||||
|
||||
s := &svc{
|
||||
c: conf,
|
||||
|
||||
@@ -38,6 +38,7 @@ import (
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/grpc/services/storageprovider"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop"
|
||||
@@ -168,13 +169,15 @@ func NewMultiStatusResponseXML() *MultiStatusResponseXML {
|
||||
type Handler struct {
|
||||
PublicURL string
|
||||
selector pool.Selectable[gateway.GatewayAPIClient]
|
||||
c *config.Config
|
||||
}
|
||||
|
||||
// NewHandler returns a new PropfindHandler instance
|
||||
func NewHandler(publicURL string, selector pool.Selectable[gateway.GatewayAPIClient]) *Handler {
|
||||
func NewHandler(publicURL string, selector pool.Selectable[gateway.GatewayAPIClient], c *config.Config) *Handler {
|
||||
return &Handler{
|
||||
PublicURL: publicURL,
|
||||
selector: selector,
|
||||
c: c,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +247,18 @@ func (p *Handler) HandleSpacesPropfind(w http.ResponseWriter, r *http.Request, s
|
||||
return
|
||||
}
|
||||
|
||||
if depth == net.DepthInfinity && !p.c.AllowPropfindDepthInfinitiy {
|
||||
span.RecordError(errors.ErrInvalidDepth)
|
||||
span.SetStatus(codes.Error, "DEPTH: infinity is not supported")
|
||||
span.SetAttributes(semconv.HTTPStatusCodeKey.Int(http.StatusBadRequest))
|
||||
sublog.Debug().Str("depth", dh).Msg(errors.ErrInvalidDepth.Error())
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
m := fmt.Sprintf("Invalid Depth header value: %v", dh)
|
||||
b, err := errors.Marshal(http.StatusBadRequest, m, "")
|
||||
errors.HandleWebdavError(&sublog, w, b, err)
|
||||
return
|
||||
}
|
||||
|
||||
pf, status, err := ReadPropfind(r.Body)
|
||||
if err != nil {
|
||||
sublog.Debug().Err(err).Msg("error reading propfind request")
|
||||
|
||||
12
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/put.go
generated
vendored
12
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/put.go
generated
vendored
@@ -298,18 +298,6 @@ func (s *svc) handlePut(ctx context.Context, w http.ResponseWriter, r *http.Requ
|
||||
}
|
||||
}
|
||||
|
||||
// if we know the transfer secret we can directly talk to the dataprovider
|
||||
if s.c.TransferSharedSecret != "" {
|
||||
claims, err := datagateway.Verify(ctx, token, s.c.TransferSharedSecret)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error verifying transfer token")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
// directly send request to target
|
||||
ep = claims.Target
|
||||
}
|
||||
|
||||
httpReq, err := rhttp.NewRequest(ctx, http.MethodPut, ep, r.Body)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
5
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spaces.go
generated
vendored
5
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spaces.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/propfind"
|
||||
@@ -38,7 +39,7 @@ type SpacesHandler struct {
|
||||
useLoggedInUserNS bool
|
||||
}
|
||||
|
||||
func (h *SpacesHandler) init(c *Config) error {
|
||||
func (h *SpacesHandler) init(c *config.Config) error {
|
||||
h.gatewaySvc = c.GatewaySvc
|
||||
h.namespace = path.Join("/", c.WebdavNamespace)
|
||||
h.useLoggedInUserNS = true
|
||||
@@ -78,7 +79,7 @@ func (h *SpacesHandler) Handler(s *svc, trashbinHandler *TrashbinHandler) http.H
|
||||
var err error
|
||||
switch r.Method {
|
||||
case MethodPropfind:
|
||||
p := propfind.NewHandler(config.PublicURL, s.gatewaySelector)
|
||||
p := propfind.NewHandler(config.PublicURL, s.gatewaySelector, config)
|
||||
p.HandleSpacesPropfind(w, r, spaceID)
|
||||
case MethodProppatch:
|
||||
status, err = s.handleSpacesProppatch(w, r, spaceID)
|
||||
|
||||
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/trashbin.go
generated
vendored
@@ -29,6 +29,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop"
|
||||
@@ -51,7 +52,7 @@ type TrashbinHandler struct {
|
||||
namespace string
|
||||
}
|
||||
|
||||
func (h *TrashbinHandler) init(c *Config) error {
|
||||
func (h *TrashbinHandler) init(c *config.Config) error {
|
||||
h.gatewaySvc = c.GatewaySvc
|
||||
h.namespace = path.Join("/", c.FilesNamespace)
|
||||
return nil
|
||||
|
||||
13
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/tus.go
generated
vendored
13
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/tus.go
generated
vendored
@@ -32,7 +32,6 @@ import (
|
||||
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/datagateway"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
|
||||
@@ -255,18 +254,6 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http.
|
||||
}
|
||||
var httpRes *http.Response
|
||||
|
||||
// if we know the transfer secret we can directly talk to the dataprovider
|
||||
if s.c.TransferSharedSecret != "" {
|
||||
claims, err := datagateway.Verify(ctx, token, s.c.TransferSharedSecret)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error verifying transfer token")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
// directly send request to target
|
||||
ep = claims.Target
|
||||
}
|
||||
|
||||
httpReq, err := rhttp.NewRequest(ctx, http.MethodPatch, ep, r.Body)
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Msg("wrong request")
|
||||
|
||||
4
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/validation.go
generated
vendored
4
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/validation.go
generated
vendored
@@ -4,13 +4,15 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
)
|
||||
|
||||
// Validator validates strings
|
||||
type Validator func(string) error
|
||||
|
||||
// ValidatorsFromConfig returns the configured Validators
|
||||
func ValidatorsFromConfig(c *Config) []Validator {
|
||||
func ValidatorsFromConfig(c *config.Config) []Validator {
|
||||
// we always want to exclude empty names
|
||||
vals := []Validator{notEmpty()}
|
||||
|
||||
|
||||
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/versions.go
generated
vendored
3
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/versions.go
generated
vendored
@@ -23,6 +23,7 @@ import (
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/propfind"
|
||||
@@ -40,7 +41,7 @@ import (
|
||||
type VersionsHandler struct {
|
||||
}
|
||||
|
||||
func (h *VersionsHandler) init(c *Config) error {
|
||||
func (h *VersionsHandler) init(c *config.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
2
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/webdav.go
generated
vendored
2
vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/webdav.go
generated
vendored
@@ -72,7 +72,7 @@ func (h *WebDavHandler) Handler(s *svc) http.Handler {
|
||||
var status int // status 0 means the handler already sent the response
|
||||
switch r.Method {
|
||||
case MethodPropfind:
|
||||
p := propfind.NewHandler(config.PublicURL, s.gatewaySelector)
|
||||
p := propfind.NewHandler(config.PublicURL, s.gatewaySelector, config)
|
||||
p.HandlePathPropfind(w, r, ns)
|
||||
case MethodLock:
|
||||
status, err = s.handleLock(w, r, ns)
|
||||
|
||||
15
vendor/github.com/cs3org/reva/v2/pkg/micro/ocdav/option.go
generated
vendored
15
vendor/github.com/cs3org/reva/v2/pkg/micro/ocdav/option.go
generated
vendored
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav"
|
||||
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/favorite"
|
||||
"github.com/rs/zerolog"
|
||||
@@ -43,9 +44,8 @@ type Options struct {
|
||||
Context context.Context
|
||||
// Metrics *metrics.Metrics
|
||||
// Flags []cli.Flag
|
||||
Name string
|
||||
JWTSecret string
|
||||
TransferSecret string
|
||||
Name string
|
||||
JWTSecret string
|
||||
|
||||
FavoriteManager favorite.Manager
|
||||
GatewaySelector pool.Selectable[gateway.GatewayAPIClient]
|
||||
@@ -63,7 +63,7 @@ type Options struct {
|
||||
MetricsSubsystem string
|
||||
|
||||
// ocdav.* is internal so we need to set config options individually
|
||||
config ocdav.Config
|
||||
config config.Config
|
||||
lockSystem ocdav.LockSystem
|
||||
AllowCredentials bool
|
||||
AllowedOrigins []string
|
||||
@@ -110,13 +110,6 @@ func JWTSecret(s string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// TransferSecret provides a function to set the transfer secret option.
|
||||
func TransferSecret(s string) Option {
|
||||
return func(o *Options) {
|
||||
o.config.TransferSharedSecret = s
|
||||
}
|
||||
}
|
||||
|
||||
// MachineAuthAPIKey provides a function to set the machine auth api key option.
|
||||
func MachineAuthAPIKey(s string) Option {
|
||||
return func(o *Options) {
|
||||
|
||||
21
vendor/github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool/connection.go
generated
vendored
21
vendor/github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool/connection.go
generated
vendored
@@ -20,8 +20,11 @@ package pool
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
rtrace "github.com/cs3org/reva/v2/pkg/trace"
|
||||
"github.com/pkg/errors"
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@@ -29,13 +32,12 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
maxCallRecvMsgSize = 10240000
|
||||
_defaultMaxCallRecvMsgSize = 10240000
|
||||
)
|
||||
|
||||
// NewConn creates a new connection to a grpc server
|
||||
// with open census tracing support.
|
||||
// TODO(labkode): make grpc tls configurable.
|
||||
// TODO make maxCallRecvMsgSize configurable, raised from the default 4MB to be able to list 10k files
|
||||
func NewConn(address string, opts ...Option) (*grpc.ClientConn, error) {
|
||||
|
||||
options := ClientOptions{}
|
||||
@@ -69,11 +71,24 @@ func NewConn(address string, opts ...Option) (*grpc.ClientConn, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: We need to configure some grpc options in a central place.
|
||||
// If many services configure the (e.g.) gateway client differently, one will be pick randomly. This leads to inconsistencies when using the single binary.
|
||||
// To avoid inconsistencies and race conditions we get the configuration here.
|
||||
// Please do NOT follow the pattern of calling `os.Getenv` in the wild without consulting docu team first.
|
||||
maxRcvMsgSize := _defaultMaxCallRecvMsgSize
|
||||
if e := os.Getenv("OCIS_GRPC_MAX_RECEIVED_MESSAGE_SIZE"); e != "" {
|
||||
s, err := strconv.Atoi(e)
|
||||
if err != nil || s <= 0 {
|
||||
return nil, errors.Wrap(err, "grpc max message size is not a valid int")
|
||||
}
|
||||
maxRcvMsgSize = s
|
||||
}
|
||||
|
||||
conn, err := grpc.Dial(
|
||||
address,
|
||||
grpc.WithTransportCredentials(cred),
|
||||
grpc.WithDefaultCallOptions(
|
||||
grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
|
||||
grpc.MaxCallRecvMsgSize(maxRcvMsgSize),
|
||||
),
|
||||
grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor(
|
||||
otelgrpc.WithTracerProvider(
|
||||
|
||||
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@@ -352,7 +352,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
|
||||
# github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9
|
||||
# github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9 => github.com/dragonchaser/reva/v2 v2.4.1-0.20230721092423-decf58981cfd
|
||||
## explicit; go 1.20
|
||||
github.com/cs3org/reva/v2/cmd/revad/internal/grace
|
||||
github.com/cs3org/reva/v2/cmd/revad/runtime
|
||||
@@ -420,6 +420,7 @@ github.com/cs3org/reva/v2/internal/http/services/meshdirectory
|
||||
github.com/cs3org/reva/v2/internal/http/services/metrics
|
||||
github.com/cs3org/reva/v2/internal/http/services/ocmd
|
||||
github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav
|
||||
github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/config
|
||||
github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/errors
|
||||
github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net
|
||||
github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/prop
|
||||
@@ -2206,3 +2207,4 @@ stash.kopano.io/kgol/oidc-go
|
||||
## explicit; go 1.13
|
||||
stash.kopano.io/kgol/rndm
|
||||
# github.com/cs3org/go-cs3apis => github.com/2403905/go-cs3apis v0.0.0-20230517122726-727045414fd1
|
||||
# github.com/cs3org/reva/v2 => github.com/dragonchaser/reva/v2 v2.4.1-0.20230721092423-decf58981cfd
|
||||
|
||||
Reference in New Issue
Block a user