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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

/backport 9664124 to stable30

@skjnldsv
Copy link
Member

skjnldsv commented Dec 26, 2024

/backport bc0109d to stable29

@skjnldsv skjnldsv force-pushed the backport/49973/master branch from a710e0c to bc0ad5e Compare December 28, 2024 08:27
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.

1 participant