xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.18k stars 371 forks source link

Invalid backreference in @xmpp/jid/lib/escaping #931

Closed amzn-lanos closed 2 years ago

amzn-lanos commented 2 years ago

Describe the bug

https://github.com/xmppjs/xmpp.js/blob/v0.13.0/packages/jid/lib/escaping.js#L54

From the spec, the list of characters to escape includes : which is \\3a when escaped, but the library attempts to escape /\3a/g which is never actually hit by any of the tests, nor is it correct.

Removing line 54 from escaping.js fixes the issue and allows my build to bootstrap.

Logs Share logs using https://github.com/xmppjs/xmpp.js/tree/main/packages/debug

Logs are unavailable, as my application is failing to begin when depending on this package.

Environment

I'm using xmpp.js in some standard Node-based environments without a hitch, but using the library while trying to run the Duktape engine causes a crash at bootstrapping time, due to this invalid backreference.

I can make the PR if the suggested fix (removing line 54) is agreed upon.

sonnyp commented 2 years ago

It looks nonsensical indeed. I have no idea what it's doing there. Feel free to send a PR with your suggestion.

Nice to know someone is using xmpp.js with Duktape, can I ask what's the use case? out of curiosity