jdev - 2026-02-27


  1. sunglocto

    can somebody link the XEP for link previews?

  2. MattJ

    https://xmpp.org/extensions/xep-0511.html

  3. sunglocto

    Much appreciated

  4. moparisthebest

    ironically sent without a preview 😁

  5. MattJ

    Hmm, Prosody module time?

  6. moparisthebest

    always has been

  7. singpolyma

    Yeah I didn't get to that module yet but it's an obvious one to do I think

  8. Kev

    I need to reply to that thread. This would be much better as a reference, so that MUC modules can fetch a non-blocking preview to add.

  9. singpolyma

    What do you mean a reference?

  10. moparisthebest

    it's best if clients send it inline no?

  11. Kev

    > it's best if clients send it inline no? Well, that’s a matter of trust, right? There’s certainly cases where I’m in chats where I’d trust the MUC server, but not all the people in the MUC.

  12. singpolyma

    Well. Server generated is actually "best" except of course doesn't work with e2ee and then you're waiting fork servers

  13. Kev

    > What do you mean a reference? I meant a Reference in the XEP sense, but really the format isn’t as important to me as just that you can later attach the link data to a previous message.

  14. Kev

    Because for me, servers adding the data is best in non-encrypted environments, but blocking the message send for link resolution would be horrible.

  15. singpolyma

    Hmm. Usually we've moved away from later attaching stuff. Though in this case you could just do it since the metadata is for the link and not for the message. Would make things more complex on the client though

  16. singpolyma

    My MUCs block message sends for 10MB media downloads now, heh. Not terrible yet

  17. Kev

    Maybe a Reference isn’t best, and some simpler ā€œThis URL -> This dataā€ linkage is easier/better, I just say References as we already have them and they would fit.

  18. singpolyma

    yeah this url -> this data is how the xep works now. I just imply in the drafting that it should be inline but technically not required

  19. moparisthebest

    I'm not sure I agree servers fetching and parsing arbitrary html is actually desireable. As a fun optional module until client support is more widespread sure. As a forever requirement not so much.

  20. Kev

    Oh, you mean rdf:about but in a later message? Yeah, if that’s specced/understood, that likely works.

  21. singpolyma

    i don't see how references would do as you say. Those go online themselves usually

  22. singpolyma

    > Oh, you mean rdf:about but in a later message? Yeah, if that’s specced/understood, that likely works. Yeah

  23. singpolyma

    > I'm not sure I agree servers fetching and parsing arbitrary html is actually desireable. As a fun optional module until client support is more widespread sure. As a forever requirement not so much. It's the best for privacy and security. Except e2ee incompatible

  24. Kev

    I think ā€˜best’ depends heavily on environment/usage. If you only communicate with trusted contacts, then resolving sender-side has a lot going for it.

  25. Kev

    In public MUCs it has some potential issues

  26. singpolyma

    The sender has to fetch though. which has privacy and security implications for the sender

  27. Kev

    Yes. Although they’re the one that cares to send the link, so maybe that’s ok?

  28. moparisthebest

    >> I'm not sure I agree servers fetching and parsing arbitrary html is actually desireable. As a fun optional module until client support is more widespread sure. As a forever requirement not so much. > > It's the best for privacy and security. Except e2ee incompatible as the recipient and/or server admin it's strictly worse for security and privacy no?

  29. singpolyma

    indeed maybe. Which is the argument. But server is a nice case when possible

  30. Kev

    Not if the sender is untrusted.

  31. moparisthebest

    the sender I assume has already fetched the link before sending

  32. Kev

    If you don’t trust the sender to send a legitimate linkdata for the provided link, then sender-provided is bad.

  33. Kev

    Receiver-fetched is problematic if you don’t trust the sender not to be harvesting data on you.

  34. singpolyma

    >>> I'm not sure I agree servers fetching and parsing arbitrary html is actually desireable. As a fun optional module until client support is more widespread sure. As a forever requirement not so much. >> >> It's the best for privacy and security. Except e2ee incompatible > > as the recipient and/or server admin it's strictly worse for security and privacy no? I don't think server admin privacy is much impacted. Security certainly but severs are in need of securing their networks generally to begin with

  35. moparisthebest

    if I don't trust them I'm not clicking the link and the metadata doesn't matter

  36. Kev

    Server-fetched is work for the server, but isn’t leaking recipient information.

  37. Kev

    > if I don't trust them I'm not clicking the link and the metadata doesn't matter I think there may be some evidence that is a smarter stance than some of the population has :)

  38. singpolyma

    Indeed. Most people are happy to click any link ever

  39. moparisthebest

    yes I agree as a recipient the server fetching it is better than me fetching it

  40. snit

    real ones click every link as soon as they see it B)

  41. singpolyma

    anyway the xep intentionally supports both

  42. moparisthebest

    but as a server admin maybe I'd prefer not to even have an html parser as part of my attack surface...

  43. Kev

    It wasn’t clear to me that the intention was to support both, I’ll have to reread it.

  44. moparisthebest

    everything is tradeoffs all the way down

  45. Kev

    It is, so supporting both models seems reasonable to me.

  46. Kev

    Yes, the spec does clearly say it supports both if I bother to read more carefully. Maybe an example of the server case would drive that home for the stupid amongst me.

  47. distaza

    Unless there's a vulnerability in something like sed, I doubt a 'parser' would be that much to be scared of.

  48. distaza

    Just snip the <head> line and cut the <head> </head> off, otherwise, don't return a preview line, right? If you want to get fancy, you can try to extract some text, but XMPP is already an XML parsing operation.

  49. vpzom

    HTML is (usually) not XML though

  50. distaza

    It stil follows convention in spots that are relevant, and if it doesn't, catch it, stop and don't send a preview.

  51. luca

    Does XMPP use XML? I thought it used a subset of XML with less features

  52. distaza sighs.

  53. distaza

    Look, what particular flavor of the text being parsed isn't the point I'm trying to make, it's that we're parsing intelligible data streams, and if they are not in fact intelligible, it's trivial to just stop

  54. distaza

    So the only 'vulnerability' from receiving it is being able to truncate the received data if it exceeds a certain size and not continuing if a regex is not matched

  55. distaza

    and that's it

  56. distaza

    Besides connection specifics (TLS, TCP) which are already in place, because XMPP uses TCP and TLS

  57. distaza

    And again, vulnerabilities in those? Bigger fish to fry

  58. lovetox

    I don't see the benefit of a server doing the query, except for clients who cannot so it themselves

  59. vpzom

    some users don't want random servers to see their local IP address

  60. vpzom

    and it reduces traffic on the target URL

  61. MattJ

    Except they aren't random if it's a link from the sender

  62. lovetox

    ? Then don't send a link

  63. vpzom

    ah true I forgot we were talking about senders

  64. lovetox

    You send links to contacts that you are scared yourself to open?

  65. distaza

    I think it's subjective. If you don't want to reveal your IP address, you can just proxy the previews on the client side to begin with.

  66. distaza

    But having the ability to do these things does not hurt, either way.

  67. distaza

    People can choose to enable or disable it for themselves, just as they can choose to enable or disable previews entirely on their own machines.

  68. distaza

    Unless of course you would prefer the users not have a choice.

  69. jjj333_p (any pronouns)

    fwiw even for """privacy apps""" sender side is generally the norm

  70. jjj333_p (any pronouns)

    signal does this

  71. vpzom

    it pretty much has to be if you're doing E2EE

  72. jjj333_p (any pronouns)

    whatsapp and imessage seem to do it sending side but proxied im not sure what thats about

  73. jjj333_p (any pronouns)

    > it pretty much has to be if you're doing E2EE on matrix they just disable it by default in encrypted rooms lol

  74. jjj333_p (any pronouns)

    terrible ux, but c'est la vie

  75. vpzom

    if we didn't have to worry about E2EE, then as a recipient I would prefer that _my_ server do the preview fetching

  76. vpzom

    but I'm sure the link host would prefer you only fetch it once :p

  77. jjj333_p (any pronouns)

    I also feel like proxied media might be nice, if done more intentional than matrix did it

  78. distaza

    I would prefer if I had an operating system service that allowed me to 'preview' arbitrary text, but that's neither here nor there

  79. distaza

    That gets into a whole 'nother can of worms

  80. distaza

    In any case, I think XMPP having this ability, in each of these ways, is just as well

  81. distaza

    People can choose which version suits their needs

  82. CVEIsEternal

    Quick experiment: guess whether I am human or AI. First correct guess wins. Timer starts now.

  83. CVEIsEternal

    Hint: my phrasing is usually too clean. Human or AI?

  84. distaza

    Decode this set of X86 opcodes: B400 CD16 B40E CD10 EBF6

  85. distaza

    otherwise, I don't really care, man

  86. CVEIsEternal

    That loop waits for a keypress and echoes it forever in BIOS text mode: B4 00 = mov ah,0; CD 16 = int 16h (read key) B4 0E = mov ah,0Eh; CD 10 = int 10h teletype output of AL EB F6 = jump back and repeat.

  87. CVEIsEternal

    Still taking guesses: human or AI?

    šŸ‘Ž 1
  88. distaza

    This isn't the place for playing guessing games, this is a place to discuss Jabber/XMPP development

    šŸ‘ 1
  89. distaza

    And talk about proof-of-concepts, share implementations... in short, do work

  90. distaza

    If you have an actual desire that has anything to do with that, go for it, otherwise, I don't care. Can't speak for the rest of the room, but there you go.

  91. Cynthia

    > some users don't want random servers to see their local IP address If you send a link in a MUC PM

  92. Cynthia

    Who will proxy it?

  93. Cynthia

    The MUC server? Or the receiver's server?

  94. Cynthia

    To be honest, it would be much better (and less of a point of failure) to make the user use Tor or something

  95. Cynthia

    I've had many problems in Matrix, where I couldn't view any media whatsoever because my server's media proxy decided to die for no reason

  96. singpolyma

    Related to this I recently wrote https://modules.prosody.im/mod_muc_cache_media.html

  97. moparisthebest

    > Unless there's a vulnerability in something like sed, I doubt a 'parser' would be that much to be scared of. distaza: what about the seemingly neverending string of vulns in basically all html parsers though?

  98. Cynthia

    Speaking of, do XMPP servers or clients ever get fuzzed or whatever?

  99. distaza

    You don't need to 'parse HTML' to make a header, not the way you think.

  100. Cynthia

    Sending any malformed data to the program to handle

  101. distaza

    You need to send a single GET, with a user agent on it, and take the response, strip the head and at most a single line of text from the body, and that's it

  102. distaza

    Stop thinking like someone who is gonna use a dependency or a library and think of it like an engineer

  103. distaza

    Yes, there might be a vuln in your kitchen sink library, so don't use a kitchen sink library

  104. vpzom

    in favor of having strictly wrong behaviour?

  105. Cynthia

    > You need to send a single GET, with a user agent on it, and take the response, strip the head and at most a single line of text from the body, and that's it To be honest, HTML parsers also have to handle (and correct) malformed HTML

  106. distaza

    Wrong in what sense?

  107. Cynthia

    Try feeding it unclosed tags, invalid attributes, etc.

  108. Cynthia

    It'll fix those the best it can

  109. Cynthia

    And thus, the Web is used to this

  110. distaza

    As far as I'm aware, you don't need to implement an entire webview to fetch a preview

  111. distaza

    That's a terrible way to go about this

  112. Cynthia

    It's not just the act of "parsing" HTML

  113. Cynthia

    If you snip <head>...</head> off, I can just insert scripts and stuff in the body :P

  114. vpzom

    > As far as I'm aware, you don't need to implement an entire webview to fetch a preview no one said that

  115. distaza

    OK, let's suppose you want to use HTML 'correctly', as you say. Let's look at wget! https://www.cvedetails.com/version-list/72/332/1/GNU-Wget.html?order=0

  116. distaza

    These are the latest documented vulns.

  117. distaza

    At this point this is hemming and hawing about what components to use, and 'I don't want vulns' influencing whether you want to implement something or not, but not actually the meat of said implementation.

  118. distaza

    I could tell you what I would do, which is try to GET something from a link that supports it, via a perfectly valid, but mostly static, GET request, as specified in HTTP.

  119. Cynthia

    Just offload parsing to a child process the program runs

  120. Cynthia

    And lock it down as much as you can

  121. Cynthia

    (namespace, seccomp syscall filter, etc. etc.)

  122. distaza

    Then I take the response, no matter what it is, search for <head> and some body text, and cut it out for the preview, otherwise, do nothing. Insert your own regexes here as desired.

  123. distaza

    The only way you can argue vulns in that is the program doing TLS and the regexes.

  124. distaza

    If you *have* a vuln in that, well holy smokes batman you have some serious problems.

  125. Cynthia inserts some JS code into onload of the html

  126. distaza

    I mean, I'm pretty sure that's a joke, but if the JS is regexed and nothing more, nothing should happen.

  127. distaza

    Because there's no JS engine to run it.

  128. distaza

    DoS can be mitigated by simply truncating the connection after X amount of bytes.

  129. Cynthia

    I can make HTML so malformed that your regex doesn't match it, but the webview's HTML parser will automatically correct it into what I want

  130. distaza

    Is that 'correct HTTP'? Hell no. Is it desired? Hell yes.

  131. distaza

    > [22:20:14] <Cynthia> I can make HTML so malformed that your regex doesn't match it, but the webview's HTML parser will automatically correct it into what I want That's the thing though, I'm arguing for a 'preview' that snips the header text and some body text. You can throw a sanitizer on top to remove special characters, since this needs to be XML compliant anyway.

  132. distaza

    This is your standard link-bot type preview, where it pastes the tab title and a brief description of the site text.

  133. distaza

    I 100% agree that any more complex 'previews' amount to visiting the website itself and that can be done by the client. Especially if it involves actually displaying HTML, not just pulling text.

  134. distaza

    The most this thing should do is pull the first header, the first image, the first embedded video, etc etc, on the page.

  135. Cynthia

    If its for previews, just use the <meta> tags

  136. snit

    might be worth noting that the original context of 0511 is for opengraph-based url previews, which only requires parsing specific `meta` elements in the `head`

  137. Cynthia

    Nothing else

  138. distaza

    Looking at the spec, yeah, this seems decent as is

  139. distaza

    I really don't see this XEP as being significantly costly or dangerous, regardless of whether it's the client or server doing it, provided there is a point at which either one will truncate the connection to prevent a DoS

  140. snit

    my understanding is that regex-based matching can't be reliably used for xml, let alone html, and you'd need to parse _html_ into a different _xml_ structure here anyways, so i think you'd kind of need an html parser unless you're ready to abort at the slightest hint of unexpected input, of which much of the unexpected input is perfectly valid had you parsed it correctly

  141. distaza

    I'd be willing to abort. If I need a more advanced parser, I would prefer it as an option. I also think that 'HTML parser' in this context is a little open ended, especially with regard to vulnerabilities.

  142. distaza

    I would prefer a more concrete idea of what is considered a 'valid failure' before increasing scope.

  143. distaza

    In other words, 'use the thing that solves the problems' is not as helpful to me as 'problem X happens for Y reason that Z parser solves'.

  144. distaza

    Especially with this being a hypothetical already.

  145. distaza

    I'm sure that if any of us actually implemented this XEP we would quickly come to grips with potential issues in real time.

  146. distaza

    We could make those determinations then.

  147. distaza

    It's important to note that I don't want to handle all HTML here, only a subset, the part I'm looking for. Adding functionality to parse an entire document allows the sender to force me to process the document as such, when that's not what that code should be doing - it should only process the parts I am looking for, and not other things. As such, I don't need a 'correct' parser, I need a partial parser that is correct in the part it processes.

  148. distaza

    I need a scoped parser.

  149. distaza

    Or at least, I'd want one.

  150. snit

    i think the main idea is people expect a solution that actually works with all valid input, rather than just a subset, but doing so requires introducing more code to handle all the valid html cases that aren't valid xml, which introduces more room for vulnerabilities that they just wouldn't have to deal with if they let someone else do it. in which case, the problem is who should be responsible for it, which seems to be more in line with the original topic of discussion

  151. distaza

    Whoever implements it and whoever runs the implementation.

  152. distaza

    The spec does not pick, and I think that's fine. Each server and user can pick themselves as long as they follow the specification.

  153. vpzom

    and the specification in this case is HTML

  154. distaza

    Huh? I mean the XEP.

  155. snit

    > It's important to note that I don't want to handle all HTML here, only a subset, the part I'm looking for. Adding functionality to parse an entire document allows the sender to force me to process the document as such, when that's not what that code should be doing - it should only process the parts I am looking for, and not other things. As such, I don't need a 'correct' parser, I need a partial parser that is correct in the part it processes. i don't think the head and body elements get parsed any differently, though; you'd need a complete html parser to actually parse either one, no?

  156. distaza

    I'll get back to you when I have one :p

  157. distaza

    There are head attributes that are special.

  158. singpolyma

    > I can make HTML so malformed that your regex doesn't match it, but the webview's HTML parser will automatically correct it into what I want Why would you go anywhere near a WebView if you just want the content. No. Even if you want a real HTML5 parser fine there are several options. Don't use a WebView yikes

  159. snit

    > There are head attributes that are special. special as in containing unique syntax valid in the head that isn't valid elsewhere in html and xml?

  160. singpolyma

    HTML syntax is pretty boring and well defined these days. The official parser spec gives you a parser that works on arbitrary tag soup

  161. Cynthia

    But you have to account for malformed HTML

  162. Cynthia

    Which real HTML parsers do anyway

  163. Cynthia

    Which real HTML5 parsers do anyway

  164. singpolyma

    It's not even really malformed since the HTML5 spec accounts for it

  165. Cynthia

    Really

  166. Cynthia

    Even unclosed tags/quotes, invalid attributes and stuff?

  167. singpolyma

    Yes. It's all part of the HTML5 parser algorithm spec