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. Diapad phone red button press

Hi,


Has any has success of pressing the redbutton of the dialpad, which is
launched my their own application.

We want to do press read button from ActivityInstrumentationTestCase2
testses on our own application.


Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com

-- 

2. why is there no android tablet nearly as good as ipad?

why is there no android tablet nearly as good as ipad?

-- 

3. Issues in downloading android source code(Repo init )

4. OOT: mhn petunjuk dan WTB

5. Best way to determine device capabilities, chipset, etc

6. Do VBOs really improve performance? Really?

7. Routing Audio to Bluetooth Headset API Level < 8