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 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
    #5

    @julian @grishka

    Here's en example:

    {
      "type": "Create",
      "actor": "https://social.example/alice"
      "object": {
        "type": "Note",
        "attributedTo": "https://social.example/alice",
        "attachment": {
          "type": "Note",
          "attributedTo": "https://social.example/bob"
        }
      }
    }
    

    It contains an embedded Note that is attributed to another actor. There are many possible ways to embed an object, and malicious embedding could be difficult to detect for the origin server.

    grishka@mastodon.socialG trwnh@mastodon.socialT 2 Replies Last reply
    0
    • trwnh@mastodon.socialT This user is from outside of this forum
      trwnh@mastodon.socialT This user is from outside of this forum
      trwnh@mastodon.social
      wrote on last edited by
      #6

      @julian @grishka @silverpill

      > messy... mixing types

      if mixing types is a concern you can serve ids in object form: {"id": "foo"}

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

        @julian @grishka

        Here's en example:

        {
          "type": "Create",
          "actor": "https://social.example/alice"
          "object": {
            "type": "Note",
            "attributedTo": "https://social.example/alice",
            "attachment": {
              "type": "Note",
              "attributedTo": "https://social.example/bob"
            }
          }
        }
        

        It contains an embedded Note that is attributed to another actor. There are many possible ways to embed an object, and malicious embedding could be difficult to detect for the origin server.

        grishka@mastodon.socialG This user is from outside of this forum
        grishka@mastodon.socialG This user is from outside of this forum
        grishka@mastodon.social
        wrote on last edited by
        #7

        @silverpill @julian @technical-discussion ideally you would traverse everything and replace anything you don't understand with "id" references.

        But anyway, I feel like we're getting too carried away about a very niche aspect of the whole thing. Almost like on that SocialHub forum.

        In my own AP extensions I always just act like C2S doesn't exist because I've never seen it used in practice, and it's wildly impractical to use anyway.

        trwnh@mastodon.socialT silverpill@mitra.socialS mariusor@metalhead.clubM 3 Replies Last reply
        1
        • silverpill@mitra.socialS silverpill@mitra.social

          @julian @grishka

          Here's en example:

          {
            "type": "Create",
            "actor": "https://social.example/alice"
            "object": {
              "type": "Note",
              "attributedTo": "https://social.example/alice",
              "attachment": {
                "type": "Note",
                "attributedTo": "https://social.example/bob"
              }
            }
          }
          

          It contains an embedded Note that is attributed to another actor. There are many possible ways to embed an object, and malicious embedding could be difficult to detect for the origin server.

          trwnh@mastodon.socialT This user is from outside of this forum
          trwnh@mastodon.socialT This user is from outside of this forum
          trwnh@mastodon.social
          wrote on last edited by
          #8

          @silverpill @julian @technical-discussion @grishka this wouldn't be "malicious", it would be "unverified". anyone can say anything about anything. it'd be like if i said herman melville wrote moby dick, and you didn't trust me until you verified with herman melville himself that he wrote moby dick. it's just a statement that you can either accept or reject. maybe you don't trust alice to make claims about bob, or maybe you trust social.example to make claims on social.example

          1 Reply Last reply
          0
          • grishka@mastodon.socialG grishka@mastodon.social

            @silverpill @julian @technical-discussion ideally you would traverse everything and replace anything you don't understand with "id" references.

            But anyway, I feel like we're getting too carried away about a very niche aspect of the whole thing. Almost like on that SocialHub forum.

            In my own AP extensions I always just act like C2S doesn't exist because I've never seen it used in practice, and it's wildly impractical to use anyway.

            trwnh@mastodon.socialT This user is from outside of this forum
            trwnh@mastodon.socialT This user is from outside of this forum
            trwnh@mastodon.social
            wrote on last edited by
            #9

            @grishka @silverpill @julian @technical-discussion what does exist is publishing an AS2 resource on a web server, which you can do with any "api" you want -- ftp, rsync, ssh, anything that can get a file in a folder served by nginx with the appropriate headers. "c2s" is literally just an endpoint that you can POST some json to and it will publish that json and POST it to others. you can replace it with curl.

            grishka@mastodon.socialG 1 Reply Last reply
            0
            • trwnh@mastodon.socialT trwnh@mastodon.social

              @grishka @silverpill @julian @technical-discussion what does exist is publishing an AS2 resource on a web server, which you can do with any "api" you want -- ftp, rsync, ssh, anything that can get a file in a folder served by nginx with the appropriate headers. "c2s" is literally just an endpoint that you can POST some json to and it will publish that json and POST it to others. you can replace it with curl.

              grishka@mastodon.socialG This user is from outside of this forum
              grishka@mastodon.socialG This user is from outside of this forum
              grishka@mastodon.social
              wrote on last edited by
              #10

              @trwnh @silverpill @julian @technical-discussion if I remember the spec correctly, that endpoint does have to do at least *some* interpretation of the json — for example, the spec explicitly says that Block activities that come into the inbox "MUST NOT" be exposed in the client's view of the inbox, but instead interpreted and acted upon by the server itself

              trwnh@mastodon.socialT 1 Reply Last reply
              0
              • grishka@mastodon.socialG grishka@mastodon.social

                @trwnh @silverpill @julian @technical-discussion if I remember the spec correctly, that endpoint does have to do at least *some* interpretation of the json — for example, the spec explicitly says that Block activities that come into the inbox "MUST NOT" be exposed in the client's view of the inbox, but instead interpreted and acted upon by the server itself

                trwnh@mastodon.socialT This user is from outside of this forum
                trwnh@mastodon.socialT This user is from outside of this forum
                trwnh@mastodon.social
                wrote on last edited by
                #11

                @grishka @silverpill @julian @technical-discussion i think you're referring to how Block should not be sent to an inbox if posted to an outbox? but this is just a rule for outboxes. the user/agent can manually send whatever notifications they want. the user/agent can also follow those rules and just store the relevant json on any properly configured web server.

                trwnh@mastodon.socialT 1 Reply Last reply
                0
                • trwnh@mastodon.socialT trwnh@mastodon.social

                  @grishka @silverpill @julian @technical-discussion i think you're referring to how Block should not be sent to an inbox if posted to an outbox? but this is just a rule for outboxes. the user/agent can manually send whatever notifications they want. the user/agent can also follow those rules and just store the relevant json on any properly configured web server.

                  trwnh@mastodon.socialT This user is from outside of this forum
                  trwnh@mastodon.socialT This user is from outside of this forum
                  trwnh@mastodon.social
                  wrote on last edited by
                  #12

                  @grishka @silverpill @julian @technical-discussion point being, you can completely upend a lot of fedi applications' security models with just nginx and curl and subdirectories.

                  grishka@mastodon.socialG 1 Reply Last reply
                  0
                  • trwnh@mastodon.socialT trwnh@mastodon.social

                    @grishka @silverpill @julian @technical-discussion point being, you can completely upend a lot of fedi applications' security models with just nginx and curl and subdirectories.

                    grishka@mastodon.socialG This user is from outside of this forum
                    grishka@mastodon.socialG This user is from outside of this forum
                    grishka@mastodon.social
                    wrote on last edited by
                    #13

                    @trwnh @silverpill @julian @technical-discussion I still wouldn't call that "upending". The actor objects — that reside on that server — contain public keys, which the entire security model of the entire fediverse relies on. So it follows, then, that since a server can serve any arbitrary public key for any of its actors, and the rest of the fediverse will unquestionably trust it, it can also be trusted with any other objects on the same domain.

                    trwnh@mastodon.socialT 1 Reply Last reply
                    0
                    • grishka@mastodon.socialG grishka@mastodon.social

                      @trwnh @silverpill @julian @technical-discussion I still wouldn't call that "upending". The actor objects — that reside on that server — contain public keys, which the entire security model of the entire fediverse relies on. So it follows, then, that since a server can serve any arbitrary public key for any of its actors, and the rest of the fediverse will unquestionably trust it, it can also be trusted with any other objects on the same domain.

                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.social
                      wrote on last edited by
                      #14

                      @grishka @silverpill @julian @technical-discussion the key can be on a different keyserver

                      grishka@mastodon.socialG 1 Reply Last reply
                      0
                      • trwnh@mastodon.socialT trwnh@mastodon.social

                        @grishka @silverpill @julian @technical-discussion the key can be on a different keyserver

                        grishka@mastodon.socialG This user is from outside of this forum
                        grishka@mastodon.socialG This user is from outside of this forum
                        grishka@mastodon.social
                        wrote on last edited by
                        #15

                        @trwnh @silverpill @julian @technical-discussion it can in theory but no software currently in existence supports that

                        grishka@mastodon.socialG 1 Reply Last reply
                        0
                        • grishka@mastodon.socialG grishka@mastodon.social

                          @trwnh @silverpill @julian @technical-discussion it can in theory but no software currently in existence supports that

                          grishka@mastodon.socialG This user is from outside of this forum
                          grishka@mastodon.socialG This user is from outside of this forum
                          grishka@mastodon.social
                          wrote on last edited by
                          #16

                          @trwnh @silverpill @julian @technical-discussion but even if, the actor object is still the ultimate source of truth as it's the one which contains the key ID

                          trwnh@mastodon.socialT 1 Reply Last reply
                          0
                          • grishka@mastodon.socialG grishka@mastodon.social

                            @trwnh @silverpill @julian @technical-discussion but even if, the actor object is still the ultimate source of truth as it's the one which contains the key ID

                            trwnh@mastodon.socialT This user is from outside of this forum
                            trwnh@mastodon.socialT This user is from outside of this forum
                            trwnh@mastodon.social
                            wrote on last edited by
                            #17

                            @grishka @silverpill @julian @technical-discussion true but we are talking about mistakes. like taking the origin of the keyId on the http sig instead of following the link to the owner/controller. such assumptions might be true for monoliths, but not everything is a monolith

                            1 Reply Last reply
                            0
                            • thisismissem@activitypub.spaceT This user is from outside of this forum
                              thisismissem@activitypub.spaceT This user is from outside of this forum
                              thisismissem@activitypub.space
                              wrote on last edited by
                              #18

                              Web Annotations has a neat solution here which is prefers representation, which allows the requestor to ask for minimal or full representation (i.e., just the IDs or the full representations)

                              You'd still likely want to gate that on authorization

                              1 Reply Last reply
                              0
                              • grishka@mastodon.socialG grishka@mastodon.social

                                @silverpill @julian @technical-discussion ideally you would traverse everything and replace anything you don't understand with "id" references.

                                But anyway, I feel like we're getting too carried away about a very niche aspect of the whole thing. Almost like on that SocialHub forum.

                                In my own AP extensions I always just act like C2S doesn't exist because I've never seen it used in practice, and it's wildly impractical to use anyway.

                                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
                                #19

                                @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 1 Reply Last reply
                                0
                                • grishka@mastodon.socialG grishka@mastodon.social

                                  @silverpill @julian @technical-discussion ideally you would traverse everything and replace anything you don't understand with "id" references.

                                  But anyway, I feel like we're getting too carried away about a very niche aspect of the whole thing. Almost like on that SocialHub forum.

                                  In my own AP extensions I always just act like C2S doesn't exist because I've never seen it used in practice, and it's wildly impractical to use anyway.

                                  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
                                  #20

                                  > and it's wildly impractical to use anyway.

                                  @grishka shush, you! 🤫

                                  @silverpill @julian @technical-discussion

                                  1 Reply Last reply
                                  1
                                  • 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
                                          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