cordova-plugin-mserviceinterface-2.0 1.0.37 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.37",
3
+ "version": "1.0.40",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
3
  xmlns:android="http://schemas.android.com/apk/res/android"
4
4
  id="cordova-plugin-mserviceinterface-2.0"
5
- version="1.0.37">
5
+ version="1.0.40">
6
6
  <name>mserviceinterface-2.0</name>
7
7
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
8
8
  <author>selfservit@gmail.com</author>
@@ -2262,6 +2262,15 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
2262
2262
  while ((ze = zis.getNextEntry()) != null) {
2263
2263
  anyEntries = true;
2264
2264
  String compressedName = ze.getName();
2265
+ File outputFile = new File(outputDir, ze.getName());
2266
+ try {
2267
+ ensureZipPathSafety(outputFile, outputDirectory);
2268
+ } catch (Exception e) {
2269
+ anyEntries = false;
2270
+ e.printStackTrace();
2271
+ callbackContext.error("Bad zip file");
2272
+ return;
2273
+ };
2265
2274
  if (ze.isDirectory()) {
2266
2275
  File dir = new File(outputDirectory + compressedName);
2267
2276
  dir.mkdirs();
@@ -2297,6 +2306,13 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
2297
2306
  }
2298
2307
  }
2299
2308
  }
2309
+ private void ensureZipPathSafety(final File outputFile, final String destDirectory) throws Exception {
2310
+ String destDirCanonicalPath = (new File(destDirectory)).getCanonicalPath();
2311
+ String outputFileCanonicalPath = outputFile.getCanonicalPath();
2312
+ if (!outputFileCanonicalPath.startsWith(destDirCanonicalPath)) {
2313
+ throw new Exception(String.format("Found Zip Path Traversal Vulnerability with %s", outputFileCanonicalPath));
2314
+ }
2315
+ }
2300
2316
 
2301
2317
  private Uri getUriForArg(String arg) {
2302
2318
  CordovaResourceApi resourceApi = webView.getResourceApi();
@@ -10,6 +10,8 @@
10
10
  #include <sys/types.h>
11
11
  #include <sys/sysctl.h>
12
12
  #include "TargetConditionals.h"
13
+ #import "OneSignalPush.h"
14
+ #import <OneSignal/OneSignal.h>
13
15
  #import <objc/runtime.h>
14
16
 
15
17
  #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
@@ -27,6 +29,15 @@
27
29
  @synthesize controller = docController;
28
30
  @synthesize callbackID;
29
31
 
32
+ - (void)GetFCMUtils:(CDVInvokedUrlCommand *)command {
33
+ OSDeviceState *deviceState = [OneSignal getDeviceState];
34
+ NSMutableDictionary * deviceDict = [[NSMutableDictionary alloc] init];
35
+ [deviceDict setValue:deviceState.userId forKey:@"userId"];
36
+ [deviceDict setValue:deviceState.pushToken forKey:@"pushToken"];
37
+ CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceDict];
38
+ [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
39
+ }
40
+
30
41
  -(void)GetBase64String:(CDVInvokedUrlCommand *)command {
31
42
  NSMutableDictionary *dict = [[command arguments] objectAtIndex:0];
32
43
  NSString *directory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];