Skip to content

Commit 0c816a5

Browse files
author
Kowshickkarthick Subramanian
committed
Merge pull request #312 in MOBILE-SDK/app_mobile-sdk-android from MS-3958-HotFix to master
* commit '917a1224c42dd94e8771153c7f943b95372b224a': MS-3958 HotFix
2 parents 48ce278 + 917a122 commit 0c816a5

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

RELEASE-NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.5.1
2+
### Bug Fixes/Improvements
3+
+ MS-3958: Added Security check to see if it's a valid HTTP URL before loading it.
4+
15
## 5.5
26
### New Features
37
+ MS-3778: Added new API to get Video Orientation for BannerVideo and Video Ads

sdk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Project properties
2-
version = "5.5"
2+
version = "5.5.1"
33
group='com.appnexus.opensdk'
44

55
// Android build
@@ -9,7 +9,7 @@ android {
99
compileSdkVersion 28
1010
buildToolsVersion '29.0.0'
1111
defaultConfig {
12-
versionCode 58 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
12+
versionCode 59 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
1313
versionName version
1414
consumerProguardFiles 'proguard-project.txt'
1515
minSdkVersion 9

sdk/src/com/appnexus/opensdk/AdWebView.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import android.os.Handler;
3636
import android.util.DisplayMetrics;
3737
import android.util.Pair;
38+
import android.util.Patterns;
3839
import android.view.Gravity;
3940
import android.view.MotionEvent;
4041
import android.view.View;
@@ -73,6 +74,9 @@
7374
import java.io.Reader;
7475
import java.io.StringWriter;
7576
import java.io.Writer;
77+
import java.net.MalformedURLException;
78+
import java.net.URISyntaxException;
79+
import java.net.URL;
7680
import java.util.Date;
7781
import java.util.HashMap;
7882

@@ -559,6 +563,16 @@ private boolean openNativeIntent(String url) {
559563
}
560564
}
561565

566+
private boolean isValidUrl(String url) {
567+
try {
568+
new URL(url).toURI();
569+
return Patterns.WEB_URL.matcher(url).matches();
570+
} catch (MalformedURLException | URISyntaxException e) {
571+
e.printStackTrace();
572+
return false;
573+
}
574+
}
575+
562576
// returns success or failure
563577
private boolean checkForApp(String url) {
564578
if (url.contains("://play.google.com") || (!url.startsWith("http") && !url.startsWith("about:blank"))) {
@@ -605,6 +619,12 @@ void loadURLInCorrectBrowser(String url) {
605619
return;
606620
}
607621

622+
623+
//If it's an invalid http url return without loading it.
624+
if (!isValidUrl(url)) {
625+
return;
626+
}
627+
608628
try {
609629

610630
final WebView out;

sdk/src/com/appnexus/opensdk/utils/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class Settings {
4545
public boolean debug_mode = false; // This should always be false here.
4646
public String ua = null;
4747

48-
public final String sdkVersion = "5.5";
48+
public final String sdkVersion = "5.5.1";
4949

5050
public String mcc;
5151
public String mnc;

0 commit comments

Comments
 (0)