简体   繁体   English

如何将对ContentProvider的访问权限仅限于我的应用程序?

[英]How do I restrict access to my ContentProvider to only my apps?

I want to export a ContentProvider for use by another one of MY apps. 我想导出一个ContentProvider供另一个MY应用程序使用。 How do I prevent other apps from accessing it? 如何阻止其他应用访问它? If I use an android:permission attribute, can't 3rd party apps just apply that permission to their app? 如果我使用android:permission属性,第三方应用程序是否只能将该权限应用于他们的应用程序? I really need to lock down access to my apps only. 我真的需要锁定对我的应用程序的访问权限。

Thanks in advance... 提前致谢...

If I use an android:permission attribute, can't 3rd party apps just apply that permission to their app? 如果我使用android:permission属性,第三方应用程序是否只能将该权限应用于他们的应用程序?

Well, you can use a signature -level custom permission ( android:protectionLevel="signature" ). 好吧,你可以使用signature级别的自定义权限( android:protectionLevel="signature" )。 Then, the app holding the permission and the app defending itself with the permission have to be signed by the same signing key. 然后,持有权限的应用程序和应用程序通过权限进行自我辩护必须使用相同的签名密钥进行签名。

There's a bug/limitation in Android that can allow an attacker, installed before your app, to hold this permission even though the attacker is not signed by your signing key. Android中存在一个错误/限制,即使攻击者未通过您的签名密钥签名,也可以允许在您的应用之前安装的攻击者保留此权限。 I go into that in more detail in this report (as it's a bit complex for an SO answer) and have a PermissionUtils class to help you detect that case. 我在本报告中更详细地介绍了 (因为它对于一个SO答案来说有点复杂)并且有一个PermissionUtils来帮助您检测这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何限制Google App Engine端点API只能访问我的Android应用程序? - How do I restrict Google App Engine Endpoints API access to only my Android applications? 如何将对REST API的访问限制为仅授权的客户端? - How do I restrict access to my REST API to only authorized clients? Android:如何限制对ContentProvider的访问 - Android: how to restrict access to ContentProvider 如何通过ContentProvider在insert()命令中使用子查询? - How do I use a subquery in an insert() command through my ContentProvider? 如何更新我的ContentProvider? - How to update my ContentProvider? 我可以使用我开发的android应用程序以外的任何浏览器来限制对我网站的访问吗? - Can I restrict access to my site using any browser other than an android apps developed by me? 如何限制对我的网站的访问仅限于我的Android应用程序 - How can restrict access to my web site only to my Android Application 如何将我的Android应用限制为非平板电脑? - How do I restrict my Android app to non-tablets? 如何从一个应用程序向另一个应用程序发送意图? - How do I sent an Intent from one of my Apps to another of my Apps? 将对新建文件夹的访问限制为仅我的Android应用 - Restrict access to a new created folder to only my android app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM