URL normalization causes ActivityPub IDs to mismatch
What happened?
Under rare circumstances, a remote instance may use ActivityPub IDs that are note "quite" valid URIs. They can be parsed correctly and are otherwise valid under the specification, but JavaScript's URL
constructor will automatically normalize the inputs. This has the result of causing new URL(href).href !== href
, which breaks our strict-equality ID comparisons. As an example, https://QuarteredCircle.net/@LexPendragon/113522127842694189
gets normalized to https://quarteredcircle.net/users/LexPendragon/statuses/113522127842694189
(lower-case domain name).
What did you expect to happen?
ActivityPub IDs should be preserved verbatim, as per the ActivityPub spec.
Version
2024.10.0-dev
Instance
enby.life
What type of issue is this? (If this happens on your device and has to do with the user interface, it's client-side. If this happens on either with the API or the backend, or you got a server-side error in the client, it's server-side.)
backend
How do you deploy Sharkey on your server? (Server-side issues only)
Build from source
What operating system are you using? (Server-side issues only)
Ubuntu Server 22.04
Relevant log output
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: stack: UnrecoverableError: bad Activity: neither id(https://pixelfed.uno/users/Pezzini/followers?%2Fusers%2FPezzini%2Ffollowers=) nor url(undefined) match location(https://pixelfed.uno/users/Pezzini/followers,https://pixelfed.uno/users/Pezzini/followers)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at assertActivityMatchesUrls (file:///home/calckey/calckey/packages/backend/built/core/activitypub/misc/check-against-url.js:22:11)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at ApRequestService.signedGet (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApRequestService.js:218:9)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async Resolver.resolve (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApResolverService.js:110:36)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async Resolver.resolveCollection (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApResolverService.js:74:56)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApPersonService.isPublicCollection (file:///home/calckey/calckey/packages/backend/built/core/activitypub/models/ApPersonService.js:655:30)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async Promise.all (index 1)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApPersonService.createPerson (file:///home/calckey/calckey/packages/backend/built/core/activitypub/models/ApPersonService.js:258:60)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApPersonService.resolvePerson (file:///home/calckey/calckey/packages/backend/built/core/activitypub/models/ApPersonService.js:558:16)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApNoteService.createNote (file:///home/calckey/calckey/packages/backend/built/core/activitypub/models/ApNoteService.js:179:38)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApNoteService.resolveNote (file:///home/calckey/calckey/packages/backend/built/core/activitypub/models/ApNoteService.js:530:20)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApInboxService.announceNote (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApInboxService.js:301:26)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApInboxService.announce (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApInboxService.js:281:36)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApInboxService.performOneActivity (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApInboxService.js:170:20)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async ApInboxService.performActivity (file:///home/calckey/calckey/packages/backend/built/core/activitypub/ApInboxService.js:139:22)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async InboxProcessorService.process (file:///home/calckey/calckey/packages/backend/built/queue/processors/InboxProcessorService.js:194:28)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async Worker.processJob (/home/calckey/calckey/node_modules/.pnpm/bullmq@5.13.2/node_modules/bullmq/dist/cjs/classes/worker.js:455:28)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: at async Worker.retryIfFailed (/home/calckey/calckey/node_modules/.pnpm/bullmq@5.13.2/node_modules/bullmq/dist/cjs/classes/worker.js:640:24)
Nov 09 23:31:16 vps-426b63f4 "enby.life@worker"[3126410]: }
Contribution Guidelines By submitting this issue, you agree to follow our Contribution Guidelines
- I agree to follow this project's Contribution Guidelines
- I have searched the issue tracker for similar issues, and this is not a duplicate.