Skip to content

[WiP] fix(ocm): OCM Specification Compliance - #383

Closed
MahdiBaghbani wants to merge 3 commits into
opencloud-eu:mainfrom
MahdiBaghbani:fix-base64-ids
Closed

MahdiBaghbani wants to merge 3 commits into
opencloud-eu:mainfrom
MahdiBaghbani:fix-base64-ids

Conversation

@MahdiBaghbani

@MahdiBaghbani MahdiBaghbani commented Oct 17, 2025 •

Copy link
Copy Markdown

Fixed opencloud-eu/opencloud#1671

Checklist:

  • Sharing to/from OpenCloud [patched] works
  • Sharing to/from oCIS [patched] works
  • Sharing to/from CERNBox works
  • Consistent invite and share payloads
  • Make sure incoming federated user uuid doesn't collide with internal users
  • Backward compatibility?

Based on the:

The issue I raised has happened.

The combined goal of those 2 PRs is:

  1. Avoid collision from remote users
  2. Preserve the local user IdP info when federating by constructing the opaque_id = user@idp, which is completely fine based on OCM spec, even without the base64

The issue:

  • OpenCloud should only base64 encode INCOMING user contact information, not OUTGOING (changed in 4933)

P.S. Tests are probably still outdated or wrong

MahdiBaghbani pushed a commit to MahdiBaghbani/reva-opencloud that referenced this pull request Oct 17, 2025
…mmit-id-250912-115056

[tests-only][full-ci] Bump latest ocis commit id on main branch
@MahdiBaghbani

Copy link
Copy Markdown
Author

@micbar @butonic does this look good to you?

@MahdiBaghbani MahdiBaghbani changed the title fix(ocm): OCM Specification Compliance [WiP] fix(ocm): OCM Specification Compliance Oct 21, 2025
@MahdiBaghbani
MahdiBaghbani marked this pull request as draft October 21, 2025 09:56
MahdiBaghbani and others added 2 commits October 22, 2025 06:52
Signed-off-by: Mahdi Baghbani <mahdi-baghbani@azadehafzar.io>
Co-authored-by: Roman Perekhod <2403905@gmail.com>
Signed-off-by: Mahdi Baghbani <mahdi-baghbani@azadehafzar.io>
@MahdiBaghbani

MahdiBaghbani commented Oct 22, 2025 •

Copy link
Copy Markdown
Author

Invite

On OpenCloud 3 (accept receiver, token generator) side:

2025-10-22T07:28:15Z INF added to accepted users host.name=2d7512451245 line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/services/ocmd/invites.go:159 pkg=rhttp request-id=2d7512451245/UUlV5mq6JG-000042 service=ocm token=b932dff7-49f4-4aae-b4c6-c86a889cca4d traceid=30779f56f15127bb8e4e67c1dbb6c48f user=b1f74ec4-dd7e-11ef-a543-03775734d0f7@4.opencloud.cloud.test.azadehafzar.io
2025-10-22T07:28:15Z INF access-log bytes=98 duration=5.399584 line=github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34 method=POST path=/ocm/invite-accepted proto=HTTP/1.1 remote-addr=188.213.192.12 request-id=2d7512451245/UUlV5mq6JG-000041 service=proxy status=200 traceid=1564368e70ee528607992ca40a941ea2

On OpenCloud 4 (invite forwarder, token receiver) side

2025-10-22T07:28:15Z INF skipping auth check for: /sciencemesh/accept-invite host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/interceptors/auth/auth.go:195 pkg=rhttp service=ocm traceid=669817ef3174cc9eb9526538567999b3
2025-10-22T07:28:15Z DBG sciencemesh routing host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/services/sciencemesh/sciencemesh.go:139 path=/accept-invite pkg=rhttp request-id=22f80e02-0bb3-48e3-9398-ed09539d9e35 service=ocm traceid=669817ef3174cc9eb9526538567999b3
2025-10-22T07:28:15Z DBG sciencemesh routing host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/services/sciencemesh/sciencemesh.go:139 path=/accept-invite pkg=rhttp request-id=22f80e02-0bb3-48e3-9398-ed09539d9e35 service=ocm traceid=669817ef3174cc9eb9526538567999b3
2025-10-22T07:28:15Z INF invite forwarded host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/services/sciencemesh/token.go:248 pkg=rhttp provider=3.opencloud.cloud.test.azadehafzar.io request-id=22f80e02-0bb3-48e3-9398-ed09539d9e35 service=ocm token=b932dff7-49f4-4aae-b4c6-c86a889cca4d traceid=669817ef3174cc9eb9526538567999b3
2025-10-22T07:28:15Z DBG http end="22/Oct/2025:07:28:15 +0000" host=127.0.0.1 host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/interceptors/log/log.go:112 method=POST pkg=rhttp proto=HTTP/1.1 service=ocm size=0 start="22/Oct/2025:07:28:15 +0000" status=200 time_ns=194539741 traceid=669817ef3174cc9eb9526538567999b3 uri=/sciencemesh/accept-invite url=/accept-invite

NOTE:

same user to same user sharing fails, since the search bar for external user doesn't show Alan at all

on OpenCloud 3 side:

"accepted_users": {
	"b1f74ec4-dd7e-11ef-a543-03775734d0f7": [
		{
			"id": {
				"idp": "4.opencloud.cloud.test.azadehafzar.io",
				"opaque_id": "b1f74ec4-dd7e-11ef-a543-03775734d0f7",
				"type": 6
			},
			"mail": "alan@example.org",
			"display_name": "Alan Turing"
		},
		{
			"id": {
				"idp": "4.opencloud.cloud.test.azadehafzar.io",
				"opaque_id": "848221b4-08a2-4155-958a-891b840a36c8",
				"type": 6
			},
			"mail": "mahdi@azadehafzar.io",
			"display_name": "Mahdi Baghbani"
		}
	]
}

I suspect the search isn't showing the "other" Alan because of "opaque_id": "b1f74ec4-dd7e-11ef-a543-03775734d0f7" = "b1f74ec4-dd7e-11ef-a543-03775734d0f7"

Share

On OpenCloud 3 (share sender) side:

2025-10-22T07:45:26Z DBG Sending OCM /shares POST to https://4.opencloud.cloud.test.azadehafzar.io/ocm/shares: 
{
  "shareWith": "848221b4-08a2-4155-958a-891b840a36c8@4.opencloud.cloud.test.azadehafzar.io",
  "name": "op-to-op-diff-user.txt",
  "description": "",
  "providerId": "redact",
  "owner": "b1f74ec4-dd7e-11ef-a543-03775734d0f7@https://3.opencloud.cloud.test.azadehafzar.io@3.opencloud.cloud.test.azadehafzar.io",
  "sender": "b1f74ec4-dd7e-11ef-a543-03775734d0f7@https://3.opencloud.cloud.test.azadehafzar.io@3.opencloud.cloud.test.azadehafzar.io",
  "ownerDisplayName": "",
  "senderDisplayName": "Alan Turing",
  "shareType": "user",
  "expiration": 0,
  "resourceType": "file",
  "protocol": {
    "name": "multi",
    "options": {},
    "webdav": {
      "sharedSecret": "redact",
      "permissions": [
        "read"
      ],
      "uri": "https://3.opencloud.cloud.test.azadehafzar.io/dav/ocm/redact"
    }
  }
}

Note:

First thing obvious here is that, if in the invite sequence we used b1f74ec4-dd7e-11ef-a543-03775734d0f7@3.opencloud.cloud.test.azadehafzar.io, then why are we suddenly
using b1f74ec4-dd7e-11ef-a543-03775734d0f7@https://3.opencloud.cloud.test.azadehafzar.io@3.opencloud.cloud.test.azadehafzar.io as owener/sender again?

This is wrong, I think that we should either:

  1. in the invite sequence we should send the uuid@idp@provider
  2. in the reciever side, base64 encode the incoming uuid to prevent it from colliding with existing local uuids (revert back to previous commit)

On OpenCloud 3 (share receiver) side:

2025-10-22T07:45:26Z DBG Determined Mesh Provider '3.opencloud.cloud.test.azadehafzar.io' from req.Sender 'b1f74ec4-dd7e-11ef-a543-03775734d0f7@https://3.opencloud.cloud.test.azadehafzar.io@3.opencloud.cloud.test.azadehafzar.io' host.name=f1a5f0a5ff2a line=github.com/opencloud-eu/reva/v2@v2.39.1-0.20251020192555-e3aa6a7d6d43/internal/http/services/ocmd/shares.go:93 pkg=rhttp request-id=f1a5f0a5ff2a/qLEHbywWPf-000564 service=ocm traceid=f0f2fae658816250fcf5345b694701f4

Note

This is also interesting, the user in the sender field is different from the user established in the invite sequence because (uuid@idp != uuid),
Is there any check for that? since the share is successful, I think there isn't.

UPDATE: No there isn't see code

so it really doesn't matter who the sender is, whether it's a contact or not, as long as provider is authorized, anyone on that provider can send you shares.
Same for oCIS, Reva

Giuseppe:

yes, but that's already down the stream
in the GUI - and in the Reva part that serves the GUI - one cannot select an "unknown" contact
so that scenario can only happen if Alan and Alice are in a Nextcloud site

@MahdiBaghbani

Copy link
Copy Markdown
Author

Invite flow works with CERNBox

"accepted_users": {
    "b1f74ec4-dd7e-11ef-a543-03775734d0f7": [
        {
            "id": {
                "idp": "qa.cernbox.cern.ch",
                "opaque_id": "lopresti",
                "type": 6
            },
            "mail": "giuseppe.lopresti@cern.ch",
            "display_name": "Giuseppe Lo Presti"
        }
    ]
}

Sharing to/from CERNBox is working on my OpenCloud:

Screenshot 2025-10-22 122005

@butonic butonic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I need to set this up and verify this live, but the PR looks solid. the base64 encoding was a hack to make sure we could differentiate the users. I'm ok with making the idp part of the opaqueid for federated users and then using the provider id as idp ... maybe a little confusing.

Do you plan to work further on this PR? if not put it on ready and I'll review it further!

Comment thread pkg/ocm/user/user.go Resolved
@butonic butonic self-assigned this Nov 13, 2025
@fschade

fschade commented Nov 24, 2025

Copy link
Copy Markdown
Member

@MahdiBaghbani is that pr ready for review?

@MahdiBaghbani

Copy link
Copy Markdown
Author

Sorry,I've been doing work on CERNBox Reva,
I'll wrap this up for next week and mark it ready

@fschade

fschade commented Nov 24, 2025

Copy link
Copy Markdown
Member

@MahdiBaghbani thanks, will you also have a look into the tests? CI fails.

we plan to have a release this week, if you find some time before end of week it will be part of it.

THX

@dragonchaser

Copy link
Copy Markdown
Member

ocm_invitation_test.go, Line 222:

					Expect(utils.UserEqual(forwardRes.UserId, federatedEinstein.Id)).To(BeTrue())

forwardRes.UserId == 4c510ada-c86b-4815-8820-42cdf82c3d51
federatedEinstein.Id == 4c510ada-c86b-4815-8820-42cdf82c3d51@cernbox.cern.ch

This looks a bit off to me.... Is this behaviour expected and the test needs fixing, or is the behaviour wrong?

@dragonchaser dragonchaser mentioned this pull request Nov 26, 2025
3 of 6 tasks
@dragonchaser

dragonchaser commented Nov 26, 2025 •

Copy link
Copy Markdown
Member

superseded by #434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCloud cannot receive OCM shares from other EFSS

4 participants