jdev - 2023-10-07


  1. moparisthebest

    anyone have a handy resource on understanding rules regarding attribute namespacing? I can't seem to find anything and I recall a previous discussion where my assumptions were wrong

  2. jonas’

    moparisthebest: check the standard? :)

  3. jonas’

    https://www.w3.org/TR/xml-names/#scoping-defaulting

  4. Guus

    moparisthebest: for application in XMPP? As far as I know, attribute namespacing is hardly ever done in XMPP (I'm struggling to come up with an example). Although technically likely permissible, I fear for technical issues if they're applied, especially when they're needed to distinguish otherwise equally named attributes.

  5. singpolyma

    moparisthebest: basically, attribute namespaces are always explicit rnd never inherited. The default namespace of null (even on an element with a namespace) can conceptually be thought of as being namespaced by the element itself, but from a strict xmlns pov the attribute *does not* inherit the xmlns from the element it is on

  6. moparisthebest

    pep.: Didn't you submit a XEP using attribute namespaces? I swear you did but can't find it now :'(

  7. moparisthebest

    From the spec: > Default namespace declarations do not apply directly to attribute names Makes sense > the interpretation of unprefixed attributes is determined by the element on which they appear. What

  8. moparisthebest

    The rest of the document seems to agree with the first quote, but that second one still confuses me

  9. Zash

    I'll just continue pretending unprefixed attributes live in the namespace the element they're on is in.

  10. moparisthebest

    Unless it just means that, though they are in no namespace, whatever defines the element they are on also defines them?

  11. moparisthebest

    Which obviously makes sense, but why confuse that with the "which namespace are they in" topic????

  12. Zash

    `<xmpp:xmpp xmlns:xmpp="xmpp"><xmpp:message xmpp:type="chat"><xmpp:body>please no<///>`

  13. singpolyma

    moparisthebest: yes, that is what it means

  14. singpolyma

    Unprefixed means the meaning it tied to the element and not to any namespace.

  15. singpolyma

    A prefixed attribute is defined by the namespace of the prefix instead

  16. singpolyma

    And very important unprefixed syntactically means no/null namespace

  17. Zash

    But if it is attached to an element that has a namespace, doesn't the attribute in some way belong to that namespace too?

  18. moparisthebest

    Zash, I honestly can't come up with a way that pretending namespaces work that way break anything

  19. moparisthebest

    other than querying for that-namespace vs null but if your users are aware of this...

  20. Link Mauve

    moparisthebest, in the example above, <xmpp:xmpp xmlns:xmpp="xmpp"><xmpp:message xmpp:type="chat"/></xmpp:xmpp> is the same as <xmpp xmlns="xmpp" xmlns:xmpp="xmpp"><message xmpp:type="chat"/></xmpp> but different from <xmpp xmlns="xmpp"><message type="chat"/></xmpp>.

  21. Link Mauve

    And library which do that (I’m only aware of Dino’s xmpp-vala) expose themselves to various exploits.

  22. moparisthebest

    ah, that's right, thanks Link Mauve !

  23. Link Mauve

    And libraries which do that (I’m only aware of Dino’s xmpp-vala) expose themselves to various exploits.

  24. singpolyma

    I will explain with an example If you have a document with xhtml namespace and you see <a href> and later <link href> these two href are syntactically equivalent (null xmlns, name href, selected by same selectors) but semantically different (semantics define by the element they are found on) If you see rdf:about="" in any document it has a strictly *different* syntax than about="" without prefix no matter what element is is on and the semrntics of rdf:about are always the same no matter what element it is found on

  25. Zash

    but <foo xmlns="rdf" about=""/> ???

  26. singpolyma

    Zash: that about is both syntactically and semantically distinct from rdf:about

  27. moparisthebest

    anyone aware of existing parsers in use in XMPP that limit individual stanzas to an upper limit on total # of elements and/or # of attributes?

  28. wgreenhouse

    moparisthebest: why does a question like that smell like you're on the trail of a new vulnerability?

  29. wgreenhouse

    also: libxml2 entity limits imposed as billion laughs mitigations might matter widely

  30. Zash

    wgreenhouse, it's our cue to grab what we can and go for a nice long walk in the woods

  31. wgreenhouse

    Zash: preferably reaching the trail via a Homer Simpson retreat into hedge

  32. moparisthebest

    Actually I'm investigating writing an XML parser in rust that is zero copy and doesn't do any allocations, but I think that necessarily puts an upper bound on the number of elements and/or attributes I can support

  33. moparisthebest

    So I'm looking for prior art as to: 1. If anyone has done this 2. What kind of limits would be sane (read: work) for real XMPP in the wild

  34. singpolyma

    I guess xml might not quite fit the serde data model, but going for something similar?

  35. Zash

    Does that mean you have to keep the original XML?

  36. techmetx11

    zero copy/no allocations and a DOM-based XML parser is a bad combination

  37. techmetx11

    but zero copy/no allocations and a SAX-based XML parser might work

  38. singpolyma

    I'd be very concerned about anything like an element count limit

  39. Kev

    > Actually I'm investigating writing an XML parser in rust that is zero copy and doesn't do any allocations, but I think that necessarily puts an upper bound on the number of elements and/or attributes I can support We certainly do depth limits. I don't remember if we do breadth limits or not.

  40. singpolyma

    😬

  41. Zash

    or does "no allocations" mean "no malloc() but oh so much stuff on the stack" ?

  42. singpolyma

    Usually

  43. moparisthebest

    > or does "no allocations" mean "no malloc() but oh so much stuff on the stack" ? Well it means that parser doesn't allocate, the caller can supply it a buffer from the heap or the stack Like a server could allocate X kb per connection, and it would never grow, a single-connection client could certainly just use X kb from the stack and never allocate at all, which would be a good fit for an esp32 or an Atari 8-bit :)

  44. techmetx11

    i doubt you can fit rust into an atari 8-bit machine

  45. singpolyma

    Of course you can

  46. techmetx11

    an average atari 8-bit rom (without bank switching) is 4K

  47. techmetx11

    an average atari 8-bit rom (without bank switching) is 4KB

  48. singpolyma

    Sure. Can write a very large program in 4k

  49. Zash

    wasn't rust pretty limited in target platforms still?

  50. singpolyma

    Zash: no, anything llvm can support is easy to do

  51. moparisthebest

    techmetx11: runs fine on an Atari 800xl https://github.com/mrk-its/rust-mos

  52. singpolyma

    And anything gcc can support is basically ready also

  53. moparisthebest

    How can we expect anyone to take XMPP seriously when you can connect to an IRC server from an 800xl but not an XMPP muc? It's the last thing preventing widespread adoption :D

  54. techmetx11

    judging from the assembly output from https://github.com/llvm-mos/llvm-mos

  55. techmetx11

    you'll have to do a lot of work, and even then, it would probably only fit your XML parser alone

  56. techmetx11

    before it fits up the ROM

  57. Zash

    moparisthebest, 4k? pfft, that's ludicrous amounts, try making a full XMPP client in 256 octets to really impress The Scene

  58. moparisthebest

    Actually it's common to expand the 800xl's ram to 1mb and newer methods can expand it to 4mb

  59. techmetx11

    i said ROM though

  60. techmetx11

    isn't this running on a cartridge?

  61. moparisthebest

    No, from hard drive

  62. techmetx11

    i see

  63. techmetx11

    now that sounds less impressive if you can just upgrade the hardware

  64. moparisthebest

    >> Actually I'm investigating writing an XML parser in rust that is zero copy and doesn't do any allocations, but I think that necessarily puts an upper bound on the number of elements and/or attributes I can support > > > We certainly do depth limits. I don't remember if we do breadth limits or not. Kev: so do you malloc or realloc in response to input ever or no?

  65. techmetx11

    oh well

  66. moparisthebest

    In an ideal world we could allocate X per connection then never again, but I'm not sure how feasible this is in practice yet

  67. Kev

    > so do you malloc or realloc in response to input ever or no? Yes, We'll malloc fairly freely. I commend any effort to write zero-copy/alloc code, but I don't think it's the main bottleneck we face.

  68. Kev

    I accept that I may one day be proven wrong and regret my choices.

  69. techmetx11

    i wanna be proven wrong

  70. moparisthebest

    >> so do you malloc or realloc in response to input ever or no? > > > Yes, We'll malloc fairly freely. I commend any effort to write zero-copy/alloc code, but I don't think it's the main bottleneck we face. I agree with you, this is at a "hey I wonder..." stage right now :)

  71. wgreenhouse

    esp32 xmppager

  72. techmetx11

    what about XMPP client in a CD

  73. pep.

    moparisthebest, 0463

  74. Zash

    The return of the Linux Live CD, now without Pidgin?

  75. moparisthebest

    I went back to 466 but not 463 -.- thanks pep. ! There's your attribute namespaces in XMPP example Guus https://xmpp.org/extensions/xep-0463.html#example-2

  76. moparisthebest

    pep.: Minidom doesn't support attribute namespaces right?

  77. pep.

    Not yet I think? But it's definitely planned(tm)

  78. Kev

    >> Yes, We'll malloc fairly freely. I commend any effort to write zero-copy/alloc code, but I don't think it's the main bottleneck we face. > I agree with you, this is at a "hey I wonder..." stage right now :) BTW, when I say 'we', I mean my projects, rather than trying to speak for other people.