owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.41k stars 184 forks source link

OCM. server crash after deleting share for ocm user #10213

Closed ScharfViktor closed 1 month ago

ScharfViktor commented 1 month ago
Web UI 10.3.0
Ocis: 6.5.0

Steps: And "Alice" has generated invitation And using server "REMOTE" And "Brian" has accepted invitation And using server "LOCAL" When "Alice" shares folder to "Brian" When "Alice" deletes access of folder to "Brian"

Expected: Actual: server of the Brian is crashed log:

2024-10-02T09:35:33+02:00 WRN http end="02/Oct/2024:09:35:33 +0200" host=127.0.0.1 line=/Users/scharfviktor/Work/ocis/vendor/github.com/cs3org/reva/v2/internal/http/interceptors/log/log.go:112 method=GET pkg=rhttp proto=HTTP/1.1 service=storage-system size=0 start="02/Oct/2024:09:35:33 +0200" status=404 time_ns=179791 traceid=9ce5ac0a09ff79ad2a22fafdcb0b37f9 uri=/data/spaces/jsoncs3-share-manager-metadata%21jsoncs3-share-manager-metadata/users/4c510ada-c86b-4815-8820-42cdf82c3d51/received.json url=/users/4c510ada-c86b-4815-8820-42cdf82c3d51/received.json
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x30 pc=0x103a39ea8]

goroutine 5024 [running]:
github.com/owncloud/ocis/v2/services/graph/pkg/service/v0.federatedRoleConditionForResourceType(...)
        /Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/utils.go:504
github.com/owncloud/ocis/v2/services/graph/pkg/service/v0.cs3ReceivedOCMShareToLibreGraphPermissions({0x1067dbaf8, 0x14004d3f770}, 0x14002314190, {0x14001a58a00?, 0x14001a58b00?, {0x1067b6cb8?, 0x14001682550?}}, 0x14004efc6c0, 0x0, {0x14004e35d40, ...})
        /Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/utils.go:806 +0x418
github.com/owncloud/ocis/v2/services/graph/pkg/service/v0.fillDriveItemPropertiesFromReceivedOCMShare({0x1067dbaf8, 0x14004d3f770}, 0x14002314190, {0x14001a58a00?, 0x14001a58b00?, {0x1067b6cb8?, 0x14001682550?}}, {0x14002fa7260, 0x1, 0x1026730fc?}, ...)
        /Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/utils.go:721 +0x2a0
github.com/owncloud/ocis/v2/services/graph/pkg/service/v0.cs3ReceivedOCMSharesToDriveItems.func1()
        /Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/utils.go:570 +0x270
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /Users/scharfviktor/Work/ocis/vendor/golang.org/x/sync/errgroup/errgroup.go:78 +0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 2113
        /Users/scharfviktor/Work/ocis/vendor/golang.org/x/sync/errgroup/errgroup.go:75 +0x98

Uploading Screen Recording 2024-10-02 at 09.35.19.mov…

ScharfViktor commented 1 month ago

test agains this fix #10219 no panic - ✅️

but request GET https://federation-ocis-server:10200/graph/v1beta1/me/drive/sharedWithMe gets 400 and user cannot longer see all shared with him files

{
    "error": {
        "code": "invalidRequest",
        "innererror": {
            "date": "2024-10-02T10:13:41Z",
            "request-id": "fc71fb01-e2d6-4c22-8859-6c61df484021"
        },
        "message": "unsupported resource type for federated role"
    }
}

log:

2024-10-02T12:13:36+02:00 WRN http end="02/Oct/2024:12:13:36 +0200" host=127.0.0.1 line=/Users/scharfviktor/Work/ocis/vendor/github.com/cs3org/reva/v2/internal/http/interceptors/log/log.go:112 method=GET pkg=rhttp proto=HTTP/1.1 service=storage-system size=0 start="02/Oct/2024:12:13:36 +0200" status=404 time_ns=304583 traceid=bc80d4a13e146c8dcf4d2c7b39d00bc8 uri=/data/spaces/jsoncs3-share-manager-metadata%21jsoncs3-share-manager-metadata/users/some-admin-user-id-0000-000000000000/received.json url=/users/some-admin-user-id-0000-000000000000/received.json
2024-10-02T12:13:41+02:00 ERR could not convert received shares to drive items error="invalidRequest: unsupported resource type for federated role" line=/Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/sharedwithme.go:58 service=graph
2024-10-02T12:13:41+02:00 ERR listSharedWithMe failed error="invalidRequest: unsupported resource type for federated role" line=/Users/scharfviktor/Work/ocis/services/graph/pkg/service/v0/sharedwithme.go:21 service=graph
ScharfViktor commented 1 month ago

fixed