Plugins & Permissions Pt2

So… I decided to do a little hacking around on npm, and github and wrote a little web scraper to search for plugin projects on NPM, locate the github repository and open up the plugins.xml to extract the < uses-permissions /> tabs… :wink:

I was able to dynamically snatch the permissions into a JSON object for all the standard plugins. I will grab the complete supported plugin list and will run it tomorrow…

Check this out…

{
    "cordova-plugin-battery-status": {
        "permission": []
    },
    "cordova-plugin-camera": {
        "permission": ["android.permission.WRITE_EXTERNAL_STORAGE"]
    },
    "cordova-plugin-media-capture": {
        "permission": ["android.permission.RECORD_AUDIO", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"]
    },
    "cordova-plugin-console": {
        "permission": []
    },
    "cordova-plugin-contacts": {
        "permission": ["android.permission.READ_CONTACTS", "android.permission.WRITE_CONTACTS", "android.permission.GET_ACCOUNTS", "android.permission.READ_CONTACTS", "android.permission.WRITE_CONTACTS", "android.permission.GET_ACCOUNTS"]
    },
    "cordova-plugin-device": {
        "permission": []
    },
    "cordova-plugin-device-motion": {
        "permission": []
    },
    "cordova-plugin-device-orientation": {
        "permission": ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"]
    },
    "cordova-plugin-dialogs": {
        "permission": []
    },
    "cordova-plugin-file-transfer": {
        "permission": ["android.permission.WRITE_EXTERNAL_STORAGE"]
    },
    "cordova-plugin-geolocation": {
        "permission": ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"]
    },
    "cordova-plugin-globalization": {
        "permission": []
    },
    "cordova-plugin-inappbrowser": {
        "permission": []
    },
    "cordova-plugin-media": {
        "permission": []
    },
    "cordova-plugin-vibration": {
        "permission": ["android.permission.VIBRATE"]
    },
    "cordova-plugin-whitelist": {
        "permission": []
    },
    "cordova-plugin-network-information": {
        "permission": ["android.permission.ACCESS_NETWORK_STATE"]
    },
    "cordova-plugin-splashscreen": {
        "permission": []
    },
    "cordova-plugin-statusbar": {
        "permission": []
    },
    "cordova-plugin-file": {
        "permission": []
    },
    "cordova-plugin-sms": {
        "permission": ["android.permission.READ_PHONE_STATE", "android.permission.RECEIVE_SMS", "android.permission.RECEIVE_WAP_PUSH", "android.permission.RECEIVE_MMS", "android.permission.READ_SMS", "android.permission.WRITE_SMS", "android.permission.SEND_SMS"]
    },
    "cordova-plugin-image-resizer": {
        "permission": []
    },
    "cordova-plugin-screen-orientation": {
        "permission": []
    },
    "cordova-plugin-barcodescanner": {
        "permission": ["android.permission.CAMERA", "android.permission.FLASHLIGHT", "android.permission.WRITE_SETTINGS"]
    },
    "com-sarriaroman-photoviewer": {
        "permission": ["android.permission.INTERNET", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"]
    }
}

This is a very interesting idea - keep us posted on what you find!

Success! I was able to take the list and grab almost all of the permissions… I think I have 2 errors in the scrape… It took several hours to complete, due to 429 - Too Many requests responses, so I added delays in the scrape.

The entire JSON is nearly 300k, and I saved the urls so I can run individual updates if needed instead of the entire list… Some repos are private so you can’t see them unless you login and have access…

I don’t want to flood the forums… Here is a preview of the top 20 or so…

{
    "@ahovakimyan/cordova-plugin-wkwebviewxhrfix": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@ahovakimyan/cordova-plugin-wkwebviewxhrfix",
        "repo": "https://github.com/arahovakimyan/cordova-plugin-wkwebviewxhrfix/blob/master/plugin.xml"
    },
    "@brodybits/cordova-plugin-ios-xhr": {
        "status": "GIT plugin.xml missing",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@brodybits/cordova-plugin-ios-xhr",
        "repo": "https://github.com/brodybits/cordova-plugin-ios-xhr/blob/master/plugin.xml"
    },
    "@castana/cordova-plugin-ios-xhr": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@castana/cordova-plugin-ios-xhr",
        "repo": "https://github.com/CASTANA-Solutions/cordova-plugin-ios-xhr/blob/master/plugin.xml"
    },
    "@castana/cordova-plugin-telerik-imagepicker": {
        "status": "ok",
        "permission": ["android.permission.WRITE_EXTERNAL_STORAGE"],
        "npm": "https://www.npmjs.com/package/@castana/cordova-plugin-telerik-imagepicker",
        "repo": "https://github.com/CASTANA-Solutions/ImagePicker-noEditConfig/blob/master/plugin.xml"
    },
    "@dieter.konrad/com.unarin.cordova.beacon": {
        "status": "NPM private",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@dieter.konrad/com.unarin.cordova.beacon",
        "repo": ""
    },
    "@fintom/cordova-nfc-tag": {
        "status": "NPM private",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@fintom/cordova-nfc-tag",
        "repo": ""
    },
    "@foodexplorer/cordova-zebra-printer": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@foodexplorer/cordova-zebra-printer",
        "repo": "https://github.com/apache/cordova-plugin-device/blob/master/plugin.xml"
    },
    "@globules-io/cordova-plugin-ios-xhr": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@globules-io/cordova-plugin-ios-xhr",
        "repo": "https://github.com/globules-io/cordova-plugin-ios-xhr/blob/master/plugin.xml"
    },
    "@gogyup/cordova-plugin-tts-gu1": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@gogyup/cordova-plugin-tts-gu1",
        "repo": "https://github.com/blukis/cordova-plugin-tts-gu1/blob/master/plugin.xml"
    },
    "@goiarlabs/cordova-plugin-file-transfer": {
        "status": "ok",
        "permission": ["android.permission.WRITE_EXTERNAL_STORAGE"],
        "npm": "https://www.npmjs.com/package/@goiarlabs/cordova-plugin-file-transfer",
        "repo": "https://github.com/goiarlabs/cordova-plugin-file-transfer/blob/master/plugin.xml"
    },
    "@havesource/cordova-plugin-push": {
        "status": "ok",
        "permission": ["android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE", "android.permission.WAKE_LOCK", "android.permission.VIBRATE"],
        "npm": "https://www.npmjs.com/package/@havesource/cordova-plugin-push",
        "repo": "https://github.com/havesource/cordova-plugin-push/blob/master/plugin.xml"
    },
    "@herma/phonegap-plugin-barcodescanner": {
        "status": "ok",
        "permission": ["android.permission.CAMERA", "android.permission.FLASHLIGHT"],
        "npm": "https://www.npmjs.com/package/@herma/phonegap-plugin-barcodescanner",
        "repo": "https://github.com/mutHERMA/phonegap-plugin-barcodescanner/blob/master/plugin.xml"
    },
    "@hmscore/cordova-plugin-hms-ads": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@hmscore/cordova-plugin-hms-ads",
        "repo": "https://github.com/HMS-Core/hms-cordova-plugin/blob/master/cordova-plugin-hms-ads/plugin.xml"
    },
    "@hmscore/cordova-plugin-hms-iap": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@hmscore/cordova-plugin-hms-iap",
        "repo": "https://github.com/HMS-Core/hms-cordova-plugin/blob/master/cordova-plugin-hms-iap/plugin.xml"
    },
    "@ionic-native/phonegap-local-notification": {
        "status": "ok",
        "permission": [],
        "npm": "https://www.npmjs.com/package/@ionic-native/phonegap-local-notification",
        "repo": "https://github.com/danielsogl/awesome-cordova-plugins"
    },

Maybe I’m misunderstanding what you are doing here, but I think VoltBuilder (through Cordova) takes care of this automatically already. By listing the permission as needed in the plugin’s plugin.xml file (in the GitHub repo), it automatically gets added at runtime.

There should be no need to add this to your config.xml file.

I thought so to, but cordova-plugin-sms was giving me errors that READ_SMS, WRITE_SMS were not included in my build.

When I build with 9.1.0 it was auto granting me INTERNET, NETWORK access but switching to 10.1, these permission were dropped and I got an error. (My app lost internet access.)

Being able to pre-fetch the permissions would provide me an extra check/validation to my product.

It could be that the problem is just with cordova-plugin-sms, not a general issue.

That plugin hasn’t been updated in 6 years.

I also notice this open issue (from 4 years ago!) on that plugin:

Hopefully this will clarify everything I’ve hooked together… I’m really please/excited with the results… (this will be a long one).

So… when I ran the web scrape on all the plugins there were a few deprecated, some NPM projects removed, some were “private” and required a login. Some of the GIT Repos were also missing. I included a “status code” so users will know some “general” information on the plugin projects.

I may include the hyperlinks inside my app, but, here are my results so far.


I have BASE plugins at the top of the list. The rest of the items will load via a timer thread. You can search and filter plugins.


Any plugin that doesn’t have a status “ok” will have a disabled checkbox. The status message will appear when you mouse-over. (example: “NPM private”)

Once you have selected your plugins, you can click “Resolve” to lookup all permissions for the plugins you selected. This is primarily a safe guard if the build doesn’t auto add the permissions. It seems that some of the permission rules have changed over time.

Overall, I just want Nimble to config Cordova perfectly… and have a snazzy interface for the users.

Hope this clarifies. I’m excited about this mod. :slight_smile: