Skip to content

fix(signed-request): trigger metadata insert with default value manually - #49646

Merged
ArtificialOwl merged 5 commits into
masterfrom
fix/noid/trigger-field-insert
Dec 5, 2024
Merged

fix(signed-request): trigger metadata insert with default value manually#49646
ArtificialOwl merged 5 commits into
masterfrom
fix/noid/trigger-field-insert

Conversation

@ArtificialOwl

@ArtificialOwlArtificialOwl commented Dec 4, 2024

Copy link
Copy Markdown
Member

@ArtificialOwlArtificialOwl added the 3. to review Waiting for reviews label Dec 4, 2024
@ArtificialOwlArtificialOwl added this to the Nextcloud 31 milestone Dec 4, 2024

@nickvergessennickvergessen 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.

But afterwards Talk's federation still does not work:

{
"app": "cloud_federation_api",
"signedRequest": "{\"[object] (OC\\Security\\Signature\\Model\\IncomingSignedRequest)\":{\"OC\\Security\\Signature\\Model\\SignedRequestdigest\":\"SHA-512=b1AhhRfCp1RCUaJm8a/ySVFEskKDiNDuZ5eORQ8xBuBXTMsFd38HCiLe2i3/oS8z3Cmk/e+l8MLXhuVfb8cxYg==\",\"OC\\Security\\Signature\\Model\\SignedRequestdigestAlgorithm\":{\"[object] (NCU\\Security\\Signature\\Enum\\DigestAlgorithm)\":{\"name\":\"SHA512\",\"value\":\"SHA-512\"}},\"OC\\Security\\Signature\\Model\\SignedRequestsigningElements\":{\"keyId\":\"https://localhost:8080/ocm#signature\",\"algorithm\":\"rsa-sha512\",\"headers\":\"(request-target) content-length date digest host\",\"signature\":\"NYz59rpWnZPfU9E8FU/SGVl2irIkduB6gQ1mPyBbgSn52fuSJ4PRveAOcSIXNJ/wnfJQh1VVCCBUmG0mduRSy4I9/jC4+oAf603ji1564cabQqEHauX35YW8gInwP0ygRJogFaXUa5K1e/TNXbbWw7gQZbSpKCxnBKsbc27CRKBYeRETYAVvggTs4DqO9Wp3MyR+CORGw7UqbfHpWIux45HAAR1Dv969vVrNRXNlienzlKXyos68Yj6xLg4gAy8FZZmDKxx/k/Gg5VAK7aPvBw+x60mY5XZA/Y+TDUJBbB+BEdBFOqXIzVq4hITMx0E+EBSYI1earhit1Bk0X0HSuQ==\"},\"OC\\Security\\Signature\\Model\\SignedRequestsignatureData\":[\"(request-target): post /index.php/ocm/notifications\",\"content-length: 941\",\"date: Wed, 04 Dec 2024 14:28:45 GMT\",\"digest: SHA-512=b1AhhRfCp1RCUaJm8a/ySVFEskKDiNDuZ5eORQ8xBuBXTMsFd38HCiLe2i3/oS8z3Cmk/e+l8MLXhuVfb8cxYg==\",\"host: localhost:8180\"],\"OC\\Security\\Signature\\Model\\SignedRequestsignature\":\"NYz59rpWnZPfU9E8FU/SGVl2irIkduB6gQ1mPyBbgSn52fuSJ4PRveAOcSIXNJ/wnfJQh1VVCCBUmG0mduRSy4I9/jC4+oAf603ji1564cabQqEHauX35YW8gInwP0ygRJogFaXUa5K1e/TNXbbWw7gQZbSpKCxnBKsbc27CRKBYeRETYAVvggTs4DqO9Wp3MyR+CORGw7UqbfHpWIux45HAAR1Dv969vVrNRXNlienzlKXyos68Yj6xLg4gAy8FZZmDKxx/k/Gg5VAK7aPvBw+x60mY5XZA/Y+TDUJBbB+BEdBFOqXIzVq4hITMx0E+EBSYI1earhit1Bk0X0HSuQ==\",\"OC\\Security\\Signature\\Model\\SignedRequestsignatory\":{\"[object] (NCU\\Security\\Signature\\Model\\Signatory)\":{\"id\":1,\"OCP\\AppFramework\\Db\\Entity_updatedFields\":[],\"OCP\\AppFramework\\Db\\Entity_fieldTypes\":[],\"*keyId\":\"https://localhost:8080/ocm#signature\",\"*keyIdSum\":\"49c06bce5548b0815c97f6b11e49d467b9c7104059c5dd9843d6eed14de39092\",\"*providerId\":\"ocm\",\"*host\":\"localhost:8080\",\"*publicKey\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2pFpYl02ZVrpuzRHisM1\\nLYWFhysy16frEX63t69uFO683wpjcVv55A3VN4eeVr86YFIypu+BkYVlN2xBu6ba\\niOjJ+deN1GtPzz58KGxDI4zQdQ9iHhIOqCNw1Qio2lTuYY6FdQL2AC6kGLdp+qO8\\nl0rIvsjHwRhj4dFlX4fJg4JW7MDe3uRnlRMpgxyxb7Zn8qWWGcBn2dCXiyBxrUk9\\nRRHmNJY6Y2qYyksSYZr9z2drIiR5KjTkZMvMN+pHlj5E7CVcm2XjDGOCDd5e9QbQ\\nUKiG3BWpq6V30BOyPBmuhv2qTbLRcrmCBWWLUuT5/8uuqbo5wBn2Naf6ntSarBQa\\n3wIDAQAB\\n-----END PUBLIC KEY-----\\n\",\"*privateKey\":\"\",\"*account\":\"\",\"*type\":8,\"*status\":0,\"*metadata\":[],\"*creation\":1733322331,\"*lastUpdated\":1733322331,\"NCU\\Security\\Signature\\Model\\Signatorylocal\":false}},\"OC\\Security\\Signature\\Model\\SignedRequestbody\":\"{\\\"notificationType\\\":\\\"MESSAGE_POSTED\\\",\\\"resourceType\\\":\\\"talk-room\\\",\\\"providerId\\\":\\\"133\\\",\\\"notification\\\":{\\\"remoteServerUrl\\\":\\\"http:\\/\\/localhost:8080\\\",\\\"sharedSecret\\\":\\\"oXoNtRdLHDazjC6gMadPzRctMD5mJJgRSoEQPkJzbAimbKYcjHSTFsLeNynbYQzd\\\",\\\"remoteToken\\\":\\\"sqitskb8\\\",\\\"messageData\\\":{\\\"remoteMessageId\\\":1217,\\\"actorType\\\":\\\"users\\\",\\\"actorId\\\":\\\"participant1\\\",\\\"actorDisplayName\\\":\\\"participant1-displayname\\\",\\\"messageType\\\":\\\"system\\\",\\\"systemMessage\\\":\\\"federated_user_added\\\",\\\"expirationDatetime\\\":\\\"\\\",\\\"message\\\":\\\"{actor} invited {federated_user}\\\",\\\"messageParameter\\\":\\\"{\\\\\"actor\\\\\":{\\\\\"type\\\\\":\\\\\"user\\\\\",\\\\\"id\\\\\":\\\\\"participant1\\\\\",\\\\\"name\\\\\":\\\\\"participant1-displayname\\\\\"},\\\\\"federated_user\\\\\":{\\\\\"type\\\\\":\\\\\"user\\\\\",\\\\\"id\\\\\":\\\\\"participant2\\\\\",\\\\\"name\\\\\":\\\\\"participant2-displayname\\\\\",\\\\\"server\\\\\":\\\\\"http:\\\\\\/\\\\\\/localhost:8180\\\\\"}}\\\",\\\"creationDatetime\\\":\\\"2024-12-04T14:28:45+00:00\\\",\\\"metaData\\\":\\\"[]\\\"},\\\"unreadInfo\\\":{\\\"lastReadMessage\\\":1216,\\\"unreadMessages\\\":0,\\\"unreadMention\\\":false,\\\"unreadMentionDirect\\\":false}}}\",\"OC\\Security\\Signature\\Model\\IncomingSignedRequestorigin\":\"localhost:8080\",\"OC\\Security\\Signature\\Model\\IncomingSignedRequestrequest\":{\"[object] (OC\\AppFramework\\Http\\Request)\":{\"*inputStream\":\"php://input\",\"*content\":null,\"*items\":[],\"*allowedKeys\":[],\"*requestId\":\"[object] (OC\\AppFramework\\Http\\RequestId)\",\"*config\":\"[object] (OC\\AllConfig)\",\"*csrfTokenManager\":\"[object] (OC\\Security\\CSRF\\CsrfTokenManager)\",\"*contentDecoded\":true}},\"OC\\Security\\Signature\\Model\\IncomingSignedRequestoptions\":{\"algorithm\":{\"[object] (NCU\\Security\\Signature\\Enum\\SignatureAlgorithm)\":[]},\"digestAlgorithm\":{\"[object] (NCU\\Security\\Signature\\Enum\\DigestAlgorithm)\":[]},\"extraSignatureHeaders\":[],\"ttl\":300,\"dateHeader\":\"D, d M Y H:i:s T\",\"ttlSignatory\":259200,\"bodyMaxSize\":50000}}}",
"message": "signed request available"
}
[Wed Dec 4 15:31:40 2024] {"app":"spreed","message":"Failed to send notification for share from http:\/\/localhost:8080, received status code 503\n<!DOCTYPE html>\n<html class=\"ng-csp\" data-placeholder-focus=\"false\" lang=\"en\" data-locale=\"en\" translate=\"no\" >\n\t<head\n data-requesttoken=\"\">\n\t\t<meta charset=\"utf-8\">\n\t\t<title>\n\t\t\tNextcloud 31\t\t<\/title>\n\t\t<meta name=\"csp-nonce\" nonce=\"mc2uDNMK\/yODm6aUFlTrgsQHPSE4OG3KCHF7g2k8qTw=\">\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, minimum-scale=1.0\">\n\t\t\t\t<meta name=\"apple-itunes-app\" content=\"app-id=1125420102\">\n\t\t\t\t<meta name=\"theme-color\" content=\"#26A269\">\n\t\t<link rel=\"icon\" href=\"\/index.php\/apps\/theming\/favicon?v=602ebaab\">\n\t\t<link rel=\"apple-touch-icon\" href=\"\/index.php\/apps\/theming\/icon?v=602ebaab\">\n\t\t<link rel=\"mask-icon\" sizes=\"any\" href=\"\/core\/img\/favicon-mask.svg\" color=\"#26A269\">\n\t\t<link rel=\"manifest\" href=\"\/index.php\/apps\/theming\/manifest?v=602ebaab\" crossorigin=\"use-credentials\">\n\t\t<link rel=\"stylesheet\" href=\"\/core\/css\/server.css\">\n<link rel=\"stylesheet\" href=\"\/apps\/theming\/css\/default.css\">\n<link rel=\"stylesheet\" href=\"\/core\/css\/guest.css\">\n\t\t<script nonce=\"mc2uDNMK\/yODm6aUFlTrgsQHPSE4OG3KCHF7g2k8qTw=\" defer src=\"\/dist\/core-common.js\"><\/script>\n<script nonce=\"mc2uDNMK\/yODm6aUFlTrgsQHPSE4OG3KCHF7g2k8qTw=\" defer src=\"\/dist\/core-main.js\"><\/script>\n<script nonce=\"mc2uDNMK\/yODm6aUFlTrgsQHPSE4OG3KCHF7g2k8qTw=\" defer src=\"\/apps\/theming\/js\/theming.js\"><\/script>\n<script nonce=\"mc2uDNMK\/yODm6aUFlTrgsQHPSE4OG3KCHF7g2k8qTw=\" defer src=\"\/dist\/files_sharing-main.js\"><\/script>\n\t\t<link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/default.css?plain=1&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"(prefers-color-scheme: light)\" href=\"\/index.php\/apps\/theming\/theme\/light.css?plain=1&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"(prefers-color-scheme: dark)\" href=\"\/index.php\/apps\/theming\/theme\/dark.css?plain=1&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"(prefers-contrast: more)\" href=\"\/index.php\/apps\/theming\/theme\/light-highcontrast.css?plain=1&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"(prefers-color-scheme: dark) and (prefers-contrast: more)\" href=\"\/index.php\/apps\/theming\/theme\/dark-highcontrast.css?plain=1&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/light.css?plain=0&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/dark.css?plain=0&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/light-highcontrast.css?plain=0&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/dark-highcontrast.css?plain=0&amp;v=602ebaab\" class=\"theme\"\/><link rel=\"stylesheet\" media=\"\" href=\"\/index.php\/apps\/theming\/theme\/opendyslexic.css?plain=0&amp;v=602ebaab\" class=\"theme\"\/><meta name=\"color-scheme\" content=\"light dark\"\/>\t<\/head>\n\t<body id=\"body-login\">\n\t\t<noscript>\n\t<div id=\"nojavascript\">\n\t\t<div>\n\t\t\tThis application requires JavaScript for correct operation. Please <a href=\"https:\/\/www.enable-javascript.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">enable JavaScript<\/a> and reload the page.\t\t<\/div>\n\t<\/div>\n<\/noscript>\n\t\t<div id=\"initial-state-container\" style=\"display: none;\">\n\t\t\t<input type=\"hidden\" id=\"initial-state-core-versionHash\" value=\"ImM1ZjNjZjc0Ig==\">\n\t\t\t<input type=\"hidden\" id=\"initial-state-theming-data\" value=\"eyJuYW1lIjoiTmV4dGNsb3VkIDMxIiwic2xvZ2FuIjoiYSBzYWZlIGhvbWUgZm9yIGFsbCB5b3VyIGRhdGEiLCJ1cmwiOiJodHRwczpcL1wvbmV4dGNsb3VkLmNvbSIsImltcHJpbnRVcmwiOiIiLCJwcml2YWN5VXJsIjoiIiwicHJpbWFyeUNvbG9yIjoiIzI2QTI2OSIsImJhY2tncm91bmRDb2xvciI6IiMwMDY3OWUiLCJkZWZhdWx0UHJpbWFyeUNvbG9yIjoiIzI2QTI2OSIsImRlZmF1bHRCYWNrZ3JvdW5kQ29sb3IiOiIjMDA2NzllIiwiaW52ZXJ0ZWQiOnRydWUsImNhY2hlQnVzdGVyIjoiNjAyZWJhYWIiLCJlbmFibGVkVGhlbWVzIjpbXSwiY29sb3IiOiIjMjZBMjY5IiwiIjoiY29sb3IgaXMgZGVwcmVjYXRlZCBzaW5jZSBOZXh0Y2xvdWQgMjksIHVzZSBwcmltYXJ5Q29sb3IgaW5zdGVhZCJ9\">\n\t\t\t<input type=\"hidden\" id=\"initial-state-comments-maxAutoCompleteResults\" value=\"MTA=\">\n\t<\/div>\n\t\t<div class=\"wrapper\">\n\t\t\t<div class=\"v-align\">\n\t\t\t\t\t\t\t\t\t<header>\n\t\t\t\t\t\t<div id=\"header\">\n\t\t\t\t\t\t\t<div class=\"logo\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/header>\n\t\t\t\t\t\t\t\t<main>\n\t\t\t\t\t<h1 class=\"hidden-visually\">\n\t\t\t\t\t\tNextcloud 31\t\t\t\t\t<\/h1>\n\t\t\t\t\t<div class=\"guest-box\">\n\t<h2>Error<\/h2>\n\t<ul>\n\t\t\t<li>\n\t\t\t<p>Share not found<\/p>\n\t\t\t\t\t\t\t<p class='hint'>Could not find share<\/p>\n\t\t\t\t\t<\/li>\n\t\t<\/ul>\n<\/div>\n\t\t\t\t<\/main>\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<fo

Comment threadlib/private/Security/Signature/SignatureManager.php Outdated
Comment threadlib/public/Federation/ICloudFederationProvider.php Outdated
Comment threadlib/public/Federation/ICloudFederationProvider.php Outdated
@ArtificialOwl
ArtificialOwlforce-pushed the fix/noid/trigger-field-insert branch 2 times, most recently from 51bc7d0 to 4808f12CompareDecember 5, 2024 13:46
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl
ArtificialOwlforce-pushed the fix/noid/trigger-field-insert branch from afd4b30 to 4e5e0c9CompareDecember 5, 2024 14:18
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl
ArtificialOwlforce-pushed the fix/noid/trigger-field-insert branch from 4e5e0c9 to ac47018CompareDecember 5, 2024 15:51
Comment threadapps/cloud_federation_api/lib/Controller/RequestHandlerController.php Outdated
Signed-off-by: Joas Schilling <coding@schilljs.com>
@@ -59,7 +59,7 @@ class Signatory extends Entity implements JsonSerializable {
protected string $account = '';

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.

Account is a nullable column which seems to cause issues on oracle:

#45979 (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.

Not blocking so talk tests can go green again, but this is probably something to follow up

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.

It was actually breaking Oracle as it turned out :D
#49750

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
…xtcloud/server into fix/noid/trigger-field-insert
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl

Copy link
Copy Markdown
MemberAuthor

ok, resharing works fine, mergeable.

I'll have a look to that nullable account

@ArtificialOwl
ArtificialOwl merged commit 66e09eb into masterDec 5, 2024
@ArtificialOwl
ArtificialOwl deleted the fix/noid/trigger-field-insert branch December 5, 2024 22:35
): string {
$provider = $this->shareProviderFactory->getProviderForType(IShare::TYPE_REMOTE);
try {
$share = $provider->getShareByToken($sharedSecret);

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.

If we're in the recipient side, this will return null as the share is in share_external and not share

{
"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"
}
}

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.

Fix incoming

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.

5 participants

@ArtificialOwl@nickvergessen@AndyScherzinger@juliusknorr@skjnldsv