Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Type may not be being verified #661

Open
caev03 opened this issue Aug 16, 2021 · 0 comments
Open

Network Type may not be being verified #661

caev03 opened this issue Aug 16, 2021 · 0 comments

Comments

@caev03
Copy link

caev03 commented Aug 16, 2021

Dear Developer!

My name is Camilo Escobar, I am a PhD Student at Universidad de los Andes, Colombia. I am part of a research on the usage of network libraries within android apps. As a result of this we identified that there is a missing validation of network type within a method since some network operations are being performed in it. As you might know, a device can have various types of network connections. For the full list of possible network types, see https://developer.android.com/reference/android/net/ConnectivityManager. Therefore it is recommended for the app to identify the type of network available before performing a network operation.

Note: Wi-Fi is typically faster. Also, mobile data is often metered, which can get expensive. A common strategy for apps is to only fetch large data if a Wi-Fi network is available.

In order to address this issue we recommend you to visit:

  1. https://developer.android.com/training/basics/network-ops/managing
  2. https://developer.android.com/training/efficient-downloads/connectivity_patterns

Potential Code Location without Network type validation

public static HttpsURLConnection createConnection(final String urlPath, final boolean multiPart)
{
//noinspection OverlyBroadCatchBlock
try {
final URL url = new URL(SERVER_URL + '/' + urlPath);
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant