Skip to content

Commit

Permalink
Merge branch 'main' into 18-url-matching-abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
drathar authored Aug 9, 2024
2 parents 825577a + bfe1a14 commit f75dab4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Android WebView wrapper with secure defaults to avoid security issues caused by

Still under heavy development, breaking API changes are expected!


## Setup

The library is currently hosted on `jitpack.io`. You can add it as a depenency to your project:
Expand All @@ -29,7 +28,7 @@ Add it in your root `build.gradle` at the end of repositories:
Step 2. Add the dependency

dependencies {
implementation 'com.github.balazsgerlei:SecureWebView:1.0.0-alpha03'
implementation 'com.github.balazsgerlei:SecureWebView:1.0.0-alpha04'
}


2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ afterEvaluate {
from components.release
groupId = 'dev.gerlot.securewebview'
artifactId = 'securewebview'
version = '1.0.0-alpha03'
version = '1.0.0-alpha04'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ private void init(final Context context) {
}

private boolean shouldBlockRequest(final Uri uri) {
return shouldBlockRequest(uri, false, false);
return shouldBlockRequest(uri, true, false);
}

private boolean shouldBlockRequest(final Uri uri, boolean allowDataUrl, boolean allowJavaScript) {
private boolean shouldBlockRequest(final Uri uri, boolean allowDataUri, boolean allowJavaScript) {
if ("http".equals(uri.getScheme())) {
return true;
}

if (!allowDataUrl && "data".equals(uri.getScheme())) {
if (!allowDataUri && "data".equals(uri.getScheme())) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "dev.gerlot.securewebview.sample"
minSdk 21
targetSdk 34
versionCode 3
versionName "1.0.0-alpha03"
versionCode 4
versionName "1.0.0-alpha04"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
4 changes: 2 additions & 2 deletions sample/src/main/assets/same_origin_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ <h1 id="fetch-status"></h1>
<script>
const status = document.getElementById('fetch-status');

fetch('https://www.google.com')
fetch('https://www.example.com')
.then(response => {
status.innerText = response.status;
status.innerText = `Status: ${response.status}`;
})
.catch(error => {
status.innerText = error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class OpaqueOriginFragment: Fragment(), SecurableWebViewFragment {
if (webViewSecureState == WebViewSecureState.INSECURE) {
binding.insecureWebView.loadData(Base64.encode(data.toByteArray()), "text/html", "base64")
} else {
binding.secureWebView.loadDataWithBaseURL("https://www.google.com", data, "text/html", "UTF-8", null)
binding.secureWebView.loadDataWithBaseURL("https://www.example.com", data, "text/html", "UTF-8", null)
}
}

Expand Down

0 comments on commit f75dab4

Please sign in to comment.