Reputation: 90
I got warning from sonarqube that says
Implement permissions on this exported component.
Meanwhile the android documentation clearly state that any activity with <intent-filters>
should be marked as exported="true"
.
https://developer.android.com/guide/topics/manifest/activity-element#exported
If an activity in your app includes intent filters, set this element to "true" to allow other apps to start it.
For example, if the activity is the main activity of the app and includes the category "android.intent.category.LAUNCHER".
If this element is set to "false" and an app tries to start the activity, the system throws an ActivityNotFoundException.
This is some piece of code from the warning in AndroidManifest.xml
<activity
android:name=".example.WebViewActivity"
android:exported="true"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="example.com" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:pathPrefix="/app/Webview" />
</intent-filter>
</activity>
So, is there any suggestions for this issue ? thank you
Upvotes: 2
Views: 834
Reputation: 54
If you don't want to implement any permission for the component, just declare empty string like this- android:permission=""
Upvotes: 2
Reputation: 4416
For this issue, there are 2 solutions, as per the Developer Document they have mentioned adding exported in the Manifest,
Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
but on the sonarqube
side, if we add this tag in the manifest, we will get an issue on the DevOps side,
So, the Solution is,
SonarQube side should update this as not an issue because the Android S+ (>=31 version) support
You can ask your DevOps to remove this issue to create the build
Upvotes: 0