Skip to content

Commit

Permalink
Merge branch 'master' into patch_xss
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoguita authored Oct 14, 2022
2 parents 9e9a948 + 0a5d64b commit 181e1b4
Show file tree
Hide file tree
Showing 39 changed files with 386 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .drone.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The test runner source for API tests
CORE_COMMITID=3027b2b8288211d3226ec03f308ff80b9322b10a
CORE_COMMITID=899e9b85389bbb22f6b8c81ee7ada0e5cc1f70a4
CORE_BRANCH=master
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ litmus-test-new: build
pkill revad
lint:
go run tools/check-license/check-license.go
`go env GOPATH`/bin/golangci-lint run --timeout 3m0s
go vet ./...

contrib:
git shortlog -se | cut -c8- | sort -u | awk '{print "-", $$0}' | grep -v 'users.noreply.github.com' > CONTRIBUTORS.md
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-closed-FIXME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Remove FIXME

Issue https://github.com/cs3org/reva/issues/2402 is closed.

https://github.com/cs3org/reva/pull/3311
3 changes: 3 additions & 0 deletions changelog/unreleased/fix-quota-percentage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: Fix quota percentage

https://github.com/cs3org/reva/pull/3344
10 changes: 10 additions & 0 deletions changelog/unreleased/lang-supp-in-app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Enhancement: added support for configuring language locales in apps

This is a partial backport from edge: we introduce a language option
in the appprovider, which if set is passed as appropriate parameter
to the external apps in order to force a given localization. In particular,
for Microsoft Office 365 the DC_LLCC option is set as well.
The default behavior is unset, where apps try and resolve the
localization from the browser headers.

https://github.com/cs3org/reva/pull/3303
6 changes: 6 additions & 0 deletions changelog/unreleased/ocm-content-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: fix content-type for OCM sharing

This fix change the content type to just
"application/json"

https://github.com/cs3org/reva/pull/3313
4 changes: 4 additions & 0 deletions changelog/unreleased/oidc-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bugfix: Fix oidc provider crash when custom claims are provided

https://github.com/cs3org/reva/pull/3319

3 changes: 3 additions & 0 deletions changelog/unreleased/propfind-zero-depth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Implemented PROPFIND with 0 depth

https://github.com/cs3org/reva/pull/3347
3 changes: 3 additions & 0 deletions changelog/unreleased/publiclink-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Add description to public link

https://github.com/cs3org/reva/pull/3305
3 changes: 3 additions & 0 deletions changelog/unreleased/reva-token-bearer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Enhancement: Accept reva token as a bearer authentication

https://github.com/cs3org/reva/pull/3315
10 changes: 7 additions & 3 deletions cmd/reva/public-share-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ func publicShareCreateCommand() *command {
cmd.Description = func() string { return "create a public share" }
cmd.Usage = func() string { return "Usage: public-share-create [-flags] <path>" }
rol := cmd.String("rol", "viewer", "the permission for the share (viewer or editor)")
description := cmd.String("description", "", "the description for the share")
internal := cmd.Bool("internal", false, "mark the public share as internal")

cmd.ResetFlags = func() {
*rol = "viewer"
*rol, *description, *internal = "viewer", "", false
}

cmd.Action = func(w ...io.Writer) error {
Expand Down Expand Up @@ -78,6 +80,8 @@ func publicShareCreateCommand() *command {
shareRequest := &link.CreatePublicShareRequest{
ResourceInfo: res.Info,
Grant: grant,
Description: *description,
Internal: *internal,
}

shareRes, err := client.CreatePublicShare(ctx, shareRequest)
Expand All @@ -91,11 +95,11 @@ func publicShareCreateCommand() *command {

t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"#", "Owner.Idp", "Owner.OpaqueId", "ResourceId", "Permissions", "Token", "Expiration", "Created", "Updated"})
t.AppendHeader(table.Row{"#", "Owner.Idp", "Owner.OpaqueId", "ResourceId", "Permissions", "Token", "Expiration", "Created", "Updated", "Description"})

s := shareRes.Share
t.AppendRows([]table.Row{
{s.Id.OpaqueId, s.Owner.Idp, s.Owner.OpaqueId, s.ResourceId.String(), s.Permissions.String(), s.Token, s.Expiration.String(), time.Unix(int64(s.Ctime.Seconds), 0), time.Unix(int64(s.Mtime.Seconds), 0)},
{s.Id.OpaqueId, s.Owner.Idp, s.Owner.OpaqueId, s.ResourceId.String(), s.Permissions.String(), s.Token, s.Expiration.String(), time.Unix(int64(s.Ctime.Seconds), 0), time.Unix(int64(s.Mtime.Seconds), 0), s.Description},
})
t.Render()

Expand Down
4 changes: 2 additions & 2 deletions cmd/reva/public-share-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ func publicShareListCommand() *command {
if len(w) == 0 {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"#", "Owner.Idp", "Owner.OpaqueId", "ResourceId", "Permissions", "Token", "Expiration", "Created", "Updated"})
t.AppendHeader(table.Row{"#", "Owner.Idp", "Owner.OpaqueId", "ResourceId", "Permissions", "Token", "Expiration", "Created", "Updated", "Description"})

for _, s := range shareRes.Share {
t.AppendRows([]table.Row{
{s.Id.OpaqueId, s.Owner.Idp, s.Owner.OpaqueId, s.ResourceId.String(), s.Permissions.String(), s.Token, s.Expiration.String(), time.Unix(int64(s.Ctime.Seconds), 0), time.Unix(int64(s.Mtime.Seconds), 0)},
{s.Id.OpaqueId, s.Owner.Idp, s.Owner.OpaqueId, s.ResourceId.String(), s.Permissions.String(), s.Token, s.Expiration.String(), time.Unix(int64(s.Ctime.Seconds), 0), time.Unix(int64(s.Mtime.Seconds), 0), s.Description},
})
}
t.Render()
Expand Down
37 changes: 29 additions & 8 deletions cmd/reva/public-share-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ func publicShareUpdateCommand() *command {
cmd.Description = func() string { return "update a public share" }
cmd.Usage = func() string { return "Usage: public-share-update [-flags] <share_id>" }
rol := cmd.String("rol", "viewer", "the permission for the share (viewer or editor)")
description := cmd.String("description", "", "the description for the share")

cmd.ResetFlags = func() {
*rol = "viewer"
*rol, *description = "viewer", ""
}
cmd.Action = func(w ...io.Writer) error {
if cmd.NArg() < 1 {
Expand All @@ -59,7 +60,9 @@ func publicShareUpdateCommand() *command {
return err
}

shareRequest := &link.UpdatePublicShareRequest{
var updates []*link.UpdatePublicShareRequest

updates = append(updates, &link.UpdatePublicShareRequest{
Ref: &link.PublicShareReference{
Spec: &link.PublicShareReference_Id{
Id: &link.PublicShareId{
Expand All @@ -75,15 +78,33 @@ func publicShareUpdateCommand() *command {
},
},
},
}
})

shareRes, err := shareClient.UpdatePublicShare(ctx, shareRequest)
if err != nil {
return err
if *description != "" {
updates = append(updates, &link.UpdatePublicShareRequest{
Ref: &link.PublicShareReference{
Spec: &link.PublicShareReference_Id{
Id: &link.PublicShareId{
OpaqueId: id,
},
},
},
Update: &link.UpdatePublicShareRequest_Update{
Type: link.UpdatePublicShareRequest_Update_TYPE_DESCRIPTION,
Description: *description,
},
})
}

if shareRes.Status.Code != rpc.Code_CODE_OK {
return formatError(shareRes.Status)
for _, u := range updates {
shareRes, err := shareClient.UpdatePublicShare(ctx, u)
if err != nil {
return err
}

if shareRes.Status.Code != rpc.Code_CODE_OK {
return formatError(shareRes.Status)
}
}

fmt.Println("OK")
Expand Down
1 change: 1 addition & 0 deletions examples/storage-references/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mime_types = [

[grpc.services.appprovider]
mime_types = ["text/plain"]
language = "en-GB"

[http.services.datagateway]
[http.services.prometheus]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/cheggaaa/pb v1.0.29
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e
github.com/cs3org/go-cs3apis v0.0.0-20220929083235-bb0b1a236d6c
github.com/cs3org/go-cs3apis v0.0.0-20221004162747-f20ee4756d90
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8
github.com/dgraph-io/ristretto v0.1.0
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e h1:tqSPWQeueWTKnJVMJffz4pz0o1WuQxJ28+5x5JgaHD8=
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
github.com/cs3org/go-cs3apis v0.0.0-20220929083235-bb0b1a236d6c h1:b+YTmOGlf43mnF8MzO0fsy8/Ho8JLu44Iq5Y0fKLJMM=
github.com/cs3org/go-cs3apis v0.0.0-20220929083235-bb0b1a236d6c/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20221004162747-f20ee4756d90 h1:zYg2UzwpChLgXktwt7MJEMv46GQPtluifRnynkSw80Y=
github.com/cs3org/go-cs3apis v0.0.0-20221004162747-f20ee4756d90/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
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=
Expand Down Expand Up @@ -283,6 +283,8 @@ github.com/gdexlab/go-render v1.0.1/go.mod h1:wRi5nW2qfjiGj4mPukH4UV0IknS1cHD4Vg
github.com/getkin/kin-openapi v0.13.0/go.mod h1:WGRs2ZMM1Q8LR1QBEwUxC6RJEfaBcD0s+pcEVXFuAjw=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/gmgigi96/go-cs3apis v0.0.0-20221004074314-b2292f6a794c h1:mC9jwnDK3weg0S3md2euO0iIvlD33JE/MsFQGaZ/zX0=
github.com/gmgigi96/go-cs3apis v0.0.0-20221004074314-b2292f6a794c/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/go-acme/lego/v4 v4.4.0/go.mod h1:l3+tFUFZb590dWcqhWZegynUthtaHJbG2fevUpoOOE0=
github.com/go-asn1-ber/asn1-ber v1.5.4 h1:vXT6d/FNDiELJnLb6hGNa309LMsrCoYFvpwHDF0+Y1A=
github.com/go-asn1-ber/asn1-ber v1.5.4/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
Expand Down
3 changes: 2 additions & 1 deletion internal/grpc/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type config struct {
GatewaySvc string `mapstructure:"gatewaysvc"`
MimeTypes []string `mapstructure:"mime_types"`
Priority uint64 `mapstructure:"priority"`
Language string `mapstructure:"language"`
}

func (c *config) init() {
Expand Down Expand Up @@ -170,7 +171,7 @@ func getProvider(c *config) (app.Provider, error) {
}

func (s *service) OpenInApp(ctx context.Context, req *providerpb.OpenInAppRequest) (*providerpb.OpenInAppResponse, error) {
appURL, err := s.provider.GetAppURL(ctx, req.ResourceInfo, req.ViewMode, req.AccessToken)
appURL, err := s.provider.GetAppURL(ctx, req.ResourceInfo, req.ViewMode, req.AccessToken, s.conf.Language)
if err != nil {
res := &providerpb.OpenInAppResponse{
Status: status.NewInternal(ctx, errors.New("appprovider: error calling GetAppURL"), err.Error()),
Expand Down
2 changes: 0 additions & 2 deletions internal/grpc/services/ocmshareprovider/ocmshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ func (s *service) CreateOCMShare(ctx context.Context, req *ocm.CreateOCMShareReq

// discover share type
sharetype := ocm.Share_SHARE_TYPE_REGULAR
// FIXME: https://github.com/cs3org/reva/issues/2402
protocol, ok := req.Opaque.Map["protocol"]
if ok {
switch protocol.Decoder {
Expand All @@ -172,7 +171,6 @@ func (s *service) CreateOCMShare(ctx context.Context, req *ocm.CreateOCMShareReq
Status: status.NewInternal(ctx, err, "error creating share"),
}, nil
}
// token = protocol FIXME!
}

var sharedSecret string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (s *service) CreatePublicShare(ctx context.Context, req *link.CreatePublicS
log.Error().Msg("error getting user from context")
}

share, err := s.sm.CreatePublicShare(ctx, u, req.ResourceInfo, req.Grant)
share, err := s.sm.CreatePublicShare(ctx, u, req.ResourceInfo, req.Grant, req.Description, req.Internal)
if err != nil {
log.Debug().Err(err).Str("createShare", "shares").Msg("error connecting to storage provider")
}
Expand Down
Loading

0 comments on commit 181e1b4

Please sign in to comment.