Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat) prevent homograph attacks

Saúl Ibarra Corretgé11ae187eceb3
diff --git a/package-lock.json b/package-lock.json
index 44bb260c2e..5bad25210c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13141,6 +13141,11 @@
}
}
},
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+ },
"q": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
diff --git a/package.json b/package.json
index 771ed41cc7..3063377d84 100644
--- a/package.json
+++ b/package.json
@@ -63,6 +63,7 @@
"moment-duration-format": "2.2.2",
"olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz",
"pixelmatch": "5.1.0",
+ "punycode": "2.1.1",
"react": "16.9",
"react-dom": "16.9",
"react-emoji-render": "1.2.4",
diff --git a/react/features/base/react/components/native/Linkify.js b/react/features/base/react/components/native/Linkify.js
index fec05a1b4d..ccceb77a9c 100644
--- a/react/features/base/react/components/native/Linkify.js
+++ b/react/features/base/react/components/native/Linkify.js
@@ -1,5 +1,6 @@
// @flow
+import punycode from 'punycode';
import React, { Component } from 'react';
import ReactLinkify from 'react-linkify';
import { Text } from 'react-native';
@@ -68,7 +69,7 @@ export default class Linkify extends Component<Props> {
key = { key }
style = { this.props.linkStyle }
url = { decoratedHref }>
- {decoratedText}
+ { punycode.toASCII(decoratedText) }
</Link>
);
}
diff --git a/react/features/base/react/components/web/Linkify.js b/react/features/base/react/components/web/Linkify.js
index f813c71870..57219f8a5a 100644
--- a/react/features/base/react/components/web/Linkify.js
+++ b/react/features/base/react/components/web/Linkify.js
@@ -1,5 +1,6 @@
// @flow
+import punycode from 'punycode';
import React, { Component } from 'react';
import ReactLinkify from 'react-linkify';
@@ -44,7 +45,7 @@ export default class Linkify extends Component<Props> {
key = { key }
rel = 'noopener noreferrer'
target = '_blank'>
- {decoratedText}
+ { punycode.toASCII(decoratedText) }
</a>
);
}