Skip to content

fix(federatedfilesharing): get share by token fallback - #49974

Merged
skjnldsv merged 2 commits into
masterfrom
backport/49973/master
Jan 2, 2025
Merged

fix(federatedfilesharing): get share by token fallback#49974
skjnldsv merged 2 commits into
masterfrom
backport/49973/master

Conversation

@backportbot

@backportbotbackportbotBot commented Dec 26, 2024

Copy link
Copy Markdown

Regression from #49646

Reproducing the issue

  • Create a federated share
  • See the share on receiving server
  • Remove the share on emitter server
  • See error on both server: entry does not contains @.

Explanations

The code check for the FederatedShareProvider, which have its shares into oc_share.
But on the receiving end, which the ocm notification gets sent, there is no shares in this table.
They're just external shares from the oc_share_external, so we need to fetch and check them too

Error

{
"reqId": "t4wJRkGxiWXx6g1uJn4Q",
"level": 2,
"time": "2024-12-26T12:34:55+00:00",
"remoteAddr": "172.21.0.2",
"user": false,
"app": "cloud_federation_api",
"method": "POST",
"url": "/index.php/ocm/notifications",
"message": "incoming request exception",
"userAgent": "Nextcloud Server Crawler",
"version": "31.0.0.6",
"exception": {
"Exception": "NCU\\Security\\Signature\\Exceptions\\IncomingRequestException",
"Message": "entry does not contains @",
"Code": 0,
"Trace": [
{
"file": "/var/www/html/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php",
"line": 435,
"function": "getHostFromFederationId",
"class": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController",
"type": "->",
"args": [
""
]
},
{
"file": "/var/www/html/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php",
"line": 423,
"function": "confirmNotificationEntry",
"class": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController",
"type": "->",
"args": [
{
"__class__": "OC\\Security\\Signature\\Model\\IncomingSignedRequest"
},
""
]
},
{
"file": "/var/www/html/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php",
"line": 254,
"function": "confirmNotificationIdentity",
"class": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController",
"type": "->",
"args": [
{
"__class__": "OC\\Security\\Signature\\Model\\IncomingSignedRequest"
},
"file",
{
"sharedSecret": "la0KxWqDj08lrUZ",
"message": "file is no longer shared with you"
}
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 200,
"function": "receiveNotification",
"class": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController",
"type": "->",
"args": [
"SHARE_UNSHARED",
"file",
"30",
{
"sharedSecret": "la0KxWqDj08lrUZ",
"message": "file is no longer shared with you"
}
]
},
{
"file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line": 114,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
{
"__class__": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController"
},
"receiveNotification"
]
},
{
"file": "/var/www/html/lib/private/AppFramework/App.php",
"line": 161,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->",
"args": [
{
"__class__": "OCA\\CloudFederationAPI\\Controller\\RequestHandlerController"
},
"receiveNotification"
]
},
{
"file": "/var/www/html/lib/private/Route/Router.php",
"line": 306,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::",
"args": [
"OCA\\CloudFederationAPI\\Controller\\RequestHandlerController",
"receiveNotification",
{
"__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
},
{
"_route": "cloud_federation_api.requesthandler.receivenotification"
}
]
},
{
"file": "/var/www/html/lib/base.php",
"line": 1019,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->",
"args": [
"/ocm/notifications"
]
},
{
"file": "/var/www/html/index.php",
"line": 24,
"function": "handleRequest",
"class": "OC",
"type": "::",
"args": []
}
],
"File": "/var/www/html/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php",
"Line": 455,
"message": "incoming request exception",
"exception": {},
"CustomMessage": "incoming request exception"
}
}

@backportbot
backportbotBot requested a review from skjnldsvDecember 26, 2024 12:52
@skjnldsv
skjnldsvforce-pushed the backport/49973/master branch from 31ddd97 to 9664124CompareDecember 26, 2024 13:02
@skjnldsvskjnldsv changed the title [master] feat(federation): auto-accept shares from trusted serversfeat(federation): auto-accept shares from trusted serversDec 26, 2024
@skjnldsvskjnldsv changed the title feat(federation): auto-accept shares from trusted serversfix(federatedfilesharing): get share by token fallbackDec 26, 2024
@skjnldsv

skjnldsv commented Dec 26, 2024

Copy link
Copy Markdown
Member

/backport 895a939 to stable30

@skjnldsv

skjnldsv commented Dec 26, 2024

Copy link
Copy Markdown
Member

/backport 895a939 to stable29

@skjnldsvskjnldsv added this to the Nextcloud 31 milestone Dec 26, 2024
@skjnldsv
skjnldsvforce-pushed the backport/49973/master branch 3 times, most recently from bc0109d to 1d4cadbCompareDecember 26, 2024 15:11
@skjnldsv
skjnldsvforce-pushed the backport/49973/master branch from 1d4cadb to a710e0cCompareDecember 27, 2024 09:08
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv
skjnldsvforce-pushed the backport/49973/master branch from a710e0c to bc0ad5eCompareDecember 28, 2024 08:27
@skjnldsv

Copy link
Copy Markdown
Member

Cypress runner 2 failure is unrelated, this test is flaky. I'll try to fix it on master

@skjnldsv
skjnldsv requested a review from nfebeJanuary 2, 2025 10:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@skjnldsv@yemkareems