Переглянути джерело

fix(config): add whitelisting for interface config

For now all keys are whitelisted.
j8
Leonard Kim 5 роки тому
джерело
коміт
1010f53a84

+ 7
- 0
interface_config.js Переглянути файл

@@ -221,6 +221,13 @@ var interfaceConfig = {
221 221
      * milliseconds, those notifications should remain displayed.
222 222
      */
223 223
     // ENFORCE_NOTIFICATION_AUTO_DISMISS_TIMEOUT: 15000,
224
+
225
+    // List of undocumented settings
226
+    /**
227
+     INDICATOR_FONT_SIZES
228
+     MOBILE_DYNAMIC_LINK
229
+     PHONE_NUMBER_REGEX
230
+    */
224 231
 };
225 232
 
226 233
 /* eslint-enable no-unused-vars, no-var, max-len */

+ 137
- 0
react/features/base/config/configWhitelist.js Переглянути файл

@@ -0,0 +1,137 @@
1
+/**
2
+ * The config keys to whitelist, the keys that can be overridden.
3
+ * Currently we can only whitelist the first part of the properties, like
4
+ * 'p2p.useStunTurn' and 'p2p.enabled' we whitelist all p2p options.
5
+ * The whitelist is used only for config.js.
6
+ *
7
+ * @type Array
8
+ */
9
+export default [
10
+    '_desktopSharingSourceDevice',
11
+    '_peerConnStatusOutOfLastNTimeout',
12
+    '_peerConnStatusRtcMuteTimeout',
13
+    'abTesting',
14
+    'analytics.disabled',
15
+    'autoRecord',
16
+    'autoRecordToken',
17
+    'avgRtpStatsN',
18
+    'callFlowsEnabled',
19
+    'callStatsConfIDNamespace',
20
+    'callStatsID',
21
+    'callStatsSecret',
22
+
23
+    /**
24
+     * The display name of the CallKit call representing the conference/meeting
25
+     * associated with this config.js including while the call is ongoing in the
26
+     * UI presented by CallKit and in the system-wide call history. The property
27
+     * is meant for use cases in which the room name is not desirable as a
28
+     * display name for CallKit purposes and the desired display name is not
29
+     * provided in the form of a JWT callee. As the value is associated with a
30
+     * conference/meeting, the value makes sense not as a deployment-wide
31
+     * configuration, only as a runtime configuration override/overwrite
32
+     * provided by, for example, Jitsi Meet SDK for iOS.
33
+     *
34
+     * @type string
35
+     */
36
+    'callDisplayName',
37
+
38
+    /**
39
+     * The handle
40
+     * ({@link https://developer.apple.com/documentation/callkit/cxhandle}) of
41
+     * the CallKit call representing the conference/meeting associated with this
42
+     * config.js. The property is meant for use cases in which the room URL is
43
+     * not desirable as the handle for CallKit purposes. As the value is
44
+     * associated with a conference/meeting, the value makes sense not as a
45
+     * deployment-wide configuration, only as a runtime configuration
46
+     * override/overwrite provided by, for example, Jitsi Meet SDK for iOS.
47
+     *
48
+     * @type string
49
+     */
50
+    'callHandle',
51
+
52
+    /**
53
+     * The UUID of the CallKit call representing the conference/meeting
54
+     * associated with this config.js. The property is meant for use cases in
55
+     * which Jitsi Meet is to work with a CallKit call created outside of Jitsi
56
+     * Meet and to be adopted by Jitsi Meet such as, for example, an incoming
57
+     * and/or outgoing CallKit call created by Jitsi Meet SDK for iOS
58
+     * clients/consumers prior to giving control to Jitsi Meet. As the value is
59
+     * associated with a conference/meeting, the value makes sense not as a
60
+     * deployment-wide configuration, only as a runtime configuration
61
+     * override/overwrite provided by, for example, Jitsi Meet SDK for iOS.
62
+     *
63
+     * @type string
64
+     */
65
+    'callUUID',
66
+
67
+    'channelLastN',
68
+    'constraints',
69
+    'debug',
70
+    'debugAudioLevels',
71
+    'defaultLanguage',
72
+    'desktopSharingChromeDisabled',
73
+    'desktopSharingChromeExtId',
74
+    'desktopSharingChromeMinExtVersion',
75
+    'desktopSharingChromeSources',
76
+    'desktopSharingFrameRate',
77
+    'desktopSharingFirefoxDisabled',
78
+    'desktopSharingSources',
79
+    'disable1On1Mode',
80
+    'disableAEC',
81
+    'disableAGC',
82
+    'disableAP',
83
+    'disableAudioLevels',
84
+    'disableDeepLinking',
85
+    'disableH264',
86
+    'disableHPF',
87
+    'disableNS',
88
+    'disableRemoteControl',
89
+    'disableRtx',
90
+    'disableSuspendVideo',
91
+    'displayJids',
92
+    'e2eping',
93
+    'enableDisplayNameInStats',
94
+    'enableLayerSuspension',
95
+    'enableLipSync',
96
+    'disableLocalVideoFlip',
97
+    'enableRemb',
98
+    'enableStatsID',
99
+    'enableTalkWhileMuted',
100
+    'enableTcc',
101
+    'etherpad_base',
102
+    'failICE',
103
+    'fileRecordingsEnabled',
104
+    'firefox_fake_device',
105
+    'forceJVB121Ratio',
106
+    'gatherStats',
107
+    'googleApiApplicationClientID',
108
+    'hiddenDomain',
109
+    'hosts',
110
+    'iAmRecorder',
111
+    'iAmSipGateway',
112
+    'iceTransportPolicy',
113
+    'ignoreStartMuted',
114
+    'liveStreamingEnabled',
115
+    'localRecording',
116
+    'minParticipants',
117
+    'nick',
118
+    'openBridgeChannel',
119
+    'p2p',
120
+    'preferH264',
121
+    'requireDisplayName',
122
+    'resolution',
123
+    'startAudioMuted',
124
+    'startAudioOnly',
125
+    'startBitrate',
126
+    'startSilent',
127
+    'startScreenSharing',
128
+    'startVideoMuted',
129
+    'startWithVideoMuted',
130
+    'subject',
131
+    'testing',
132
+    'useIPv6',
133
+    'useNicks',
134
+    'useStunTurn',
135
+    'webrtcIceTcpDisable',
136
+    'webrtcIceUdpDisable'
137
+];

+ 9
- 145
react/features/base/config/functions.any.js Переглянути файл

@@ -2,152 +2,14 @@
2 2
 
3 3
 import _ from 'lodash';
4 4
 
5
+import CONFIG_WHITELIST from './configWhitelist';
5 6
 import { _CONFIG_STORE_PREFIX } from './constants';
7
+import INTERFACE_CONFIG_WHITELIST from './interfaceConfigWhitelist';
6 8
 import parseURLParams from './parseURLParams';
7 9
 import logger from './logger';
8 10
 
9 11
 declare var $: Object;
10 12
 
11
-/**
12
- * The config keys to whitelist, the keys that can be overridden.
13
- * Currently we can only whitelist the first part of the properties, like
14
- * 'p2p.useStunTurn' and 'p2p.enabled' we whitelist all p2p options.
15
- * The whitelist is used only for config.js.
16
- *
17
- * @private
18
- * @type Array
19
- */
20
-const WHITELISTED_KEYS = [
21
-    '_desktopSharingSourceDevice',
22
-    '_peerConnStatusOutOfLastNTimeout',
23
-    '_peerConnStatusRtcMuteTimeout',
24
-    'abTesting',
25
-    'analytics.disabled',
26
-    'autoRecord',
27
-    'autoRecordToken',
28
-    'avgRtpStatsN',
29
-    'callFlowsEnabled',
30
-    'callStatsConfIDNamespace',
31
-    'callStatsID',
32
-    'callStatsSecret',
33
-
34
-    /**
35
-     * The display name of the CallKit call representing the conference/meeting
36
-     * associated with this config.js including while the call is ongoing in the
37
-     * UI presented by CallKit and in the system-wide call history. The property
38
-     * is meant for use cases in which the room name is not desirable as a
39
-     * display name for CallKit purposes and the desired display name is not
40
-     * provided in the form of a JWT callee. As the value is associated with a
41
-     * conference/meeting, the value makes sense not as a deployment-wide
42
-     * configuration, only as a runtime configuration override/overwrite
43
-     * provided by, for example, Jitsi Meet SDK for iOS.
44
-     *
45
-     * @type string
46
-     */
47
-    'callDisplayName',
48
-
49
-    /**
50
-     * The handle
51
-     * ({@link https://developer.apple.com/documentation/callkit/cxhandle}) of
52
-     * the CallKit call representing the conference/meeting associated with this
53
-     * config.js. The property is meant for use cases in which the room URL is
54
-     * not desirable as the handle for CallKit purposes. As the value is
55
-     * associated with a conference/meeting, the value makes sense not as a
56
-     * deployment-wide configuration, only as a runtime configuration
57
-     * override/overwrite provided by, for example, Jitsi Meet SDK for iOS.
58
-     *
59
-     * @type string
60
-     */
61
-    'callHandle',
62
-
63
-    /**
64
-     * The UUID of the CallKit call representing the conference/meeting
65
-     * associated with this config.js. The property is meant for use cases in
66
-     * which Jitsi Meet is to work with a CallKit call created outside of Jitsi
67
-     * Meet and to be adopted by Jitsi Meet such as, for example, an incoming
68
-     * and/or outgoing CallKit call created by Jitsi Meet SDK for iOS
69
-     * clients/consumers prior to giving control to Jitsi Meet. As the value is
70
-     * associated with a conference/meeting, the value makes sense not as a
71
-     * deployment-wide configuration, only as a runtime configuration
72
-     * override/overwrite provided by, for example, Jitsi Meet SDK for iOS.
73
-     *
74
-     * @type string
75
-     */
76
-    'callUUID',
77
-
78
-    'channelLastN',
79
-    'constraints',
80
-    'debug',
81
-    'debugAudioLevels',
82
-    'defaultLanguage',
83
-    'desktopSharingChromeDisabled',
84
-    'desktopSharingChromeExtId',
85
-    'desktopSharingChromeMinExtVersion',
86
-    'desktopSharingChromeSources',
87
-    'desktopSharingFrameRate',
88
-    'desktopSharingFirefoxDisabled',
89
-    'desktopSharingSources',
90
-    'disable1On1Mode',
91
-    'disableAEC',
92
-    'disableAGC',
93
-    'disableAP',
94
-    'disableAudioLevels',
95
-    'disableDeepLinking',
96
-    'disableH264',
97
-    'disableHPF',
98
-    'disableNS',
99
-    'disableRemoteControl',
100
-    'disableRtx',
101
-    'disableSuspendVideo',
102
-    'displayJids',
103
-    'e2eping',
104
-    'enableDisplayNameInStats',
105
-    'enableLayerSuspension',
106
-    'enableLipSync',
107
-    'disableLocalVideoFlip',
108
-    'enableRemb',
109
-    'enableStatsID',
110
-    'enableTalkWhileMuted',
111
-    'enableTcc',
112
-    'etherpad_base',
113
-    'failICE',
114
-    'fileRecordingsEnabled',
115
-    'firefox_fake_device',
116
-    'forceJVB121Ratio',
117
-    'gatherStats',
118
-    'googleApiApplicationClientID',
119
-    'hiddenDomain',
120
-    'hosts',
121
-    'iAmRecorder',
122
-    'iAmSipGateway',
123
-    'iceTransportPolicy',
124
-    'ignoreStartMuted',
125
-    'liveStreamingEnabled',
126
-    'localRecording',
127
-    'minParticipants',
128
-    'nick',
129
-    'openBridgeChannel',
130
-    'p2p',
131
-    'preferH264',
132
-    'requireDisplayName',
133
-    'resolution',
134
-    'startAudioMuted',
135
-    'startAudioOnly',
136
-    'startBitrate',
137
-    'startSilent',
138
-    'startScreenSharing',
139
-    'startVideoMuted',
140
-    'startWithAudioMuted',
141
-    'startWithVideoMuted',
142
-    'subject',
143
-    'testing',
144
-    'useIPv6',
145
-    'useNicks',
146
-    'useStunTurn',
147
-    'webrtcIceTcpDisable',
148
-    'webrtcIceUdpDisable'
149
-];
150
-
151 13
 // XXX The functions getRoomName and parseURLParams are split out of
152 14
 // functions.js because they are bundled in both app.bundle and
153 15
 // do_external_connect, webpack 1 does not support tree shaking, and we don't
@@ -306,8 +168,8 @@ export function overrideConfigJSON(
306 168
 /* eslint-enable max-params, no-shadow */
307 169
 
308 170
 /**
309
- * Whitelist only config.js, skips this for others configs
310
- * (interfaceConfig, loggingConfig).
171
+ * Apply whitelist filtering for configs with whitelists, skips this for others
172
+ * configs (loggingConfig).
311 173
  * Only extracts overridden values for keys we allow to be overridden.
312 174
  *
313 175
  * @param {string} configName - The config name, one of config,
@@ -318,11 +180,13 @@ export function overrideConfigJSON(
318 180
  * that are whitelisted.
319 181
  */
320 182
 function _getWhitelistedJSON(configName, configJSON) {
321
-    if (configName !== 'config') {
322
-        return configJSON;
183
+    if (configName === 'interfaceConfig') {
184
+        return _.pick(configJSON, INTERFACE_CONFIG_WHITELIST);
185
+    } else if (configName === 'config') {
186
+        return _.pick(configJSON, CONFIG_WHITELIST);
323 187
     }
324 188
 
325
-    return _.pick(configJSON, WHITELISTED_KEYS);
189
+    return configJSON;
326 190
 }
327 191
 
328 192
 /**

+ 70
- 0
react/features/base/config/interfaceConfigWhitelist.js Переглянути файл

@@ -0,0 +1,70 @@
1
+/**
2
+ * The interface config keys to whitelist, the keys that can be overridden.
3
+ *
4
+ * @private
5
+ * @type Array
6
+ */
7
+export default [
8
+    'ANDROID_APP_PACKAGE',
9
+    'APP_NAME',
10
+    'APP_SCHEME',
11
+    'AUDIO_LEVEL_PRIMARY_COLOR',
12
+    'AUDIO_LEVEL_SECONDARY_COLOR',
13
+    'AUTHENTICATION_ENABLE',
14
+    'AUTO_PIN_LATEST_SCREEN_SHARE',
15
+    'BRAND_WATERMARK_LINK',
16
+    'CLOSE_PAGE_GUEST_HINT',
17
+    'CONNECTION_INDICATOR_AUTO_HIDE_ENABLED',
18
+    'CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT',
19
+    'CONNECTION_INDICATOR_DISABLED',
20
+    'DEFAULT_BACKGROUND',
21
+    'DEFAULT_LOCAL_DISPLAY_NAME',
22
+    'DEFAULT_REMOTE_DISPLAY_NAME',
23
+    'DISABLE_DOMINANT_SPEAKER_INDICATOR',
24
+    'DISABLE_FOCUS_INDICATOR',
25
+    'DISABLE_RINGING',
26
+    'DISABLE_TRANSCRIPTION_SUBTITLES',
27
+    'DISABLE_VIDEO_BACKGROUND',
28
+    'DISPLAY_WELCOME_PAGE_CONTENT',
29
+    'ENABLE_FEEDBACK_ANIMATION',
30
+    'ENFORCE_NOTIFICATION_AUTO_DISMISS_TIMEOUT',
31
+    'FILM_STRIP_MAX_HEIGHT',
32
+    'GENERATE_ROOMNAMES_ON_WELCOME_PAGE',
33
+    'INDICATOR_FONT_SIZES',
34
+    'INITIAL_TOOLBAR_TIMEOUT',
35
+    'INVITATION_POWERED_BY',
36
+    'JITSI_WATERMARK_LINK',
37
+    'LANG_DETECTION',
38
+    'LIVE_STREAMING_HELP_LINK',
39
+    'LOCAL_THUMBNAIL_RATIO',
40
+    'MAXIMUM_ZOOMING_COEFFICIENT',
41
+    'MOBILE_APP_PROMO',
42
+    'MOBILE_DOWNLOAD_LINK_ANDROID',
43
+    'MOBILE_DOWNLOAD_LINK_IOS',
44
+    'MOBILE_DYNAMIC_LINK',
45
+    'NATIVE_APP_NAME',
46
+    'OPTIMAL_BROWSERS',
47
+    'PHONE_NUMBER_REGEX',
48
+    'POLICY_LOGO',
49
+    'PROVIDER_NAME',
50
+    'RANDOM_AVATAR_URL_PREFIX',
51
+    'RANDOM_AVATAR_URL_SUFFIX',
52
+    'RECENT_LIST_ENABLED',
53
+    'REMOTE_THUMBNAIL_RATIO',
54
+    'SETTINGS_SECTIONS',
55
+    'SHOW_BRAND_WATERMARK',
56
+    'SHOW_DEEP_LINKING_IMAGE',
57
+    'SHOW_JITSI_WATERMARK',
58
+    'SHOW_POWERED_BY',
59
+    'SHOW_WATERMARK_FOR_GUESTS',
60
+    'SUPPORT_URL',
61
+    'TILE_VIEW_MAX_COLUMNS',
62
+    'TOOLBAR_ALWAYS_VISIBLE',
63
+    'TOOLBAR_BUTTONS',
64
+    'TOOLBAR_TIMEOUT',
65
+    'UNSUPPORTED_BROWSERS',
66
+    'VERTICAL_FILMSTRIP',
67
+    'VIDEO_LAYOUT_FIT',
68
+    'VIDEO_QUALITY_LABEL_DISABLED',
69
+    'filmStripOnly'
70
+];

Завантаження…
Відмінити
Зберегти