fediverse-devnet / feditest-tests-fediverse

The tests for the fediverse testsuite
MIT License
5 stars 4 forks source link

Position on `template` key in JRD link? #105

Closed steve-bate closed 1 week ago

steve-bate commented 2 weeks ago

The RFC says:

The "type" member is a string indicating what the media type of the result of dereferencing the link ought to be.

Is there a requirement that it's an official type?

jernst commented 1 week ago

Example?

IMHO if the RFC does not disallow it, and it's hard to see how that would be a bad idea. Clients may stumble over it, and if they did, we can think of what to do then.

steve-bate commented 1 week ago

Example?

This is actually a little different than I originally thought. It's the type property (which obviously is a valid property for link) that has a value of template (and causes a related to test to fail).

(I'll update the issue name and description to more accurately represent the question.)

{
  "subject": "acct:swentel@realize.be",
  "aliases": [
    "https://realize.be/user/1"
  ],
  "links": [
...
    {
      "rel": "http://ostatus.org/schema/1.0/subscribe",
      "href": "https://realize.be/authorize_interaction?uri={uri}",
      "type": "template"
    }
  ]
}

The RFC says:

The "type" member is a string indicating what the media type of the result of dereferencing the link ought to be.

Is it required to be an official MIME type? I didn't that requirement, but I might have missed it. Many Fediverse servers have the subscribe link, but with no type at all (which is fine). The template type doesn't seem like it would cause any interop issues and it's not clear to me that it's nonconformant either.

jernst commented 1 week ago

This is very weird. I distinctly remember from back in the days when WebFinger was first created that it included a template syntax. Turns out, ChatGPT also remembers this, and when prompted it says:

RFC 7033, Section 4.4: URI Templates

    The "links" array may include objects that contain a "template" member
    whose value is a URI Template [RFC6570]. The client uses this
    template to create URI references. URI Templates may be used for
    cases where a single static URI is insufficient. For example, an
    XRD might use URI Templates to express information about all of a
    user's blogs:

{
  "subject": "acct:carol@example.com",
  "links": [
    {
      "rel": "http://webfinger.net/rel/profile-page",
      "href": "https://www.example.com/profiles/carol"
    },
    {
      "rel": "blog",
      "template": "https://blogs.example.com/{uri}"
    }
  ]
}

The above JRD declares that the resource identified by "acct
@example.com" has a blog at a URI formed by inserting a value for the variable "uri" into the URI Template "https://blogs.example.com/{uri}".

When a "template" member is present, the client MUST expand the template according to the rules in RFC 6570 [RFC6570] before using it to access a resource. The client uses the URI template processing rules defined in RFC 6570 [RFC6570] to expand the template.

Except that the hyperlink it provides cannot be clicked, the the RFC text from https://www.rfc-editor.org/rfc/rfc7033#section-4.4 does not mention templates at all.

I'm sending a message to the webfinger mailing list. Chances are we (well, me!) is doing something incredibly stupid. We'll find out :-)

steve-bate commented 1 week ago

To clarify, the question isn't about a template key/member, but a "template" value for the link.type key/member.

jernst commented 1 week ago

Here is one part of the answer: https://mailarchive.ietf.org/arch/msg/webfinger/jBGAziBqb2aEpJiqUtRct2FrMIY/ . Does not answer the original issue, though. Asked here: https://matrix.to/#/!uHqAjmOtrLtidOiczC:matrix.org/$hgATsovmNEyba5p4yWisZ9jLg2XWOKqZdoVU7I8MqhQ

steve-bate commented 1 week ago

I saw the discussion. It's quite a twisted path. In any case, I think the type=template should be a soft failure (and "spec not clear" for Dimension 1) since it's not going to cause interop issues.

jernst commented 1 week ago

Resolved, to do: #109.