Skip to content

[Bug]: activity ids on outbox change on every request.Β #6341

@lullis

Description

@lullis

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Do you agree to follow the rules in our Code of Conduct?
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

As discussed on the Lemmy dev group: If the ids of the activity objects change on every request, then it's virtually impossible for clients to pull data from the outbox in a reliable manner.

Steps to Reproduce

  1. make multiple requests to any community outbox, using 'application/ld+json' as the accept header.
  2. Verify that the ids of the activities (create/announce/like) change on every request.

Technical Details

The solution to fix is to use a deterministic function to generate the id, instead of the random UUIDs that are being currently provided. I'd suggest a hash of ":".

Example using md5 as the hash function to generate the ids of Announce and Create for an object https://lemmy.example.com/post/123

Create activity: md5("create:https://lemmy.example.com/post/123") -> 911ab771355e05ef91ca61dd4e9460f1 -> ap id -> https://lemmy.example.com/activities/create/911ab771-355e-05ef-91ca-61dd4e9460f1

Announce: "md5("announce:https://lemmy.example.com/activities/create/911ab771-355e-05ef-91ca-61dd4e9460f1") -> 8993d7d8484786c0960e9e169a756a82 -> ap id: https://lemmy.example.com/activities/announce/create/8993d7d8-4847-86c0-960e-9e169a756a82.

Given that these are not cryptographic hashes, you can even use a faster hash function like murmur3. murmur3 also generates 128 bits digests, which means that you can format it like an UUID and there would be no difference in the URL format.

Version

0.19.15

Lemmy Instance URL

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions