@@ -268,7 +268,7 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticat
268
268
CFDataRef exceptions = SecTrustCopyExceptions (serverTrust);
269
269
SecTrustSetExceptions (serverTrust, exceptions);
270
270
CFRelease (exceptions);
271
- completionHandler (NSURLSessionAuthChallengeUseCredential , [NSURLCredential credentialForTrust: serverTrust]);
271
+ completionHandler (NSURLSessionAuthChallengeUseCredential , [NSURLCredential credentialForTrust: serverTrust]); // FortityFalsePositive
272
272
273
273
return ;
274
274
}
@@ -301,7 +301,8 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
301
301
302
302
NSString *requestId = [body cdvwkStringForKey: @" id" ];
303
303
NSString *callbackFunction = [body cdvwkStringForKey: @" callback" ];
304
- NSString *urlString = [body cdvwkStringForKey: @" url" ];
304
+ NSString *urlStringNotEncoded = [body cdvwkStringForKey: @" url" ];
305
+ NSString *urlString = [urlStringNotEncoded stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLQueryAllowedCharacterSet];
305
306
NSString *method = [body cdvwkStringForKey: @" method" ];
306
307
307
308
__weak WKWebView * weakWebView = webView;
@@ -313,7 +314,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
313
314
NSData * json = [NSJSONSerialization dataWithJSONObject: result options: 0 error: &jsonError];
314
315
315
316
if (jsonError != nil ) {
316
- NSLog (@" NativeXHR: Failed to encode response to json: %@ " , jsonError.localizedDescription );
317
+ NSLog (@" NativeXHR: Failed to encode response to json: %@ " , jsonError.localizedDescription ); // FortityFalsePositive
317
318
318
319
NSString *script = [NSString stringWithFormat: @" try { %@ ('%@ ', {'error' : 'json serialization failed'}) } catch (e) { }" , callbackFunction, requestId];
319
320
[weakWebView evaluateJavaScript: script completionHandler: nil ];
@@ -339,7 +340,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
339
340
NSURL *url = [NSURL URLWithString: urlString];
340
341
341
342
if (![url.scheme.lowercaseString isEqualToString: @" http" ] && ![url.scheme.lowercaseString isEqualToString: @" https" ]) {
342
- NSString *msg = [NSString stringWithFormat: @" NativeXHR: Invalid url scheme '%@ '; only http and https are supported by NativeXHR" , url.scheme ];
343
+ NSString *msg = [NSString stringWithFormat: @" NativeXHR: Invalid url scheme '%@ '; only http and https are supported by NativeXHR" , urlString ];
343
344
return sendResult ( @{ @" error" : msg});
344
345
}
345
346
@@ -367,7 +368,7 @@ - (void) performNativeXHR:(NSDictionary<NSString *, id> *) body inWebView:(WKWeb
367
368
request.HTTPBody = [[NSData alloc ] initWithBase64EncodedString: body64 options: 0 ];
368
369
}
369
370
370
- NSURLSessionDataTask *task = [self .urlSession dataTaskWithRequest: request completionHandler: ^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
371
+ NSURLSessionDataTask *task = [self .urlSession dataTaskWithRequest: request completionHandler: ^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { // FortityFalsePositive
371
372
372
373
NSMutableDictionary * result = [NSMutableDictionary dictionary ];
373
374
0 commit comments