You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/09/12 01:07:38 UTC

cordova-plugin-whitelist git commit: CB-9568 - Update whitelist plugin to allow all network access by default

Repository: cordova-plugin-whitelist
Updated Branches:
  refs/heads/master be33970b4 -> 715491a59


CB-9568 - Update whitelist plugin to allow all network access by default


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-whitelist/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-whitelist/commit/715491a5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-whitelist/tree/715491a5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-whitelist/diff/715491a5

Branch: refs/heads/master
Commit: 715491a599d97eed11c0f245cafe2fc596004665
Parents: be33970
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Sep 11 16:11:33 2015 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Sep 11 16:11:33 2015 -0700

----------------------------------------------------------------------
 src/ios/CDVWhitelistPlugin.m | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-whitelist/blob/715491a5/src/ios/CDVWhitelistPlugin.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVWhitelistPlugin.m b/src/ios/CDVWhitelistPlugin.m
index 7785879..b612668 100644
--- a/src/ios/CDVWhitelistPlugin.m
+++ b/src/ios/CDVWhitelistPlugin.m
@@ -26,6 +26,7 @@
 
 @property (nonatomic, strong) NSMutableArray* navigationWhitelistHosts;
 @property (nonatomic, strong) NSMutableArray* accessWhitelistHosts;
+@property (nonatomic, strong) NSArray* defaultHosts;
 
 @end
 
@@ -37,14 +38,14 @@
 {
     self = [super init];
     if (self != nil) {
-        NSArray* defaultHosts = @[
-                                  @"file:///*",
-                                  @"content:///*",
-                                  @"data:///*"
-                                  ];
-
-        self.navigationWhitelistHosts = [[NSMutableArray alloc] initWithArray:defaultHosts];
-        self.accessWhitelistHosts = [[NSMutableArray alloc] initWithArray:defaultHosts];
+        self.defaultHosts = @[
+                              @"file:///*",
+                              @"content:///*",
+                              @"data:///*"
+                             ];
+
+        self.navigationWhitelistHosts = [[NSMutableArray alloc] initWithArray:self.defaultHosts];
+        self.accessWhitelistHosts = [[NSMutableArray alloc] initWithArray:self.defaultHosts];
     }
     return self;
 }
@@ -88,6 +89,10 @@
         CDVWhitelistConfigParser *whitelistConfigParser = [[CDVWhitelistConfigParser alloc] init];
         [(CDVViewController *)viewController parseSettingsWithParser:whitelistConfigParser];
         self.navigationWhitelist = [[CDVWhitelist alloc] initWithArray:whitelistConfigParser.navigationWhitelistHosts];
+        // if no access tags set, default to * (https://issues.apache.org/jira/browse/CB-9568)
+        if ([whitelistConfigParser.accessWhitelistHosts isEqualToArray:whitelistConfigParser.defaultHosts]) {
+            [whitelistConfigParser.accessWhitelistHosts addObject:@"*"];
+        }
         self.accessWhitelist = [[CDVWhitelist alloc] initWithArray:whitelistConfigParser.accessWhitelistHosts];
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org