2021-10-13 16:07:37 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../ask-yourself.adoc[]
|
|
|
|
|
|
|
|
include::../recommended.adoc[]
|
|
|
|
|
|
|
|
== Sensitive Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
<receiver android:name=".MyBroadcastReceiver" android:exported="true"> <!-- Sensitive -->
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="android.intent.action.AIRPLANE_MODE"/>
|
|
|
|
</intent-filter>
|
|
|
|
</receiver>
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
Enforce permissions:
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,xml]
|
2021-10-13 16:07:37 +02:00
|
|
|
----
|
|
|
|
<receiver android:name=".MyBroadcastReceiver"
|
|
|
|
android:permission="android.permission.SEND_SMS"
|
|
|
|
android:exported="true">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="android.intent.action.AIRPLANE_MODE"/>
|
|
|
|
</intent-filter>
|
|
|
|
</receiver>
|
|
|
|
----
|
|
|
|
|
|
|
|
Do not export the receiver and only receive system intents:
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,xml]
|
2021-10-13 16:07:37 +02:00
|
|
|
----
|
|
|
|
<receiver android:name=".MyBroadcastReceiver" android:exported="false">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="android.intent.action.AIRPLANE_MODE"/>
|
|
|
|
</intent-filter>
|
|
|
|
</receiver>
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|