Skip to content

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

feat(localstorage): Filter items.

damencho0a30a51bab72
diff --git a/react/features/base/jitsi-local-storage/setup.web.ts b/react/features/base/jitsi-local-storage/setup.web.ts
index 2ed1aaa86c..e57cacb36d 100644
--- a/react/features/base/jitsi-local-storage/setup.web.ts
+++ b/react/features/base/jitsi-local-storage/setup.web.ts
@@ -3,13 +3,14 @@ import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { safeJsonParse } from '@jitsi/js-utils/json';
+import { pick } from 'lodash-es';
import { browser } from '../lib-jitsi-meet';
import { isEmbedded } from '../util/embedUtils';
import { parseURLParams } from '../util/parseURLParams';
import logger from './logger';
-
+import WHITELIST from './whitelist';
/**
* Handles changes of the fake local storage.
@@ -61,7 +62,7 @@ function setupJitsiLocalStorage() {
if (shouldUseHostPageLocalStorage(urlParams)) {
try {
- const localStorageContent = safeJsonParse(urlParams['appData.localStorageContent']);
+ let localStorageContent = safeJsonParse(urlParams['appData.localStorageContent']);
// We need to disable the local storage before setting the data in case the browser local storage doesn't
// throw exception (in some cases when this happens the local storage may be cleared for every session.
@@ -71,6 +72,10 @@ function setupJitsiLocalStorage() {
jitsiLocalStorage.setLocalStorageDisabled(true);
if (typeof localStorageContent === 'object') {
+ if (!isEmbedded()) {
+ localStorageContent = pick(localStorageContent, WHITELIST);
+ }
+
Object.keys(localStorageContent).forEach(key => {
jitsiLocalStorage.setItem(key, localStorageContent[key]);
});
diff --git a/react/features/base/jitsi-local-storage/whitelist.ts b/react/features/base/jitsi-local-storage/whitelist.ts
new file mode 100644
index 0000000000..108f1682e6
--- /dev/null
+++ b/react/features/base/jitsi-local-storage/whitelist.ts
@@ -0,0 +1,11 @@
+/**
+ * Keys of localStorage that are used by jibri.
+ */
+export default [
+ 'callStatsUserName',
+ 'displayname',
+ 'email',
+ 'xmpp_username_override',
+ 'xmpp_password_override',
+ 'xmpp_conference_password_override'
+];