Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnails service not working with other Identity Providers #1624

Closed
labkode opened this issue Feb 11, 2021 · 5 comments
Closed

Thumbnails service not working with other Identity Providers #1624

labkode opened this issue Feb 11, 2021 · 5 comments
Labels

Comments

@labkode
Copy link
Contributor

labkode commented Feb 11, 2021

Running from OCIS at master tip.

The problem is due to a hardcoded value of the thumbnails service, that makes previews only when OCIS runs its own IdP which may not be the case in most of production deployments.

https://github.com/owncloud/ocis/blob/master/thumbnails/pkg/service/v0/service.go#L109

The identityMap := claims["kc.identity"].(map[string]interface{}) 

I suggest to re-use the following environment variables in the thumbnails service (that depends directly on the Storage).

STORAGE_OIDC_UID_CLAIM="cern_uid"
STORAGE_OIDC_GID_CLAIM="cern_gid"

Stacktrace below:

Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: 2021-02-11 14:11:52  file=grpc/grpc.go:373 level=error panic recovered: interface conversion: interface {} is nil, not map[string]interface {}
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: 2021-02-11 14:11:52  file=grpc/grpc.go:374 level=error goroutine 176 [running]:
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: runtime/debug.Stack(0xc00012d060, 0xc00034bc02, 0xc00034bc20)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /usr/local/go/src/runtime/debug/stack.go:24 +0x9f
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/server/grpc.(*grpcServer).processRequest.func1.1(0xc0002dafc0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/server/grpc/grpc.go:374 +0x2a9
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: panic(0x3411140, 0xc000575ec0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /usr/local/go/src/runtime/panic.go:969 +0x1b9
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/thumbnails/pkg/service/v0.usernameFromAuthorization(0xc0003de000, 0x7da, 0xc000d511c0, 0x3, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/thumbnails/pkg/service/v0/service.go:109 +0x266
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/thumbnails/pkg/service/v0.Thumbnail.GetThumbnail(0xc000d34ac0, 0x1b, 0x3c0d160, 0xc000149800, 0x3befb00, 0xc00034ba60, 0x3c0d3a0, 0xc000d31e70, 0xff, 0x0, ...)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/thumbnails/pkg/service/v0/service.go:59 +0x293
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/thumbnails/pkg/service/v0.instrument.GetThumbnail(0x3befaa0, 0xc000673a70, 0xc00040ac60, 0x3c457a0, 0xc000575320, 0xc0013082a0, 0xc0005a2d70, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/thumbnails/pkg/service/v0/instrument.go:33 +0x15d
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/thumbnails/pkg/service/v0.logging.GetThumbnail(0x3befac0, 0xc00034bc60, 0x3c0d3a0, 0xc000d31e70, 0xff, 0x0, 0x0, 0xc000449400, 0x17, 0x1f4, ...)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/thumbnails/pkg/service/v0/logging.go:27 +0xab
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/thumbnails/pkg/proto/v0.(*thumbnailServiceHandler).GetThumbnail(0xc000d3eb40, 0x3c457a0, 0xc000575320, 0xc0013082a0, 0xc0005a2d70, 0xc000f59000, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/thumbnails/pkg/proto/v0/thumbnails.pb.micro.go:84 +0x5b
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: reflect.Value.call(0xc000149880, 0xc000129718, 0x13, 0x38684a8, 0x4, 0xc0004a2f10, 0x4, 0x4, 0x16, 0x3768e40, ...)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /usr/local/go/src/reflect/value.go:476 +0x8c7
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: reflect.Value.Call(0xc000149880, 0xc000129718, 0x13, 0xc0004a2f10, 0x4, 0x4, 0xc00034b740, 0x20, 0xc0004a2f50)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /usr/local/go/src/reflect/value.go:337 +0xb9
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/server/grpc.(*grpcServer).processRequest.func1(0x3c457a0, 0xc000575320, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/server/grpc/grpc.go:379 +0x2d6
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/util/wrapper.AuthHandler.func1.1(0x3c457a0, 0xc000575200, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0xc000575200, 0xc0001e6930)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/util/wrapper/wrapper.go:239 +0x835
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/util/wrapper.TraceHandler.func1.1(0x3c457a0, 0xc000575110, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/util/wrapper/wrapper.go:120 +0x1be
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/util/wrapper.HandlerStats.func1.1(0x3c457a0, 0xc000575110, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0x0, 0x3c457a0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/util/wrapper/wrapper.go:65 +0x83
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-plugins/wrapper/trace/opencensus/v2.NewHandlerWrapper.func1.1(0x3c457a0, 0xc000575110, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-plugins/wrapper/trace/opencensus/v2@v2.9.1/opencensus.go:117 +0x40e
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/owncloud/ocis/ocis-pkg/wrapper/prometheus.NewHandlerWrapper.func1.1(0x3c456e0, 0xc000d53a00, 0x3c60fc0, 0xc000497200, 0x36d5720, 0xc0005a2d70, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/ocis/ocis-pkg/wrapper/prometheus/prometheus.go:77 +0x1e8
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/server/grpc.(*grpcServer).processRequest(0xc000001e00, 0x3c54180, 0xc000f5a300, 0xc0003a5740, 0xc000673b00, 0xc000e96040, 0x16, 0x3c456e0, 0xc000d53a00, 0xc000496f00, ...)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/server/grpc/grpc.go:396 +0x7c4
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: github.com/micro/go-micro/v2/server/grpc.(*grpcServer).handler(0xc000001e00, 0x0, 0x0, 0x3c54180, 0xc000f5a300, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/github.com/micro/go-micro/v2@v2.9.1/server/grpc/grpc.go:315 +0x799
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: google.golang.org/grpc.(*Server).processStreamingRPC(0xc000b33080, 0x3c61140, 0xc00079a600, 0xc0009b0a00, 0x0, 0xc000d4e600, 0x0, 0x0, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/google.golang.org/grpc@v1.26.0/server.go:1237 +0xcdd
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: google.golang.org/grpc.(*Server).handleStream(0xc000b33080, 0x3c61140, 0xc00079a600, 0xc0009b0a00, 0x0)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/google.golang.org/grpc@v1.26.0/server.go:1323 +0xba5
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00015af40, 0xc000b33080, 0x3c61140, 0xc00079a600, 0xc0009b0a00)
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/google.golang.org/grpc@v1.26.0/server.go:722 +0xa5
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: created by google.golang.org/grpc.(*Server).serveStreams.func1
Feb 11 14:11:52 cbox-ocis-01.cern.ch ocis: /root/go/pkg/mod/google.golang.org/grpc@v1.26.0/server.go:720 +0xa5
@wkloucek
Copy link
Contributor

Can be reproduced with our Keycloak setup on https://ocis.ocis-keycloak.released.owncloud.works. Uploading a picture does not show a preview and does not display it in the mediaviewer.

@labkode
Copy link
Contributor Author

labkode commented Feb 11, 2021

@phil-davis are there any tests covering the preview creation?

@C0rby
Copy link
Contributor

C0rby commented Feb 11, 2021

There are but not with different IDPs at the moment IIRC.

@wkloucek
Copy link
Contributor

maybe #1385 should be considered when tackling this

@butonic
Copy link
Member

butonic commented Feb 12, 2021

quickfix landed in ocis master with #1628

@butonic butonic closed this as completed Feb 12, 2021
@micbar micbar mentioned this issue Feb 17, 2021
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants