Skip to content

Commit b7f2d32

Browse files
committed
Address improper URL authorization
1 parent e1a680c commit b7f2d32

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
public boolean shouldOverrideUrlLoading(WebView view, String url) {
2-
{
3-
Uri uri = Uri.parse(url);
4-
// BAD: partial domain match, which allows an attacker to register a domain like myexample.com to circumvent the verification
5-
if (uri.getHost() != null && uri.getHost().endsWith("example.com")) {
6-
return false;
7-
}
8-
}
2+
{
3+
Uri uri = Uri.parse(url);
4+
// BAD: partial domain match, which allows an attacker to register a domain like myexample.com to circumvent the verification
5+
if (uri.getHost() != null && uri.getHost().endsWith("example.com")) {
6+
return false;
7+
}
8+
}
99

10-
{
11-
Uri uri = Uri.parse(url);
12-
// GOOD: full domain match
13-
if (uri.getHost() != null && uri.getHost().endsWith(".example.com")) {
14-
return false;
15-
}
16-
}
17-
}
10+
{
11+
Uri uri = Uri.parse(url);
12+
// GOOD: full domain match
13+
if (uri.getHost() != null && uri.getHost().endsWith(".example.com")) {
14+
return false;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)