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

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

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Dec 26, 2024

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 backportbot bot requested a review from skjnldsv December 26, 2024 12:52
@skjnldsv skjnldsv force-pushed the backport/49973/master branch from 31ddd97 to 9664124 Compare December 26, 2024 13:02
@skjnldsv skjnldsv changed the title [master] feat(federation): auto-accept shares from trusted servers feat(federation): auto-accept shares from trusted servers Dec 26, 2024
@skjnldsv skjnldsv changed the title feat(federation): auto-accept shares from trusted servers fix(federatedfilesharing): get share by token fallback Dec 26, 2024
@skjnldsv
Copy link
Member

skjnldsv commented Dec 26, 2024

/backport 895a939 to stable30

@skjnldsv
Copy link
Member

skjnldsv commented Dec 26, 2024

/backport 895a939 to stable29

@skjnldsv skjnldsv requested review from ArtificialOwl, provokateurin and a team December 26, 2024 13:05
@skjnldsv skjnldsv added this to the Nextcloud 31 milestone Dec 26, 2024
@skjnldsv skjnldsv force-pushed the backport/49973/master branch 3 times, most recently from bc0109d to 1d4cadb Compare December 26, 2024 15:11
@skjnldsv skjnldsv force-pushed the backport/49973/master branch from 1d4cadb to a710e0c Compare December 27, 2024 09:08
@skjnldsv skjnldsv force-pushed the backport/49973/master branch from a710e0c to bc0ad5e Compare December 28, 2024 08:27
@skjnldsv
Copy link
Member

skjnldsv commented Jan 2, 2025

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

@skjnldsv skjnldsv requested a review from nfebe January 2, 2025 10:35
@skjnldsv skjnldsv requested a review from yemkareems January 2, 2025 10:35
@skjnldsv skjnldsv merged commit d4ce307 into master Jan 2, 2025
186 of 188 checks passed
@skjnldsv skjnldsv deleted the backport/49973/master branch January 2, 2025 10:50
@skjnldsv skjnldsv mentioned this pull request Jan 7, 2025
Sign up for free to 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