rn: avoid logging initial props in release builds

They may contain sensitive information.
pull/4299/head jitsi-meet_3772
Saúl Ibarra Corretgé 6 years ago committed by Zoltan Bettenbuk
parent ded355a807
commit fa3888991f
  1. 6
      ios/sdk/sdk.xcodeproj/project.pbxproj
  2. 2
      ios/sdk/src/JitsiMeet+Private.h
  3. 11
      ios/sdk/src/JitsiMeetView.m
  4. 20
      ios/sdk/src/RNRootView.h
  5. 45
      ios/sdk/src/RNRootView.m
  6. 22
      react/index.native.js

@ -44,6 +44,7 @@
C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */; };
DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAFA778229EAD520033A7FA /* RNRootView.m */; };
DEFC743F21B178FA00E4DD96 /* LocaleDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFC743D21B178FA00E4DD96 /* LocaleDetector.m */; };
DEFE535421FB1BF800011A3A /* JitsiMeet.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535321FB1BF800011A3A /* JitsiMeet.m */; };
DEFE535621FB2E8300011A3A /* ReactUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535521FB2E8300011A3A /* ReactUtils.m */; };
@ -96,6 +97,8 @@
DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetConferenceOptions.h; sourceTree = "<group>"; };
DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetConferenceOptions.m; sourceTree = "<group>"; };
DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetConferenceOptions+Private.h"; sourceTree = "<group>"; };
DEAFA777229EAD3B0033A7FA /* RNRootView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNRootView.h; sourceTree = "<group>"; };
DEAFA778229EAD520033A7FA /* RNRootView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNRootView.m; sourceTree = "<group>"; };
DEFC743D21B178FA00E4DD96 /* LocaleDetector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocaleDetector.m; sourceTree = "<group>"; };
DEFE535321FB1BF800011A3A /* JitsiMeet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeet.m; sourceTree = "<group>"; };
DEFE535521FB2E8300011A3A /* ReactUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactUtils.m; sourceTree = "<group>"; };
@ -173,6 +176,8 @@
DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */,
0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
DEAFA777229EAD3B0033A7FA /* RNRootView.h */,
DEAFA778229EAD520033A7FA /* RNRootView.m */,
C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */,
0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */,
DEFC743D21B178FA00E4DD96 /* LocaleDetector.m */,
@ -478,6 +483,7 @@
files = (
0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */,
0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */,

@ -14,6 +14,8 @@
* limitations under the License.
*/
#import <React/RCTBridge.h>
#import "JitsiMeet.h"
@interface JitsiMeet ()

@ -17,12 +17,11 @@
#include <mach/mach_time.h>
#import <React/RCTRootView.h>
#import "JitsiMeet+Private.h"
#import "JitsiMeetConferenceOptions+Private.h"
#import "JitsiMeetView+Private.h"
#import "ReactUtils.h"
#import "RNRootView.h"
@implementation JitsiMeetView {
@ -36,7 +35,7 @@
/**
* React Native view where the entire content will be rendered.
*/
RCTRootView *rootView;
RNRootView *rootView;
}
/**
@ -145,9 +144,9 @@ static void initializeViewsMap() {
} else {
RCTBridge *bridge = [[JitsiMeet sharedInstance] getReactBridge];
rootView
= [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"App"
initialProperties:props];
= [[RNRootView alloc] initWithBridge:bridge
moduleName:@"App"
initialProperties:props];
rootView.backgroundColor = self.backgroundColor;
// Add rootView as a subview which completely covers this one.

@ -0,0 +1,20 @@
/*
* Copyright @ 2019-present 8x8, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <React/RCTRootView.h>
@interface RNRootView : RCTRootView
@end

@ -0,0 +1,45 @@
/*
* Copyright @ 2019-present 8x8, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <React/RCTRootContentView.h>
#import <React/RCTLog.h>
#import "RNRootView.h"
@implementation RNRootView
// Monkey-patch RCTRootView.runApplication to avoid logging initial props.
- (void)runApplication:(RCTBridge *)bridge
{
NSString *moduleName = [self valueForKey:@"_moduleName"] ?: @"";
RCTRootContentView *_contentView = [self valueForKey:@"_contentView"];
NSNumber *reactTag = [_contentView valueForKey:@"reactTag"];
NSDictionary *appParameters = @{
@"rootTag": reactTag,
@"initialProps": self.appProperties ?: @{},
};
#if DEBUG
RCTLogInfo(@"Running application %@ (%@)", moduleName, appParameters);
#endif
[bridge enqueueJSCall:@"AppRegistry"
method:@"runApplication"
args:@[moduleName, appParameters]
completion:NULL];
}
@end

@ -16,6 +16,8 @@ import { AppRegistry } from 'react-native';
import { App } from './features/app';
import { IncomingCallApp } from './features/mobile/incoming-call';
declare var __DEV__;
/**
* The type of the React {@code Component} props of {@link Root}.
*/
@ -49,6 +51,26 @@ class Root extends PureComponent<Props> {
}
}
// HORRIBLE HACK ALERT! React Native logs the initial props with `console.log`. Here we are quickly patching it
// to avoid logging potentially sensitive information.
if (!__DEV__) {
/* eslint-disable */
const __orig_console_log = console.log;
const __orig_appregistry_runapplication = AppRegistry.runApplication;
AppRegistry.runApplication = (...args) => {
// $FlowExpectedError
console.log = () => {};
__orig_appregistry_runapplication(...args);
// $FlowExpectedError
console.log = __orig_console_log;
};
/* eslint-enable */
}
// Register the main/root Component of JitsiMeetView.
AppRegistry.registerComponent('App', () => Root);

Loading…
Cancel
Save