Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Avoid reliance on a dead JSON-LD namespace link #240

Open
MrPetovan opened this issue Sep 22, 2021 · 4 comments
Open

[bug] Avoid reliance on a dead JSON-LD namespace link #240

MrPetovan opened this issue Sep 22, 2021 · 4 comments
Labels
federation Issue relates to S2S/federation

Comments

@MrPetovan
Copy link

MrPetovan commented Sep 22, 2021

See friendica/friendica#10740

If mastodon/joinmastodon#148 doesn't get addressed, there is another way to prevent a remote lookup to a dead namespace link which can break federation.

Instead of just

"@context": [
    "http://joinmastodon.org/ns",
    "https://w3id.org/security/v1",
    "https://www.w3.org/ns/activitystreams"
  ],

Safe interoperability solution

you can bring the whole namespace definition in the context array like this:

"@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1",
        {
            "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
            "toot": "http://joinmastodon.org/ns#",
            "featured": {
                "@id": "toot:featured",
                "@type": "@id"
            },
            "featuredTags": {
                "@id": "toot:featuredTags",
                "@type": "@id"
            },
            "alsoKnownAs": {
                "@id": "as:alsoKnownAs",
                "@type": "@id"
            },
            "movedTo": {
                "@id": "as:movedTo",
                "@type": "@id"
            },
            "schema": "http://schema.org#",
            "PropertyValue": "schema:PropertyValue",
            "value": "schema:value",
            "IdentityProof": "toot:IdentityProof",
            "discoverable": "toot:discoverable",
            "Device": "toot:Device",
            "Ed25519Signature": "toot:Ed25519Signature",
            "Ed25519Key": "toot:Ed25519Key",
            "Curve25519Key": "toot:Curve25519Key",
            "EncryptedMessage": "toot:EncryptedMessage",
            "publicKeyBase64": "toot:publicKeyBase64",
            "deviceId": "toot:deviceId",
            "claim": {
                "@type": "@id",
                "@id": "toot:claim"
            },
            "fingerprintKey": {
                "@type": "@id",
                "@id": "toot:fingerprintKey"
            },
            "identityKey": {
                "@type": "@id",
                "@id": "toot:identityKey"
            },
            "devices": {
                "@type": "@id",
                "@id": "toot:devices"
            },
            "messageFranking": "toot:messageFranking",
            "messageType": "toot:messageType",
            "cipherText": "toot:cipherText",
            "suspended": "toot:suspended",
            "focalPoint": {
                "@container": "@list",
                "@id": "toot:focalPoint"
            }
        }
    ],

Solution requiring JSON-LD compacting on the receiving end

If this is too verbose for you in every single outgoing message, you can instead declare your namespace like this:

"@context": [
    {
        "toot": "http://joinmastodon.org/ns"
    },
    "https://w3id.org/security/v1",
    "https://www.w3.org/ns/activitystreams"
  ],

And update every key listed in the above namespace to the corresponding value. "discoverable": false would become "toot:discoverable": false for example. I do not have more information on the more complex declarations but I assume it works the same, just by replacing the key by the @id value.

Thanks to @annando for the technical details.

@tsmethurst
Copy link
Contributor

Thanks for the investigation :) I'll bring this up with the go-fed library dev and see what he thinks

@tsmethurst tsmethurst added the federation Issue relates to S2S/federation label Sep 22, 2021
@annando
Copy link

annando commented Sep 22, 2021

Transmitting something with "toot:discoverable": false wouldf work with Friendica on the remote side since we compact the received data. But many other systems don't do so. So it is better to adress every used parameter of a non standard namespace in the context.

@MrPetovan
Copy link
Author

Thanks for the investigation :) I'll bring this up with the go-fed library dev and see what he thinks

I submitted this and I can ping CJ about it: go-fed/activity#152

@tsmethurst
Copy link
Contributor

causes #169

@tsmethurst tsmethurst changed the title Avoid reliance on a dead JSON-LD namespace link [bug] Avoid reliance on a dead JSON-LD namespace link Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
federation Issue relates to S2S/federation
Projects
None yet
Development

No branches or pull requests

3 participants