Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
We Distribute
  1. Home
  2. Technical Discussion
  3. Returning objects in a collection vs. IDs

Returning objects in a collection vs. IDs

Scheduled Pinned Locked Moved Technical Discussion
f228fepactivitypub
27 Posts 6 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • silverpill@mitra.socialS silverpill@mitra.social

    @grishka I am developing a client application where this is a real concern.
    But I agree that in general, originating servers are responsible for verification of client data. This part of FEP-fe34 will likely be revised in the future.

    mariusor@metalhead.clubM This user is from outside of this forum
    mariusor@metalhead.clubM This user is from outside of this forum
    mariusor@metalhead.club
    wrote on last edited by
    #21

    @silverpill do you mean that the "malicious" attachment is not a facsimile of an actual note produced by that actor, but a forgery?

    In these cases, I'll agree with
    @grishka that some validation based on the ID should be necessary.

    For embedded object attachments on the other hand (like mastodon produces), probably the validation needs to check that attributedTo corresponds to the one of the parent object or missing.

    Interesting corner case.

    @technical-discussion

    silverpill@mitra.socialS 1 Reply Last reply
    0
    • mariusor@metalhead.clubM mariusor@metalhead.club

      @silverpill do you mean that the "malicious" attachment is not a facsimile of an actual note produced by that actor, but a forgery?

      In these cases, I'll agree with
      @grishka that some validation based on the ID should be necessary.

      For embedded object attachments on the other hand (like mastodon produces), probably the validation needs to check that attributedTo corresponds to the one of the parent object or missing.

      Interesting corner case.

      @technical-discussion

      silverpill@mitra.socialS This user is from outside of this forum
      silverpill@mitra.socialS This user is from outside of this forum
      silverpill@mitra.social
      wrote on last edited by
      #22

      @mariusor Yes, a forged note. I've come up with a more realistic example:

      {
        "type": "Create",
        "id": "https://social.example/activity/345",
        "actor": "https://social.example/alice"
        "object": {
          "type": "Note",
          "id": "https://social.example/note/123",
          "attributedTo": "https://social.example/alice",
          "content": "This is just a note, nothing to see here",
          "replies": {
            "type": "Collection",
            "id": "https://social.example/note/123/replies",
            "items": [{
              "type": Note",
              "id": "https://social.example/note/987",
              "attributedTo": "https://social.example/bob",
              "inReplyTo": "https://social.example/note/123",
              "content": "Ha ha ha... Yes!"
            }]
          }
        }
      }
      

      If the originating server doesn't check the embedded replies collection, a recipient that processes replies and trusts same-origin embeddings unconditionally may end up trusting the forged note.

      What we can do?

      - Sender: find all embedded objects with local id and reject activity if they are not known.
      - Recipient: trust embedded object only if the wrapping object has the same owner.

      I think the second solution is much easier to implement. It reduces the utility of embedding in the use case described by @julian, but to be honest I doubt that embedding significantly reduces the number of required HTTP requests in that case.

      @grishka

      mariusor@metalhead.clubM 1 Reply Last reply
      0
      • silverpill@mitra.socialS silverpill@mitra.social

        @mariusor Yes, a forged note. I've come up with a more realistic example:

        {
          "type": "Create",
          "id": "https://social.example/activity/345",
          "actor": "https://social.example/alice"
          "object": {
            "type": "Note",
            "id": "https://social.example/note/123",
            "attributedTo": "https://social.example/alice",
            "content": "This is just a note, nothing to see here",
            "replies": {
              "type": "Collection",
              "id": "https://social.example/note/123/replies",
              "items": [{
                "type": Note",
                "id": "https://social.example/note/987",
                "attributedTo": "https://social.example/bob",
                "inReplyTo": "https://social.example/note/123",
                "content": "Ha ha ha... Yes!"
              }]
            }
          }
        }
        

        If the originating server doesn't check the embedded replies collection, a recipient that processes replies and trusts same-origin embeddings unconditionally may end up trusting the forged note.

        What we can do?

        - Sender: find all embedded objects with local id and reject activity if they are not known.
        - Recipient: trust embedded object only if the wrapping object has the same owner.

        I think the second solution is much easier to implement. It reduces the utility of embedding in the use case described by @julian, but to be honest I doubt that embedding significantly reduces the number of required HTTP requests in that case.

        @grishka

        mariusor@metalhead.clubM This user is from outside of this forum
        mariusor@metalhead.clubM This user is from outside of this forum
        mariusor@metalhead.club
        wrote on last edited by
        #23

        > - Recipient: trust embedded object only if the wrapping object has the same owner.

        @silverpill no, dereference object and use that instead. The canonical version of an object is the one retrieved from the originating service.

        Mastodon has popularised this behaviour where embedding collections (like your replies) is done by servers in the name of "optimizing" for request counts. But this introduces issues and personally I think it's a "code smell" for ActivityPub. Embedding should be restricted to anonymous objects. When an ID exists it should be used most of the time.

        @technical-discussion @julian @grishka

        julian@activitypub.spaceJ silverpill@mitra.socialS 2 Replies Last reply
        1
        • mariusor@metalhead.clubM mariusor@metalhead.club

          > - Recipient: trust embedded object only if the wrapping object has the same owner.

          @silverpill no, dereference object and use that instead. The canonical version of an object is the one retrieved from the originating service.

          Mastodon has popularised this behaviour where embedding collections (like your replies) is done by servers in the name of "optimizing" for request counts. But this introduces issues and personally I think it's a "code smell" for ActivityPub. Embedding should be restricted to anonymous objects. When an ID exists it should be used most of the time.

          @technical-discussion @julian @grishka

          julian@activitypub.spaceJ This user is from outside of this forum
          julian@activitypub.spaceJ This user is from outside of this forum
          julian@activitypub.space
          wrote on last edited by
          #24

          mariusor@metalhead.club silverpill@mitra.social C2S brings with it a whole other rat's nest of security concerns.

          In an S2S context same origin content ought to be trusted as having been verified. I'd argue a server blindly reflecting received AP content is a vulnerability.

          1 Reply Last reply
          0
          • mariusor@metalhead.clubM This user is from outside of this forum
            mariusor@metalhead.clubM This user is from outside of this forum
            mariusor@metalhead.club
            wrote on last edited by
            #25

            @julian I'm not sure what "blindly reflecting" means, but it's at most as vulnerable as using iframes and way less than trusting CDN scripts.

            The way GoActivityPub uses C2S is through clients that validate and sanitize content that they serve back to users, or store in a persistence layer.

            Personally I don't understand why it would make it different than S2S?

            Are you thinking about C2S from a JavaScript client perspective only?

            @silverpill

            1 Reply Last reply
            0
            • mariusor@metalhead.clubM mariusor@metalhead.club

              > - Recipient: trust embedded object only if the wrapping object has the same owner.

              @silverpill no, dereference object and use that instead. The canonical version of an object is the one retrieved from the originating service.

              Mastodon has popularised this behaviour where embedding collections (like your replies) is done by servers in the name of "optimizing" for request counts. But this introduces issues and personally I think it's a "code smell" for ActivityPub. Embedding should be restricted to anonymous objects. When an ID exists it should be used most of the time.

              @technical-discussion @julian @grishka

              silverpill@mitra.socialS This user is from outside of this forum
              silverpill@mitra.socialS This user is from outside of this forum
              silverpill@mitra.social
              wrote on last edited by
              #26

              @mariusor This is basically what my FEP currently recommends: you can trust embedded anonymous objects, fragments and object of Create. Everything else should be authenticated using a different method (e.g. fetched from origin).

              @julian @grishka

              mariusor@metalhead.clubM 1 Reply Last reply
              0
              • silverpill@mitra.socialS silverpill@mitra.social

                @mariusor This is basically what my FEP currently recommends: you can trust embedded anonymous objects, fragments and object of Create. Everything else should be authenticated using a different method (e.g. fetched from origin).

                @julian @grishka

                mariusor@metalhead.clubM This user is from outside of this forum
                mariusor@metalhead.clubM This user is from outside of this forum
                mariusor@metalhead.club
                wrote on last edited by
                #27

                @silverpill oh, I see. I must have missed the context for the discussion, sorry. 🙂

                @technical-discussion @julian @grishka

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                Powered by NodeBB Contributors
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups