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(etherpad): Checks the received command value.

damencho052024e3b72e
diff --git a/react/features/etherpad/logger.ts b/react/features/etherpad/logger.ts
new file mode 100644
index 0000000000..5ef03566eb
--- /dev/null
+++ b/react/features/etherpad/logger.ts
@@ -0,0 +1,3 @@
+import { getLogger } from '../base/logging/functions';
+
+export default getLogger('app:etherpad');
diff --git a/react/features/etherpad/middleware.ts b/react/features/etherpad/middleware.ts
index d0eae3b9e4..edcdfa74c8 100644
--- a/react/features/etherpad/middleware.ts
+++ b/react/features/etherpad/middleware.ts
@@ -1,3 +1,5 @@
+import { sanitizeUrl as _sanitizePath } from '@braintree/sanitize-url';
+
import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';
import { getCurrentConference } from '../base/conference/functions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
@@ -6,6 +8,7 @@ import { sanitizeUrl } from '../base/util/uri';
import { TOGGLE_DOCUMENT_EDITING } from './actionTypes';
import { setDocumentUrl } from './actions';
+import logger from './logger';
const ETHERPAD_COMMAND = 'etherpad';
@@ -28,6 +31,16 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const { etherpad_base: etherpadBase } = getState()['features/base/config'];
const etherpadBaseUrl = sanitizeUrl(etherpadBase);
+ try {
+ new URL(_sanitizePath(value));
+
+ logger.warn(`Received suspicious value for etherpad command: ${value}`);
+
+ return;
+ } catch (e) {
+ // we should receive a relative path for the URL and should not be able to construct a url from it
+ }
+
if (etherpadBaseUrl) {
const urlObj = new URL(value, etherpadBaseUrl.toString());