File tree Expand file tree Collapse file tree 13 files changed +1491
-1777
lines changed
android/src/main/java/com/rnziparchive
src/main/java/com/example Expand file tree Collapse file tree 13 files changed +1491
-1777
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ public void onCopyProgress(long bytesRead) {
159159 };
160160
161161 File fout = new File (destDirectory , entry .getName ());
162+ String destDirCanonicalPath = (new File (destDirectory )).getCanonicalPath ();
163+ String canonicalPath = fout .getCanonicalPath ();
164+ if (!canonicalPath .startsWith (destDirCanonicalPath )) {
165+ throw new Exception (String .format ("Found Zip Path Traversal Vulnerability with %s" , canonicalPath ));
166+ }
167+
162168 if (!fout .exists ()) {
163169 //noinspection ResultOfMethodCallIgnored
164170 (new File (fout .getParent ())).mkdirs ();
@@ -245,6 +251,13 @@ public void run() {
245251 while ((entry = zipIn .getNextEntry ()) != null ) {
246252 if (entry .isDirectory ()) continue ;
247253 fout = new File (destDirectory , entry .getName ());
254+
255+ String destDirCanonicalPath = (new File (destDirectory )).getCanonicalPath ();
256+ String canonicalPath = fout .getCanonicalPath ();
257+ if (!canonicalPath .startsWith (destDirCanonicalPath )) {
258+ throw new Exception (String .format ("Found Zip Path Traversal Vulnerability with %s" , canonicalPath ));
259+ }
260+
248261 if (!fout .exists ()) {
249262 //noinspection ResultOfMethodCallIgnored
250263 (new File (fout .getParent ())).mkdirs ();
Original file line number Diff line number Diff line change @@ -10,21 +10,13 @@ import {
1010 StyleSheet ,
1111 View
1212} from 'react-native'
13- import App from './App'
1413import UnzipApp from './UnzipApp'
1514
16- export default class example extends Component {
17- constructor ( ) {
18- super ( )
19- this . state = {
20- unzipWithPassword : true
21- }
22- }
23-
15+ export default class Example extends Component {
2416 render ( ) {
2517 return (
2618 < View style = { styles . container } >
27- { this . state . unzipWithPassword ? ( < UnzipApp /> ) : ( < App /> ) }
19+ < UnzipApp />
2820 </ View >
2921 )
3022 }
@@ -37,4 +29,4 @@ const styles = StyleSheet.create({
3729 }
3830} )
3931
40- AppRegistry . registerComponent ( 'example' , ( ) => example )
32+ AppRegistry . registerComponent ( 'example' , ( ) => Example )
Original file line number Diff line number Diff line change @@ -137,10 +137,10 @@ android {
137137}
138138
139139dependencies {
140+ implementation project(' :react-native-custom-tabs' )
140141 implementation project(' :react-native-zip-archive' )
141142 implementation project(' :react-native-fs' )
142143 implementation project(' :react-native-document-picker' )
143- implementation project(' :react-native-custom-tabs' )
144144 implementation fileTree(dir : " libs" , include : [" *.jar" ])
145145 implementation " com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion} "
146146 implementation " com.facebook.react:react-native:+" // From node_modules
Original file line number Diff line number Diff line change 33import android .app .Application ;
44
55import com .facebook .react .ReactApplication ;
6+ import com .github .droibit .android .reactnative .customtabs .CustomTabsPackage ;
67import com .rnziparchive .RNZipArchivePackage ;
78import com .rnfs .RNFSPackage ;
89import com .reactnativedocumentpicker .ReactNativeDocumentPicker ;
9- import com .github .droibit .android .reactnative .customtabs .CustomTabsPackage ;
1010import com .facebook .react .ReactNativeHost ;
1111import com .facebook .react .ReactPackage ;
1212import com .facebook .react .shell .MainReactPackage ;
@@ -27,10 +27,10 @@ public boolean getUseDeveloperSupport() {
2727 protected List <ReactPackage > getPackages () {
2828 return Arrays .<ReactPackage >asList (
2929 new MainReactPackage (),
30+ new CustomTabsPackage (),
3031 new RNZipArchivePackage (),
3132 new RNFSPackage (),
32- new ReactNativeDocumentPicker (),
33- new CustomTabsPackage ()
33+ new ReactNativeDocumentPicker ()
3434 );
3535 }
3636
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ buildscript {
1313 jcenter()
1414 }
1515 dependencies {
16- classpath ' com.android.tools.build:gradle:3.2 .1'
16+ classpath ' com.android.tools.build:gradle:3.4 .1'
1717
1818 // NOTE: Do not place your application dependencies here; they belong
1919 // in the individual module build.gradle files
@@ -35,8 +35,7 @@ allprojects {
3535 }
3636}
3737
38-
39- task wrapper (type : Wrapper ) {
40- gradleVersion = ' 4.7'
38+ wrapper {
39+ gradleVersion = ' 5.1.1'
4140 distributionUrl = distributionUrl. replace(" bin" , " all" )
4241}
Original file line number Diff line number Diff line change 11distributionBase =GRADLE_USER_HOME
22distributionPath =wrapper/dists
3+ distributionUrl =https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
34zipStoreBase =GRADLE_USER_HOME
45zipStorePath =wrapper/dists
5- distributionUrl =https\://services.gradle.org/distributions/gradle-4.7-all.zip
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ APP_NAME="Gradle"
2828APP_BASE_NAME=` basename " $0 " `
2929
3030# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31- DEFAULT_JVM_OPTS=" "
31+ DEFAULT_JVM_OPTS=' "-Xmx64m" '
3232
3333# Use the maximum available, or set MAX_FD != -1 to use that value.
3434MAX_FD=" maximum"
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
1414set APP_HOME = %DIRNAME%
1515
1616@ rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17- set DEFAULT_JVM_OPTS =
17+ set DEFAULT_JVM_OPTS = " -Xmx64m "
1818
1919@ rem Find java.exe
2020if defined JAVA_HOME goto findJavaFromJavaHome
Original file line number Diff line number Diff line change 11rootProject. name = ' example'
2+ include ' :react-native-custom-tabs'
3+ project(' :react-native-custom-tabs' ). projectDir = new File (rootProject. projectDir, ' ../node_modules/react-native-custom-tabs/android' )
24include ' :react-native-zip-archive'
35project(' :react-native-zip-archive' ). projectDir = new File (rootProject. projectDir, ' ../node_modules/react-native-zip-archive/android' )
46include ' :react-native-fs'
57project(' :react-native-fs' ). projectDir = new File (rootProject. projectDir, ' ../node_modules/react-native-fs/android' )
68include ' :react-native-document-picker'
79project(' :react-native-document-picker' ). projectDir = new File (rootProject. projectDir, ' ../node_modules/react-native-document-picker/android' )
8- include ' :react-native-custom-tabs'
9- project(' :react-native-custom-tabs' ). projectDir = new File (rootProject. projectDir, ' ../node_modules/react-native-custom-tabs/android' )
1010
1111include ' :app'
You can’t perform that action at this time.
0 commit comments