gpt4 book ai didi

android - 安全内容提供者

转载 作者:行者123 更新时间:2023-12-04 23:55:33 25 4
gpt4 key购买 nike

是否可以将内容提供者设置为只读?我知道这个问题被问过几次,但根据所有问题(例如 this),我必须编写自己的自定义写入权限。

<permission android:name="com.test.WRITE_DATABASE" android:protectionLevel="normal" />
<permission android:name="com.test.READ_DATABASE" android:protectionLevel="normal" />


//...

<provider
android:authorities="xxx"
android:name="xxx"
android:exported="true"
android:readPermission="com.test.READ_DATABASE"
android:writePermission="com.test.WRITE_DATABASE" />

但是黑客可以反编译我的应用程序并查看 list 文件,然后他可以轻松地编写自己的应用程序:

<uses-permission android:name="com.test.WRITE_DATABASE" />

所以它几乎没用......我有几个应用程序在我的 应用程序中使用一个内容提供程序。只有这个应用程序应该有写权限 - 其他应用程序应该只能从这个数据库中读取。有什么解决办法吗?

最佳答案

请在此处查看有关权限的文档:https://developer.android.com/guide/topics/manifest/permission-element.html

您问题的答案是权限的 android:protectionLevel 属性。您可以将其设置为 signature,这样只有使用相同 key 签名的应用程序才能请求此权限。

关于android - 安全内容提供者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42223918/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com