Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(e2ee): keep E2EE and server-side transcription/translation exclusive
Jaya Allamsetty7905e7c9ed5e
diff --git a/lang/main.json b/lang/main.jsonindex ff47b5ecb2..4081bb0e35 100644--- a/lang/main.json+++ b/lang/main.json@@ -47,7 +47,9 @@"errorRoomDisabled": "Audio translation is turned off for this meeting. Enable it in Moderator settings.","errorSpeakerUnavailable": "Can't translate this participant — they're no longer in the meeting.","labelTooltip": "Translation in progress",- "labelTooltipPlaying": "Translated audio is still playing — wait before speaking"+ "labelTooltipPlaying": "Translated audio is still playing — wait before speaking",+ "stoppedForE2EE": "Live translation was turned off because End-to-End Encryption is on.",+ "unavailableWithE2EE": "Live translation isn't available while End-to-End Encryption is on."},"bandwidthSettings": {"assumedBandwidthBps": "e.g. 10000000 for 10 Mbps",@@ -390,6 +392,8 @@"done": "Done","e2eeDescription": "End-to-End Encryption is currently EXPERIMENTAL. Please keep in mind that turning on end-to-end encryption will effectively disable server-side provided services such as: phone participation. Also keep in mind that the meeting will only work for people joining from browsers with support for insertable streams.","e2eeDisabledDueToMaxModeDescription": "Cannot enable End-to-End Encryption due to large number of participants in the conference.",+ "e2eeDisabledDueToTranscriptionDescription": "End-to-End Encryption can't be turned on while the meeting is being transcribed.",+ "e2eeDisabledDueToTranslationDescription": "End-to-End Encryption can't be turned on while live translation is in use.","e2eeLabel": "Enable End-to-End Encryption","e2eeWarning": "WARNING: Not all participants in this meeting seem to have support for End-to-End encryption. If you enable it they won't be able to see nor hear you.","e2eeWillDisableDueToMaxModeDescription": "WARNING: End-to-End Encryption will be automatically disabled if more participants join the conference.",@@ -1669,10 +1673,12 @@"sourceLanguageHere": "here","start": "Start showing subtitles","stop": "Stop showing subtitles",+ "stoppedForE2EE": "Subtitles were turned off because End-to-End Encryption is on.","subtitles": "Subtitles","subtitlesOff": "Off","tr": "TR",- "translateTo": "Translate to"+ "translateTo": "Translate to",+ "unavailableWithE2EE": "Transcription isn't available while End-to-End Encryption is on."},"unpinParticipant": "{{participantName}} - Unpin","userMedia": {diff --git a/modules/API/API.js b/modules/API/API.jsindex 15472e7e60..a035868ef2 100755--- a/modules/API/API.js+++ b/modules/API/API.js@@ -81,6 +81,7 @@ import {import { appendSuffix } from '../../react/features/display-name/functions';import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox/functions';import { setMediaEncryptionKey, toggleE2EE } from '../../react/features/e2ee/actions';+import { getE2EEBlockingService } from '../../react/features/e2ee/functions';import {addStageParticipant,resizeFilmStrip,@@ -627,6 +628,13 @@ function initCommands() {APP.store.dispatch(overwriteParticipantsNames(participantList));},'toggle-e2ee': enabled => {+ const blockingService = enabled && getE2EEBlockingService(APP.store.getState());++ if (blockingService) {+ logger.warn(`Not turning on end-to-end encryption while ${blockingService} is in use`);++ return;+ }APP.store.dispatch(toggleE2EE(enabled));},'set-media-encryption-key': keyInfo => {diff --git a/react/features/audio-translation/components/web/AudioTranslationButton.tsx b/react/features/audio-translation/components/web/AudioTranslationButton.tsxindex dd8e42f61e..51b244723a 100644--- a/react/features/audio-translation/components/web/AudioTranslationButton.tsx+++ b/react/features/audio-translation/components/web/AudioTranslationButton.tsx@@ -5,11 +5,17 @@ import { openDialog } from '../../../base/dialog/actions';import { translate } from '../../../base/i18n/functions';import { IconTranslate } from '../../../base/icons/svg';import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';+import { isE2EEOnInMeeting } from '../../../e2ee/functions';import AudioTranslationDialog from './AudioTranslationDialog';interface IProps extends AbstractButtonProps {+ /**+ * Whether end-to-end encryption is on, which rules out live translation.+ */+ _e2eeEnabled: boolean;+/*** The target language remote audio is currently translated into, or null.*/@@ -44,6 +50,26 @@ class AudioTranslationButton extends AbstractButton<IProps> {override _isToggled() {return Boolean(this.props._language);}++ /**+ * Disabled while end-to-end encryption is on, unless a translation is already on and can be turned off.+ *+ * @override+ * @returns {boolean}+ */+ override _isDisabled() {+ return Boolean(this.props._e2eeEnabled) && !this._isToggled();+ }++ /**+ * Why the button is disabled.+ *+ * @override+ * @returns {string}+ */+ override _getDisabledReason() {+ return 'audioTranslation.unavailableWithE2EE';+ }}/**@@ -54,6 +80,7 @@ class AudioTranslationButton extends AbstractButton<IProps> {*/function _mapStateToProps(state: IReduxState) {return {+ _e2eeEnabled: isE2EEOnInMeeting(state),_language: state['features/audio-translation'].language};}diff --git a/react/features/audio-translation/middleware.any.ts b/react/features/audio-translation/middleware.any.tsindex 795c712135..fa2e6256ef 100644--- a/react/features/audio-translation/middleware.any.ts+++ b/react/features/audio-translation/middleware.any.ts@@ -1,6 +1,7 @@import { JitsiAudioTranslationErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';import StateListenerRegistry from '../base/redux/StateListenerRegistry';+import { isE2EEOnInMeeting } from '../e2ee/functions';import { showErrorNotification, showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';@@ -39,14 +40,23 @@ MiddlewareRegistry.register(store => next => action => {// Block enabling a translation language while a moderator has disabled the feature for the room. Managers// keep the translation UI even when the room flag is off, and the bridge silently drops such requests, so// surface a notification here instead. Disabling (language === null) is always allowed through.+ // End-to-end encrypted media can't be translated either.if ((action.type === SET_AUDIO_TRANSLATION_LANGUAGE || action.type === SET_PARTICIPANT_AUDIO_TRANSLATION_LANGUAGE)- && action.language- && !isAudioTranslationRoomEnabled(store.getState())) {- store.dispatch(showErrorNotification({- titleKey: 'audioTranslation.errorRoomDisabled'- }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));+ && action.language) {+ const state = store.getState();+ let titleKey;++ if (isE2EEOnInMeeting(state)) {+ titleKey = 'audioTranslation.unavailableWithE2EE';+ } else if (!isAudioTranslationRoomEnabled(state)) {+ titleKey = 'audioTranslation.errorRoomDisabled';+ }++ if (titleKey) {+ store.dispatch(showErrorNotification({ titleKey }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));- return;+ return;+ }}const result = next(action);@@ -121,6 +131,9 @@ StateListenerRegistry.register(if (previousConference) {dispatch(clearReceivingTranslatedSources());dispatch(setTranslationListeners([]));++ // The selection was made on the old conference and isn't applied to a new one.+ dispatch(clearAudioTranslation());}if (!conference) {@@ -153,10 +166,28 @@ StateListenerRegistry.register(const { language, participantLanguages } = getState()['features/audio-translation'];- if (language || Object.keys(participantLanguages).length > 0) {+ // Turning a participant off stores null, so a key alone doesn't mean anything is being translated.+ if (language || Object.values(participantLanguages).some(Boolean)) {dispatch(clearAudioTranslation());dispatch(showNotification({titleKey: 'audioTranslation.disabledForRoom'}, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));}});++/**+ * E2EE came on with live translation on here (a race, or a client that doesn't block it): the translated audio can't+ * come back any more, so turn it off and say why.+ */+StateListenerRegistry.register(+ state => isE2EEOnInMeeting(state),+ (e2eeOn, { dispatch, getState }) => {+ const { language, participantLanguages } = getState()['features/audio-translation'];++ if (e2eeOn && (language || Object.values(participantLanguages).some(Boolean))) {+ dispatch(clearAudioTranslation());+ dispatch(showNotification({+ titleKey: 'audioTranslation.stoppedForE2EE'+ }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));+ }+ });diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.tsindex f2c9b60fe1..99debf0df5 100644--- a/react/features/base/conference/reducer.ts+++ b/react/features/base/conference/reducer.ts@@ -54,6 +54,12 @@ const DEFAULT_STATE = {};export interface IConferenceMetadata {++ /**+ * Server-controlled flag: the deployment transcribes on the backend, started through+ * {@code recording.isTranscribingEnabled}, instead of dialing a transcriber.+ */+ asyncTranscription?: boolean;audioTranslation?: {enabled?: boolean;};diff --git a/react/features/base/toolbox/components/AbstractButton.tsx b/react/features/base/toolbox/components/AbstractButton.tsxindex 1eef518b0a..f9fece3d11 100644--- a/react/features/base/toolbox/components/AbstractButton.tsx+++ b/react/features/base/toolbox/components/AbstractButton.tsx@@ -342,6 +342,16 @@ export default class AbstractButton<P extends IProps, S = any> extends Component|| '';}+ /**+ * Why the button is disabled, as a translation key, for subclasses that can say. Only consulted while disabled.+ *+ * @protected+ * @returns {string|undefined}+ */+ _getDisabledReason(): string | undefined {+ return undefined;+ }+/*** Helper function to be implemented by subclasses, which must return a* boolean value indicating if this button is disabled or not.@@ -406,6 +416,7 @@ export default class AbstractButton<P extends IProps, S = any> extends Componentconst props: any = {...this.props,accessibilityLabel: this._getAccessibilityLabel(),+ disabledReason: this._isDisabled() ? this._getDisabledReason() : undefined,elementAfter: this._getElementAfter(),icon: this._getIcon(),label: this._getLabel(),diff --git a/react/features/base/toolbox/components/AbstractToolboxItem.tsx b/react/features/base/toolbox/components/AbstractToolboxItem.tsxindex b652499d8f..8a5e92843e 100644--- a/react/features/base/toolbox/components/AbstractToolboxItem.tsx+++ b/react/features/base/toolbox/components/AbstractToolboxItem.tsx@@ -53,6 +53,12 @@ export interface IProps extends WithTranslation {*/disabled: boolean;+ /**+ * Why the item is disabled, when it can say. Shown as its tooltip, in the overflow menu too, and given to+ * assistive technology.+ */+ disabledReason?: string;+/*** A React Element to display at the end of {@code ToolboxItem}.*/@@ -176,6 +182,18 @@ export default class AbstractToolboxItem<P extends IProps> extends Component<P>return this._maybeTranslateAttribute(this.props.accessibilityLabel);}+ /**+ * Helper property to get why the item is disabled, translated, if it is disabled and says why.+ *+ * @protected+ * @returns {?string}+ */+ get disabledReason(): string | undefined {+ const { disabled, disabledReason } = this.props;++ return disabled && disabledReason ? this._maybeTranslateAttribute(disabledReason) : undefined;+ }+/*** Utility function to translate the given string, if a translation* function is available.diff --git a/react/features/base/toolbox/components/ToolboxItem.web.tsx b/react/features/base/toolbox/components/ToolboxItem.web.tsxindex 07f68e01c2..431790a603 100644--- a/react/features/base/toolbox/components/ToolboxItem.web.tsx+++ b/react/features/base/toolbox/components/ToolboxItem.web.tsx@@ -1,6 +1,7 @@import React, { Fragment } from 'react';import Icon from '../../icons/components/Icon';+import DisabledReasonTooltip from '../../tooltip/components/DisabledReasonTooltip';import Tooltip from '../../tooltip/components/Tooltip';import ContextMenuItem from '../../ui/components/web/ContextMenuItem';@@ -89,6 +90,7 @@ export default class ToolboxItem extends AbstractToolboxItem<IProps> {const buttonAttribute = isMenuButton ? 'aria-expanded' : 'aria-pressed';const props = {[buttonAttribute]: toggled,+ 'aria-description': this.disabledReason,'aria-disabled': disabled,'aria-label': this.accessibilityLabel,className: className + (disabled ? ' disabled' : ''),@@ -100,19 +102,24 @@ export default class ToolboxItem extends AbstractToolboxItem<IProps> {};const elementType = showLabel ? 'li' : 'div';- const useTooltip = !disableTooltip && this.tooltip && this.tooltip.length > 0;+ const tooltip = this.disabledReason ?? this.tooltip;+ const useTooltip = !disableTooltip && tooltip && tooltip.length > 0;if (contextMenu) {+ // A menu item shows its label rather than a tooltip, unless it is disabled and says why.return (- <ContextMenuItem- accessibilityLabel = { this.accessibilityLabel }- backgroundColor = { backgroundColor }- disabled = { disabled }- icon = { icon }- onClick = { onClick }- onKeyDown = { onKeyDown }- onKeyPress = { this._onKeyPress }- text = { this.label } />+ <DisabledReasonTooltip reason = { this.disabledReason }>+ <ContextMenuItem+ accessibilityLabel = { this.accessibilityLabel }+ backgroundColor = { backgroundColor }+ description = { this.disabledReason }+ disabled = { disabled }+ icon = { icon }+ onClick = { onClick }+ onKeyDown = { onKeyDown }+ onKeyPress = { this._onKeyPress }+ text = { this.label } />+ </DisabledReasonTooltip>);}let children = (@@ -128,7 +135,7 @@ export default class ToolboxItem extends AbstractToolboxItem<IProps> {if (useTooltip) {children = (<Tooltip- content = { this.tooltip ?? '' }+ content = { tooltip ?? '' }position = { tooltipPosition }>{ children }</Tooltip>diff --git a/react/features/base/tooltip/components/DisabledReasonTooltip.tsx b/react/features/base/tooltip/components/DisabledReasonTooltip.tsxnew file mode 100644index 0000000000..273a1ea561--- /dev/null+++ b/react/features/base/tooltip/components/DisabledReasonTooltip.tsx@@ -0,0 +1,28 @@+import React, { ReactElement } from 'react';++import Tooltip from './Tooltip';++interface IProps {++ /**+ * The disabled control.+ */+ children: ReactElement;++ /**+ * Why the control is disabled, already translated. Without one the control is rendered alone.+ */+ reason?: string;+}++/**+ * Explains a disabled control in a tooltip.+ *+ * @param {IProps} props - The props of the component.+ * @returns {ReactElement}+ */+const DisabledReasonTooltip = ({ children, reason }: IProps) => (+ reason ? <Tooltip content = { reason }>{ children }</Tooltip> : children+);++export default DisabledReasonTooltip;diff --git a/react/features/base/ui/components/types.ts b/react/features/base/ui/components/types.tsindex 7fdb1d4cdb..659c2b66e2 100644--- a/react/features/base/ui/components/types.ts+++ b/react/features/base/ui/components/types.ts@@ -12,6 +12,11 @@ export interface IButtonProps {*/autoFocus?: boolean;+ /**+ * Extra description for assistive technology, such as why the button is disabled. Web only.+ */+ description?: string;+/*** Whether or not the button is disabled.*/diff --git a/react/features/base/ui/components/web/Button.tsx b/react/features/base/ui/components/web/Button.tsxindex 974bc715c6..a43a29eb72 100644--- a/react/features/base/ui/components/web/Button.tsx+++ b/react/features/base/ui/components/web/Button.tsx@@ -178,6 +178,7 @@ const Button = React.forwardRef<any, any>(({accessibilityLabel,autoFocus = false,className,+ description,disabled,fullWidth,icon,@@ -196,6 +197,7 @@ const Button = React.forwardRef<any, any>(({return (<button+ aria-description = { description }aria-label = { accessibilityLabel }autoFocus = { autoFocus }className = { cx(styles.button, styles[type],diff --git a/react/features/base/ui/components/web/ContextMenuItem.tsx b/react/features/base/ui/components/web/ContextMenuItem.tsxindex 6030ee18ea..48ae72a453 100644--- a/react/features/base/ui/components/web/ContextMenuItem.tsx+++ b/react/features/base/ui/components/web/ContextMenuItem.tsx@@ -43,6 +43,11 @@ export interface IProps {*/customIcon?: ReactNode;+ /**+ * Extra description for assistive technology, such as why the item is disabled.+ */+ description?: string;+/*** Whether or not the action is disabled.*/@@ -190,6 +195,7 @@ const ContextMenuItem = ({className,controls,customIcon,+ description,disabled,id,icon,@@ -230,6 +236,7 @@ const ContextMenuItem = ({return (<divaria-controls = { controls }+ aria-description = { description }aria-disabled = { disabled }aria-label = { accessibilityLabel || undefined }aria-selected = { role === 'tab' ? selected : undefined }diff --git a/react/features/chat/components/web/ClosedCaptionsTab.tsx b/react/features/chat/components/web/ClosedCaptionsTab.tsxindex 6c7954e7d6..f08974e080 100644--- a/react/features/chat/components/web/ClosedCaptionsTab.tsx+++ b/react/features/chat/components/web/ClosedCaptionsTab.tsx@@ -5,7 +5,9 @@ import { makeStyles } from 'tss-react/mui';import Icon from '../../../base/icons/components/Icon';import { IconSubtitles } from '../../../base/icons/svg';+import DisabledReasonTooltip from '../../../base/tooltip/components/DisabledReasonTooltip';import Button from '../../../base/ui/components/web/Button';+import { isE2EEOnInMeeting } from '../../../e2ee/functions';import LanguageSelector from '../../../subtitles/components/web/LanguageSelector';import { ChatTabs } from '../../constants';import { getFocusedTab } from '../../functions';@@ -86,19 +88,25 @@ const ClosedCaptionsTab = ({const { classes, theme } = useStyles();const { t } = useTranslation();const isVisible = useSelector(getFocusedTab) === ChatTabs.CLOSED_CAPTIONS;+ const e2eeEnabled = useSelector(isE2EEOnInMeeting);if (!isTranscribing) {if (canStartSubtitles) {+ const reason = e2eeEnabled ? t('transcribing.unavailableWithE2EE') : undefined;+return (<div className = { classes.emptyContent }>- <Button- accessibilityLabel = { t('closedCaptionsTab.startClosedCaptionsButton') }- appearance = 'primary'- disabled = { isButtonPressed }- labelKey = 'closedCaptionsTab.startClosedCaptionsButton'- onClick = { startClosedCaptions }- size = 'large'- type = 'primary' />+ <DisabledReasonTooltip reason = { reason }>+ <Button+ accessibilityLabel = { t('closedCaptionsTab.startClosedCaptionsButton') }+ appearance = 'primary'+ description = { reason }+ disabled = { isButtonPressed || e2eeEnabled }+ labelKey = 'closedCaptionsTab.startClosedCaptionsButton'+ onClick = { startClosedCaptions }+ size = 'large'+ type = 'primary' />+ </DisabledReasonTooltip></div>);}diff --git a/react/features/e2ee/components/E2EESection.tsx b/react/features/e2ee/components/E2EESection.tsxindex cc2b1be501..c62179f2af 100644--- a/react/features/e2ee/components/E2EESection.tsx+++ b/react/features/e2ee/components/E2EESection.tsx@@ -6,13 +6,19 @@ import { makeStyles } from 'tss-react/mui';import { createE2EEEvent } from '../../analytics/AnalyticsEvents';import { sendAnalytics } from '../../analytics/functions';import { IReduxState, IStore } from '../../app/types';+import DisabledReasonTooltip from '../../base/tooltip/components/DisabledReasonTooltip';import Switch from '../../base/ui/components/web/Switch';import { toggleE2EE } from '../actions';import { MAX_MODE } from '../constants';-import { doesEveryoneSupportE2EE } from '../functions';+import { E2EEBlockingService, doesEveryoneSupportE2EE, getE2EEBlockingService } from '../functions';interface IProps {+ /**+ * Why turning E2EE on is blocked by a server-side service, as a translation key, if it is.+ */+ _blockedReason?: string;+/*** The resource for the description, computed based on the maxMode and whether the switch is toggled or not.*/@@ -77,6 +83,7 @@ const useStyles = makeStyles()(() => {* @returns {JSX}*/const E2EESection = ({+ _blockedReason,_descriptionResource,_enabled,_e2eeLabels,@@ -107,7 +114,8 @@ const E2EESection = ({dispatch(toggleE2EE(newValue));}, [ toggled ]);- const description = _e2eeLabels?.description || t(_descriptionResource ?? '');+ // A blocking service's reason wins over a deployment's own description, so it is never hidden.+ const description = _blockedReason ? t(_blockedReason) : _e2eeLabels?.description || t(_descriptionResource ?? '');const label = _e2eeLabels?.label || t('dialog.e2eeLabel');const warning = _e2eeLabels?.warning || t('dialog.e2eeWarning');@@ -127,16 +135,26 @@ const E2EESection = ({<label htmlFor = 'e2ee-section-switch'>{label}</label>- <Switch- checked = { toggled }- disabled = { !_enabled }- id = 'e2ee-section-switch'- onChange = { _onToggle } />+ <DisabledReasonTooltip reason = { _blockedReason && t(_blockedReason) }>+ <Switch+ checked = { toggled }+ disabled = { !_enabled }+ id = 'e2ee-section-switch'+ onChange = { _onToggle } />+ </DisabledReasonTooltip></div></div>);};+/**+ * Why each server-side service keeps E2EE from being turned on.+ */+const E2EE_BLOCKED_REASONS: Record<E2EEBlockingService, string> = {+ transcription: 'dialog.e2eeDisabledDueToTranscriptionDescription',+ translation: 'dialog.e2eeDisabledDueToTranslationDescription'+};+/*** Maps (parts of) the Redux state to the associated props for this component.*@@ -148,11 +166,16 @@ function mapStateToProps(state: IReduxState) {const { enabled: e2eeEnabled, maxMode } = state['features/e2ee'];const { e2ee = {} } = state['features/base/config'];+ // Only turning it on is blocked; it can always be turned off.+ const blockingService = e2eeEnabled ? undefined : getE2EEBlockingService(state);+ const blockedReason = blockingService && E2EE_BLOCKED_REASONS[blockingService];let descriptionResource: string | undefined = '';if (e2ee.labels) {// When e2eeLabels are present, the description resource is ignored.descriptionResource = undefined;+ } else if (blockedReason) {+ descriptionResource = blockedReason;} else if (maxMode === MAX_MODE.THRESHOLD_EXCEEDED) {descriptionResource = 'dialog.e2eeDisabledDueToMaxModeDescription';} else if (maxMode === MAX_MODE.ENABLED) {@@ -163,9 +186,10 @@ function mapStateToProps(state: IReduxState) {}return {+ _blockedReason: blockedReason,_descriptionResource: descriptionResource,_e2eeLabels: e2ee.labels,- _enabled: maxMode === MAX_MODE.DISABLED || e2eeEnabled,+ _enabled: e2eeEnabled || (maxMode === MAX_MODE.DISABLED && !blockingService),_toggled: e2eeEnabled,_everyoneSupportE2EE: Boolean(doesEveryoneSupportE2EE(state))};diff --git a/react/features/e2ee/functions.ts b/react/features/e2ee/functions.tsindex 64a59cd674..98bf85a9c1 100644--- a/react/features/e2ee/functions.ts+++ b/react/features/e2ee/functions.ts@@ -1,11 +1,13 @@import i18next from 'i18next';import { IReduxState, IStore } from '../app/types';+import { isAudioTranslationActiveInMeeting } from '../audio-translation/functions';import { IStateful } from '../base/app/types';import { getSoundFileSrc } from '../base/media/functions';import { getParticipantById, getParticipantCount, getParticipantCountWithFake } from '../base/participants/functions';import { toState } from '../base/redux/functions';import { registerSound, unregisterSound } from '../base/sounds/actions';+import { isAsyncTranscriptionActive, isTranscribing } from '../transcribing/functions';import {E2EE_OFF_SOUND_ID,@@ -118,3 +120,45 @@ export function registerE2eeAudioFiles(dispatch: IStore['dispatch'], shouldUnregE2EE_ON_SOUND_ID,getSoundFileSrc(E2EE_ON_SOUND_FILE, language)));}++/**+ * Returns whether anyone in the meeting has end-to-end encryption on. Clients normally follow a participant who+ * turns it on, but not with externally managed keys, past the max-mode threshold, on native (no e2ee state there)+ * or before the follow lands, so the participants' broadcast flags are checked too.+ *+ * @param {IStateful} stateful - The redux store or {@code getState} function.+ * @returns {boolean}+ */+export function isE2EEOnInMeeting(stateful: IStateful) {+ const state = toState(stateful);++ if (state['features/e2ee']?.enabled) {+ return true;+ }++ // The reducer counts the same (non-fake) participants as getParticipantCount, so this avoids a scan per dispatch.+ return getParticipantCount(state) > state['features/base/participants'].numberOfParticipantsDisabledE2EE;+}++/**+ * A server-side service that needs the media in the clear, so it and end-to-end encryption exclude each other.+ */+export type E2EEBlockingService = 'transcription' | 'translation';++/**+ * Returns the server-side service that keeps end-to-end encryption from being turned on, if any.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {E2EEBlockingService|undefined}+ */+export function getE2EEBlockingService(state: IReduxState): E2EEBlockingService | undefined {+ // A transcriber in the room (Jigasi) or the deployment's backend transcription.+ if (isTranscribing(state) || isAsyncTranscriptionActive(state)) {+ return 'transcription';+ }+ if (isAudioTranslationActiveInMeeting(state)) {+ return 'translation';+ }++ return undefined;+}diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStartRecordingDialog.tsindex 4f0789787b..45bf72656e 100644--- a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts@@ -13,6 +13,7 @@ import { isLocalParticipantModerator } from '../../../base/participants/functionimport { updateDropboxToken } from '../../../dropbox/actions';import { getNewAccessToken, isEnabled as isDropboxEnabled } from '../../../dropbox/functions';import { getDropboxData } from '../../../dropbox/functions.any';+import { isE2EEOnInMeeting } from '../../../e2ee/functions';import { showErrorNotification } from '../../../notifications/actions';import { setRequestingSubtitles } from '../../../subtitles/actions.any';import { canAddTranscriber, isRecorderTranscriptionsRunning } from '../../../transcribing/functions';@@ -72,6 +73,11 @@ export interface IProps extends WithTranslation {*/_displaySubtitles?: boolean;+ /**+ * Whether anyone in the meeting has end-to-end encryption on, which rules out starting transcription.+ */+ _e2eeOn: boolean;+/*** Active FILE recording session, needed to stop recording.*/@@ -535,13 +541,14 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {*/_applyChanges({startRecording = false,- startTranscription = false,+ startTranscription: transcriptionRequested = false,stopRecording = false,stopTranscription = false}: IRecordingChanges) {const {_appKey,_conference,+ _e2eeOn,_displaySubtitles,_fileRecordingSession,_isDropboxEnabled,@@ -554,6 +561,9 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {dispatch} = this.props;+ // Nothing server-side can transcribe end-to-end encrypted media.+ const startTranscription = transcriptionRequested && !_e2eeOn;+const {localRecordingOnlySelf,selectedLanguage,@@ -815,6 +825,7 @@ export function mapStateToProps(state: IReduxState, _ownProps: any) {return {_appKey: dropbox.appKey ?? '',_autoTranscribeOnRecord: shouldAutoTranscribeOnRecord(state),+ _e2eeOn: isE2EEOnInMeeting(state),_canTranscribe: canAddTranscriber(state),_conference: state['features/base/conference'].conference,_displaySubtitles,diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialogContent.tsx b/react/features/recording/components/Recording/AbstractStartRecordingDialogContent.tsxindex 8c37ac21a1..f0f0f650ac 100644--- a/react/features/recording/components/Recording/AbstractStartRecordingDialogContent.tsx+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialogContent.tsx@@ -10,6 +10,7 @@ import { MEET_FEATURES } from '../../../base/jwt/constants';import { isJwtFeatureEnabled } from '../../../base/jwt/functions';import { isLocalParticipantModerator } from '../../../base/participants/functions';import { authorizeDropbox, updateDropboxToken } from '../../../dropbox/actions';+import { isE2EEOnInMeeting } from '../../../e2ee/functions';import { setFollowMeRecorderExclusive } from '../../../follow-me/actions';import { isFollowMeActive, isFollowMeRecorderActive } from '../../../follow-me/functions';import { isVpaasMeeting } from '../../../jaas/functions';@@ -46,6 +47,11 @@ export interface IProps extends WithTranslation {*/_dialogStyles: any;+ /**+ * Whether end-to-end encryption is on, which rules out starting transcription.+ */+ _e2eeEnabled: boolean;+/*** Whether any moderator has the regular Follow Me feature active.*/@@ -648,6 +654,7 @@ export function mapStateToProps(state: IReduxState) {.map((lang: string) => `translation-languages:${lang}`),_canManageRecordingOrTranscription: canManageRecordingOrTranscription,_canStartTranscribing: canAddTranscriber(state),+ _e2eeEnabled: isE2EEOnInMeeting(state),_followMeActive: isFollowMeActive(state),_followMeRecorderActive: isFollowMeRecorderActive(state),_followMeRecorderEnabled: Boolean(followMeRecorderEnabled),diff --git a/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx b/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsxindex 474fc76caf..2b91e560a2 100644--- a/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx+++ b/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx@@ -9,6 +9,7 @@ import Container from '../../../../base/react/components/web/Container';import Image from '../../../../base/react/components/web/Image';import LoadingIndicator from '../../../../base/react/components/web/LoadingIndicator';import Text from '../../../../base/react/components/web/Text';+import DisabledReasonTooltip from '../../../../base/tooltip/components/DisabledReasonTooltip';import Button from '../../../../base/ui/components/web/Button';import Switch from '../../../../base/ui/components/web/Switch';import { BUTTON_TYPES } from '../../../../base/ui/constants.web';@@ -433,6 +434,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {const {_availableLanguages,+ _e2eeEnabled,onStartTranscription,onStopTranscription,selectedLanguage,@@ -441,6 +443,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {} = this.props;const { showTranscriptionOptions } = this.state;const classes = this.props.classes ?? {};+ const e2eeReason = _e2eeEnabled ? t('transcribing.unavailableWithE2EE') : undefined;const languageOptions = _availableLanguages.map((lang: string) => {return {label: t(lang),@@ -463,12 +466,16 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {testId = 'recordingDialog.stopTranscription'type = { BUTTON_TYPES.DESTRUCTIVE } />) : (- <Button- accessibilityLabel = { t('dialog.startTranscription') }- labelKey = 'dialog.start'- onClick = { onStartTranscription }- testId = 'recordingDialog.startTranscription'- type = { BUTTON_TYPES.PRIMARY } />+ <DisabledReasonTooltip reason = { e2eeReason }>+ <Button+ accessibilityLabel = { t('dialog.startTranscription') }+ description = { e2eeReason }+ disabled = { _e2eeEnabled }+ labelKey = 'dialog.start'+ onClick = { onStartTranscription }+ testId = 'recordingDialog.startTranscription'+ type = { BUTTON_TYPES.PRIMARY } />+ </DisabledReasonTooltip>) }</Container></Container>@@ -508,6 +515,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {}const {+ _e2eeEnabled,isValidating,onStartBoth,onStopBoth,@@ -518,7 +526,9 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {} = this.props;const showStopBoth = recordingRunning || transcriptionRunning;const showStartBoth = !recordingRunning || !transcriptionRunning;- const startBothDisabled = !recordingRunning && (startRecordingDisabled || isValidating);+ const startBothE2EEReason = !transcriptionRunning && _e2eeEnabled ? t('transcribing.unavailableWithE2EE') : undefined;+ const startBothDisabled = Boolean(startBothE2EEReason)+ || (!recordingRunning && (startRecordingDisabled || isValidating));const classes = this.props.classes ?? {};return (@@ -532,13 +542,16 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {type = { BUTTON_TYPES.DESTRUCTIVE } />) }{ showStartBoth && (- <Button- accessibilityLabel = { t('dialog.startBoth') }- disabled = { startBothDisabled }- labelKey = 'dialog.startBoth'- onClick = { onStartBoth }- testId = 'recordingDialog.startBoth'- type = { BUTTON_TYPES.PRIMARY } />+ <DisabledReasonTooltip reason = { startBothE2EEReason }>+ <Button+ accessibilityLabel = { t('dialog.startBoth') }+ description = { startBothE2EEReason }+ disabled = { startBothDisabled }+ labelKey = 'dialog.startBoth'+ onClick = { onStartBoth }+ testId = 'recordingDialog.startBoth'+ type = { BUTTON_TYPES.PRIMARY } />+ </DisabledReasonTooltip>) }</Container>);diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.tsindex 9379ae9e94..b02d5b93f6 100644--- a/react/features/recording/functions.ts+++ b/react/features/recording/functions.ts@@ -12,6 +12,7 @@ import { isSpotTV } from '../base/util/spot';import { isInBreakoutRoom as isInBreakoutRoomF } from '../breakout-rooms/functions';import { isEnabled as isDropboxEnabled } from '../dropbox/functions';import { extractFqnFromPath } from '../dynamic-branding/functions.any';+import { isE2EEOnInMeeting } from '../e2ee/functions';import { isVpaasMeeting } from '../jaas/functions';import { canAddTranscriber, isRecorderTranscriptionsRunning } from '../transcribing/functions';import { iAmVisitor } from '../visitors/functions';@@ -237,7 +238,7 @@ export function canStopRecording(state: IReduxState) {export function shouldAutoTranscribeOnRecord(state: IReduxState) {const { transcription } = state['features/base/config'];- return (transcription?.autoTranscribeOnRecord ?? true) && canAddTranscriber(state);+ return (transcription?.autoTranscribeOnRecord ?? true) && canAddTranscriber(state) && !isE2EEOnInMeeting(state);}/**diff --git a/react/features/subtitles/components/AbstractClosedCaptionButton.tsx b/react/features/subtitles/components/AbstractClosedCaptionButton.tsxindex ad3936e753..955f87b1a9 100644--- a/react/features/subtitles/components/AbstractClosedCaptionButton.tsx+++ b/react/features/subtitles/components/AbstractClosedCaptionButton.tsx@@ -3,6 +3,7 @@ import { sendAnalytics } from '../../analytics/functions';import { IReduxState } from '../../app/types';import { MEET_FEATURES } from '../../base/jwt/constants';import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';+import { isE2EEOnInMeeting } from '../../e2ee/functions';import { maybeShowPremiumFeatureDialog } from '../../jaas/actions';import { canStartSubtitles, isCCTabEnabled } from '../functions.any';@@ -20,6 +21,11 @@ export interface IAbstractProps extends AbstractButtonProps {*/_defaultLanguage?: string;+ /**+ * Whether end-to-end encryption is on, which rules out transcription.+ */+ _e2eeEnabled?: boolean;+/*** Whether the subtitles tab is enabled in the UI.*/@@ -94,7 +100,22 @@ export class AbstractClosedCaptionButton* @returns {boolean}*/override _isDisabled() {- return false;+ const { _e2eeEnabled, _isCCTabEnabled, _requestingSubtitles } = this.props;++ // Requested subtitles can still be turned off, and with the CC tab the button only opens the panel, whose+ // own start button is disabled instead.+ return Boolean(_e2eeEnabled) && !_requestingSubtitles && !_isCCTabEnabled;+ }++ /**+ * Why the button is disabled.+ *+ * @override+ * @protected+ * @returns {string}+ */+ override _getDisabledReason() {+ return 'transcribing.unavailableWithE2EE';}/**@@ -131,6 +152,7 @@ export function _abstractMapStateToProps(state: IReduxState, ownProps: IAbstractconst { visible = canStartSubtitles(state) } = ownProps;return {+ _e2eeEnabled: isE2EEOnInMeeting(state),_isCCTabEnabled: isCCTabEnabled(state),_requestingSubtitles,_language,diff --git a/react/features/subtitles/middleware.ts b/react/features/subtitles/middleware.tsindex 38d2d4acb3..4ec254701b 100644--- a/react/features/subtitles/middleware.ts+++ b/react/features/subtitles/middleware.ts@@ -7,7 +7,10 @@ import { isJwtFeatureEnabled } from '../base/jwt/functions';import JitsiMeetJS from '../base/lib-jitsi-meet';import { TRANSCRIBER_ID } from '../base/participants/constants';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';-import { showErrorNotification } from '../notifications/actions';+import StateListenerRegistry from '../base/redux/StateListenerRegistry';+import { isE2EEOnInMeeting } from '../e2ee/functions';+import { showErrorNotification, showNotification } from '../notifications/actions';+import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';import { RECORDING_METADATA_ID } from '../recording/constants';import { maybeNotifyRecordingStart } from '../recording/middleware';import { TRANSCRIBER_JOINED } from '../transcribing/actionTypes';@@ -86,6 +89,9 @@ MiddlewareRegistry.register(store => next => action => {const state = store.getState()['features/subtitles'];const toggledValue = !state._requestingSubtitles;+ if (toggledValue && _refusedUnderE2EE(store)) {+ return;+ }_requestingSubtitlesChange(store, toggledValue, state._language);break;}@@ -102,6 +108,9 @@ MiddlewareRegistry.register(store => next => action => {break;}case SET_REQUESTING_SUBTITLES:+ if (action.enabled && _refusedUnderE2EE(store)) {+ return;+ }_requestingSubtitlesChange(store, action.enabled, action.language,action.forceBackendRecordingOn, action.isRecordingRequested,@@ -479,3 +488,39 @@ function _setClearerOnTranscriptMessage(() => dispatch(removeTranscriptMessage(transcriptMessageID)),REMOVE_AFTER_MS);}++/**+ * Refuses a subtitles request while anyone has E2EE on: nothing server-side can transcribe encrypted media. The+ * request never reaches the reducer.+ *+ * @param {IStore} store - The redux store.+ * @returns {boolean} Whether the request was refused.+ */+function _refusedUnderE2EE({ dispatch, getState }: IStore) {+ if (!isE2EEOnInMeeting(getState())) {+ return false;+ }+ logger.warn('Not requesting subtitles: end-to-end encryption is on');+ dispatch(showErrorNotification({ titleKey: 'transcribing.unavailableWithE2EE' }));+ dispatch(setSubtitlesError(true));++ // A recording started alongside still gets its start notification.+ if (getState()['features/recording'].startRecordingIntent) {+ maybeNotifyRecordingStart(dispatch, getState);+ }++ return true;+}++/**+ * E2EE came on with subtitles requested here (a race, or a client that doesn't block it): drop the local request.+ * A meeting-wide transcription is left to whoever runs it.+ */+StateListenerRegistry.register(+ state => isE2EEOnInMeeting(state),+ (e2eeOn, { dispatch, getState }) => {+ if (e2eeOn && getState()['features/subtitles']._requestingSubtitles) {+ dispatch(setRequestingSubtitles(false, false, null, false, false, true));+ dispatch(showNotification({ titleKey: 'transcribing.stoppedForE2EE' }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));+ }+ });diff --git a/react/features/transcribing/functions.ts b/react/features/transcribing/functions.tsindex 1af862764c..8cfdaa8c8b 100644--- a/react/features/transcribing/functions.ts+++ b/react/features/transcribing/functions.ts@@ -94,6 +94,19 @@ export function isTranscribing(state: IReduxState) {return state['features/transcribing'].isTranscribing;}+/**+ * Returns whether the deployment's backend (async) transcription is on for the meeting.+ *+ * @param {IReduxState} state - The redux state to search in.+ * @returns {boolean}+ */+export function isAsyncTranscriptionActive(state: IReduxState) {+ const { metadata } = state['features/base/conference'];++ // Strict, as jicofo starts it only on these exact values.+ return metadata?.asyncTranscription === true && metadata?.recording?.isTranscribingEnabled === true;+}+/*** Returns true if there is a recorder transcription session running.* NOTE: If only the subtitles are running this function will return false.diff --git a/react/features/video-menu/components/web/TranslateParticipantButton.tsx b/react/features/video-menu/components/web/TranslateParticipantButton.tsxindex 2a0d19c79d..f18bcb0472 100644--- a/react/features/video-menu/components/web/TranslateParticipantButton.tsx+++ b/react/features/video-menu/components/web/TranslateParticipantButton.tsx@@ -1,11 +1,15 @@import React, { useCallback } from 'react';import { useTranslation } from 'react-i18next';-import { useDispatch } from 'react-redux';+import { useDispatch, useSelector } from 'react-redux';+import { IReduxState } from '../../../app/types';import AudioTranslationDialog from '../../../audio-translation/components/web/AudioTranslationDialog';+import { getEffectiveTranslationLanguage } from '../../../audio-translation/functions';import { openDialog } from '../../../base/dialog/actions';import { IconTranslate } from '../../../base/icons/svg';+import DisabledReasonTooltip from '../../../base/tooltip/components/DisabledReasonTooltip';import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';+import { isE2EEOnInMeeting } from '../../../e2ee/functions';import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';import { IButtonProps } from '../../types';@@ -20,6 +24,11 @@ const TranslateParticipantButton = ({ notifyClick, notifyMode, participantID }:const dispatch = useDispatch();const { t } = useTranslation();+ // Live translation is ruled out while end-to-end encryption is on; one already on can still be turned off.+ const disabled = useSelector((state: IReduxState) => isE2EEOnInMeeting(state)+ && !getEffectiveTranslationLanguage(state, participantID));+ const reason = disabled ? t('audioTranslation.unavailableWithE2EE') : undefined;+const _onClick = useCallback(() => {notifyClick?.();if (notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY) {@@ -29,11 +38,15 @@ const TranslateParticipantButton = ({ notifyClick, notifyMode, participantID }:}, [ dispatch, notifyClick, notifyMode, participantID ]);return (- <ContextMenuItem- accessibilityLabel = { t('toolbar.audioTranslation') }- icon = { IconTranslate }- onClick = { _onClick }- text = { t('toolbar.audioTranslation') } />+ <DisabledReasonTooltip reason = { reason }>+ <ContextMenuItem+ accessibilityLabel = { t('toolbar.audioTranslation') }+ description = { reason }+ disabled = { disabled }+ icon = { IconTranslate }+ onClick = { _onClick }+ text = { t('toolbar.audioTranslation') } />+ </DisabledReasonTooltip>);};diff --git a/tests/pageobjects/SecurityDialog.ts b/tests/pageobjects/SecurityDialog.tsindex a89eae2d53..9ea222ffdd 100644--- a/tests/pageobjects/SecurityDialog.ts+++ b/tests/pageobjects/SecurityDialog.ts@@ -26,6 +26,20 @@ export default class SecurityDialog extends BaseDialog {return this.participant.driver.$('#lobby-section-switch');}+ /**+ * Returns whether the end-to-end encryption switch can be used.+ */+ isE2EESwitchEnabled() {+ return this.participant.driver.$('#e2ee-section-switch').isEnabled();+ }++ /**+ * Returns the end-to-end encryption section's description.+ */+ getE2EEDescription() {+ return this.participant.driver.$('#e2ee-section-description').getText();+ }+/*** Returns is the lobby enabled.*/diff --git a/tests/specs/iframe/e2eeExclusion.spec.ts b/tests/specs/iframe/e2eeExclusion.spec.tsnew file mode 100644index 0000000000..d8dd712653--- /dev/null+++ b/tests/specs/iframe/e2eeExclusion.spec.ts@@ -0,0 +1,94 @@+import { expect } from '@wdio/globals';++import type { Participant } from '../../helpers/Participant';+import { setTestProperties } from '../../helpers/TestProperties';+import { ensureOneParticipant } from '../../helpers/participants';++import { checkIframeApi } from './util';++setTestProperties(__filename, {+ usesBrowsers: [ 'p1' ]+});++describe('E2EE and server-side transcription/translation exclude each other', () => {+ let p1: Participant;++ /** Sets the Spanish translation listener count in conference metadata. */+ async function setTranslationListeners(count: number) {+ await p1.switchToIFrame();+ await p1.execute(listeners => {+ const { metadata } = APP.store.getState()['features/base/conference'];++ APP.store.dispatch({+ type: 'UPDATE_CONFERENCE_METADATA',+ metadata: {+ ...metadata,+ audioTranslationListenerCounts: listeners ? { speaker: { es: listeners } } : {}+ }+ });+ }, count);+ }++ const isE2EEOn = () => p1.execute(() => APP.store.getState()['features/e2ee'].enabled);++ it('joining the meeting', async () => {+ await ensureOneParticipant({}, { name: 'p1', iFrameApi: true });++ p1 = ctx.p1;++ if (!await checkIframeApi(p1)) {+ return;+ }++ await p1.switchToIFrame();+ if (!await p1.execute(() => Boolean(APP.conference._room?.isE2EESupported())+ && APP.store.getState()['features/base/participants'].local?.role === 'moderator')) {+ ctx.skipSuiteTests = 'E2EE is not available to this participant';+ }+ });++ it('the iframe API cannot turn E2EE on while live translation is in use', async () => {+ await setTranslationListeners(1);++ await p1.switchToMainFrame();+ await p1.getIframeAPI().executeCommand('toggleE2EE', true);++ await p1.switchToIFrame();+ await p1.driver.pause(2000);+ expect(await isE2EEOn()).toBe(false);+ });++ it('the security dialog keeps the E2EE switch disabled and says why', async () => {+ await p1.switchToIFrame();+ await p1.getToolbar().clickSecurityButton();++ const dialog = p1.getSecurityDialog();++ await dialog.waitForDisplay();+ expect(await dialog.isE2EESwitchEnabled()).toBe(false);+ expect(await dialog.getE2EEDescription()).toContain('live translation');+ await dialog.clickCloseButton();+ });++ it('the iframe API turns E2EE on once translation stops', async () => {+ await setTranslationListeners(0);++ await p1.switchToMainFrame();+ await p1.getIframeAPI().executeCommand('toggleE2EE', true);++ await p1.switchToIFrame();+ await p1.driver.waitUntil(isE2EEOn, {+ timeout: 5000,+ timeoutMsg: 'E2EE did not turn on'+ });+ });++ it('with E2EE on, subtitles requested through the iframe API are refused', async () => {+ await p1.switchToMainFrame();+ await p1.getIframeAPI().executeCommand('setSubtitles', true);++ await p1.switchToIFrame();+ await p1.driver.pause(2000);+ expect(await p1.execute(() => APP.store.getState()['features/subtitles']._requestingSubtitles)).toBe(false);+ });+});