Limit content provider access

by AndroidKing » Tue, 14 Jul 2009 09:27:43 GMT


Sponsored Links
 is there an easy way to limit my content provider access to only one
or more packages
I don't want other packages to access my data

I looked at   grantUriPermission  but its not straight forward and it
doesn't work

any ideas?
--~--~---------~--~----~------------~-------~--~----~



Limit content provider access

by Dianne Hackborn » Tue, 14 Jul 2009 14:23:39 GMT


 By far the easiest way is to do this based on app certificates -- just use
android:readPermission and android:writePermission in the manifest, and
declare the permission you are using there with <permission> to be
android:protectionLevel="signature".  Then only apps signed with the same
certificate as your own will be able to get the permission, and thus able to
read/write the provider.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Limit content provider access

by AndroidKing » Tue, 14 Jul 2009 23:38:10 GMT


 Thanks for the reply

That doesn't really help
I want to limit the access based on the package name.
The package name will have different signature from my App.
I added android:readPermission and android:writePermission to the
content provider
but what is the use, any package can add these two permissions and
still access the content provider
I think Android is missing the access limitation...

any other way???





--~--~---------~--~----~------------~-------~--~----~



Limit content provider access

by Dianne Hackborn » Wed, 15 Jul 2009 00:00:05 GMT


 You can limit who can get the permissions based on certificate, to control
who can get the permission, using android:protectionLevel="signature".

The package name is not secure at all -- anyone can write an app with a
particular package name, you have no idea what app it actually is based on
that.  If you really want to do this based on package name, you can
implement the security check yourself at the points of call into your
content provider (such as the query() method) -- you can use
Binder.getCallingUid() to find out who is calling you and the PackageManager
to find the package(s) associated with that.  The platform doesn't provide
any easy way to to this, though, because it is does not provide any actual
security.








-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. PVMFOMXVideoDecNode

Anybody can help me to decoder and play some h264 data with
PVMFOMXVideoDecNode? I searched and i don't find any information how i
use this class! Anybody can give me a example or some information that
can help me?

Best Regards,
Andr Barbosa.

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Behaviour of launchMode=鈥?singleTask鈥?not as described?

I agree that the documentation is confusing and possibly wrong.

For the second behavior, that of discarding the intent and bringing
the task with the specified activity to the foreground, you should use
"singleTop" instead (despite what the documentation says).




-- 

3. Debugging Methods n booting time?

4. build/target/product or Vendo

5. Setting Display panel size for android.

6. Saving drawables to sd card?

7. mkdir() fails when min sdk version is 4