Info Call to External Storage API

Description

List of all external storage API calls. Insecure storage of sensitive information by setting insecure permissions or storing data without encryption might expose this information to an attacker.

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method org.apache.cordova.CordovaResourceApi.mapUriToFile() calling method java.io.File.<init>()


    public java.io.File mapUriToFile(android.net.Uri p10)
    {
        java.io.File v3_0 = 0;
        this.assertBackgroundThread();
        switch (org.apache.cordova.CordovaResourceApi.getUriType(p10)) {
            case 0:
                v3_0 = new java.io.File(p10.getPath());
            case 1:
            default:
                break;
            case 2:
                android.database.Cursor v7 = this.contentResolver.query(p10, org.apache.cordova.CordovaResourceApi.LOCAL_FILE_PROJECTION, 0, 0, 0);
                if (v7 == null) {
                } else {
                    try {
                        int v6 = v7.getColumnIndex(org.apache.cordova.CordovaResourceApi.LOCAL_FILE_PROJECTION[0]);
                    } catch (int v0_4) {
                        v7.close();
                        throw v0_4;
                    }
                    if ((v6 != -1) && (v7.getCount() > 0)) {
                        v7.moveToFirst();
                        String v8 = v7.getString(v6);
                        if (v8 != null) {
                            v3_0 = new java.io.File(v8);
                            v7.close();
                        }
                    }
                    v7.close();
                }
                break;
        }
        return v3_0;
    }

Method org.apache.cordova.CordovaResourceApi.openOutputStream() calling method java.io.File.<init>()


    public java.io.OutputStream openOutputStream(android.net.Uri p7, boolean p8)
    {
        java.io.FileOutputStream v3_0;
        this.assertBackgroundThread();
        switch (org.apache.cordova.CordovaResourceApi.getUriType(p7)) {
            case 0:
                java.io.File v1_1 = new java.io.File(p7.getPath());
                java.io.File v2 = v1_1.getParentFile();
                if (v2 != null) {
                    v2.mkdirs();
                }
                v3_0 = new java.io.FileOutputStream(v1_1, p8);
                break;
            case 1:
            default:
                throw new java.io.FileNotFoundException(new StringBuilder().append("URI not supported by CordovaResourceApi: ").append(p7).toString());
                break;
            case 2:
            case 3:
                java.io.FileOutputStream v3_6;
                if (!p8) {
                    v3_6 = "w";
                } else {
                    v3_6 = "wa";
                }
                v3_0 = this.contentResolver.openAssetFileDescriptor(p7, v3_6).createOutputStream();
                break;
        }
        return v3_0;
    }

Method org.apache.cordova.CordovaResourceApi.remapPath() calling method java.io.File.<init>()


    public String remapPath(String p2)
    {
        return this.remapUri(android.net.Uri.fromFile(new java.io.File(p2))).getPath();
    }

Method org.apache.cordova.CordovaResourceApi.openForRead() calling method java.io.FileInputStream.<init>()


    public org.apache.cordova.CordovaResourceApi$OpenForReadResult openForRead(android.net.Uri p23, boolean p24)
    {
        if (!p24) {
            this = this.assertBackgroundThread();
        }
        org.apache.cordova.CordovaResourceApi$OpenForReadResult v2_2;
        switch (org.apache.cordova.CordovaResourceApi.getUriType(p23)) {
            case 0:
                java.io.InputStream v4_2 = new java.io.FileInputStream(p23.getPath());
                v2_2 = new org.apache.cordova.CordovaResourceApi$OpenForReadResult(p23, v4_2, this.getMimeTypeFromPath(p23.getPath()), v4_2.getChannel().size(), 0);
                return v2_2;
            case 1:
                String v9 = p23.getPath().substring(15);
                int v6 = -1;
                try {
                    android.content.res.AssetFileDescriptor v8_2 = this.assetManager.openFd(v9);
                    java.io.InputStream v4_0 = v8_2.createInputStream();
                    int v6_3 = v8_2.getLength();
                } catch (java.io.FileNotFoundException v18) {
                    v4_0 = this.assetManager.open(v9);
                }
                v2_2 = new org.apache.cordova.CordovaResourceApi$OpenForReadResult(p23, v4_0, this.getMimeTypeFromPath(v9), v6_3, v8_2);
                return v2_2;
            case 2:
            case 3:
                String v5_3 = this.contentResolver.getType(p23);
                android.content.res.AssetFileDescriptor v8_1 = this.contentResolver.openAssetFileDescriptor(p23, "r");
                v2_2 = new org.apache.cordova.CordovaResourceApi$OpenForReadResult(p23, v8_1.createInputStream(), v5_3, v8_1.getLength(), v8_1);
                return v2_2;
            case 4:
                org.apache.cordova.CordovaResourceApi$OpenForReadResult v21 = this.readDataUri(p23);
                if (v21 == null) {
                } else {
                    v2_2 = v21;
                    return v2_2;
                }
            case 5:
            case 6:
                java.net.HttpURLConnection v17_1 = ((java.net.HttpURLConnection) new java.net.URL(p23.toString()).openConnection());
                v17_1.setDoInput(1);
                String v5_2 = v17_1.getHeaderField("Content-Type");
                if (v5_2 != null) {
                    v5_2 = v5_2.split(";")[0];
                }
                v2_2 = new org.apache.cordova.CordovaResourceApi$OpenForReadResult(p23, v17_1.getInputStream(), v5_2, ((long) v17_1.getContentLength()), 0);
                return v2_2;
            case 7:
                org.apache.cordova.CordovaPlugin v19 = this.pluginManager.getPlugin(p23.getHost());
                if (v19 != null) {
                    v2_2 = v19.handleOpenForRead(p23);
                    return v2_2;
                } else {
                    throw new java.io.FileNotFoundException(new StringBuilder().append("Invalid plugin ID in URI: ").append(p23).toString());
                }
        }
        throw new java.io.FileNotFoundException(new StringBuilder().append("URI not supported by CordovaResourceApi: ").append(p23).toString());
    }

Method org.apache.cordova.CordovaResourceApi.openOutputStream() calling method java.io.FileOutputStream.<init>()


    public java.io.OutputStream openOutputStream(android.net.Uri p7, boolean p8)
    {
        java.io.FileOutputStream v3_0;
        this.assertBackgroundThread();
        switch (org.apache.cordova.CordovaResourceApi.getUriType(p7)) {
            case 0:
                java.io.File v1_1 = new java.io.File(p7.getPath());
                java.io.File v2 = v1_1.getParentFile();
                if (v2 != null) {
                    v2.mkdirs();
                }
                v3_0 = new java.io.FileOutputStream(v1_1, p8);
                break;
            case 1:
            default:
                throw new java.io.FileNotFoundException(new StringBuilder().append("URI not supported by CordovaResourceApi: ").append(p7).toString());
                break;
            case 2:
            case 3:
                java.io.FileOutputStream v3_6;
                if (!p8) {
                    v3_6 = "w";
                } else {
                    v3_6 = "wa";
                }
                v3_0 = this.contentResolver.openAssetFileDescriptor(p7, v3_6).createOutputStream();
                break;
        }
        return v3_0;
    }