Android Service 訪問安全
《Application Security for the Android Platform》55頁說到service的安全
1
startService(new Intent(this,MyService.class))
這種內部自己呼叫的是無視許可權各種限制的,後面的自定義許可權這這種沒影響。
如果service沒有 <intent-filter />屬性,那麼任何其他非當前應用都無法使用該service,一用就報許可權錯誤(就算你給service弄了自定義的許可權,然後呼叫其的應用也有該自定義的許可權依然不行),沒有 <intent-filter />就只能給自己用。
然後是 <intent-filter />留空,這樣的話隨便呼叫,只要知道具體的class路徑
比如
1
Intent i = new Intent();
2
i.setClassName("org.qii.security.three","org.qii.security.three.MyService");
3
startService(i);
之後是在 <intent-filter />留空的情況下提供受限制的共享,就是加自定義許可權,只許自己的其他程式用。
自定義許可權的name一定是需要一個逗號……不然Android不認,不認也就罷了也不報錯……坑爹的
最簡單的自定義許可權就是這樣,當然這wo.cao命名是亂來的,正常來說前面是包名。
1
<permission android:name="wo.cao"/>
2
<uses-permission android:name="wo.cao"/>
3
4
<service android:name="MyService"
5
android:permission="wo.cao">
6
<intent-filter/>
7
</service>
其他應用如果要呼叫這個MyService,必須宣告 <uses-permission android:name="wo.cao"/>,當然自定義許可權還有很多選項可以細調,最簡單的就是這樣了。
沒宣告許可權就去用,就會這樣:
1
Caused by: java.lang.SecurityException: Not allowed to start service Intent { cmp=org.qii.security.three/.MyService } without permission wo.cao
相關文章
- k8s通過Service訪問PodK8S
- 用SERVICE LOCATOR 模式實現命名訪問 (轉)模式
- 使用SAP雲平臺 + JNDI訪問Internet Service
- 【Azure微服務 Service Fabric 】Service Fabric中應用開啟外部訪問埠及微服務之間通過反向代理埠訪問問題微服務
- 零信任內網安全訪問內網
- linux安全篇:禁止頻繁訪問的ip訪問nginxLinuxNginx
- Android ServiceAndroid
- Android Service 服務(一)—— ServiceAndroid
- 大資料視覺化安全保障之私密訪問:讓訪問和互動更安全大資料視覺化
- mongoDB 3.0 安全許可權訪問MongoDB
- Android資源訪問機制Android
- android SAF儲存訪問框架Android框架
- Android Service SecurityAndroid
- Android Intent ServiceAndroidIntent
- Android之ServiceAndroid
- vcenter執行兩年,突然訪問出現503 Service unavailableAI
- android怎麼訪問win10共享檔案_android如何訪問win10共享檔案AndroidWin10
- Android Service完全解析Android
- 淺談 Android ServiceAndroid
- Android:Service詳解Android
- Android中Service概述Android
- android service詳解Android
- 微服務訪問安全設計方案實踐微服務
- Web開發基本準則 , Web訪問安全Web
- 使用Service worker實現加速/離線訪問靜態blog網站網站
- android自定義訪問許可權permissionAndroid訪問許可權
- Android使用http協議訪問網路AndroidHTTP協議
- android:各種訪問許可權PermissionAndroid訪問許可權
- C++ 訪問說明符詳解:封裝資料,控制訪問,提升安全性C++封裝
- Android中的Web ServiceAndroidWeb
- Android Service詳解(二)Android
- Android Service詳解(一)Android
- Android中Service總結Android
- Android 之Service使用攻略Android
- Android-Service詳解Android
- Android總結篇系列:Android ServiceAndroid
- 通過 Service 訪問 Pod - 每天5分鐘玩轉 Docker 容器技術(136)Docker
- Android設定加密鎖屏不可訪問MTPAndroid加密