Reputation: 4127
I recently did a code scan on my Android source code using HPFortify service. They reported security vulnerability regarding one of the broadcast receivers. They suggested to use the broadcaster permission to reduce the attack vector. This way you are restricting broadcaster, otherwise any malicious application can send the intent and broadcast receiver will process it.
Here is a my actual code:
String ACTION = "android.provider.Telephony.SMS_RECEIVED"
IntentFilter smsFilter = new IntentFilter(SMSReceiver.ACTION);
smsFilter.setPriority(Integer.MAX_VALUE);
smsReceiver = createSMSReceiver(ctx, l);
ctx.registerReceiver(smsReceiver, smsFilter);
I am using the following permission to listen to the permission.
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
Ideally the last line of the code should be like:
ctx.registerReceiver(smsReceiver, smsFilter, "XXX.boradcaster.permission.XXX", null);
I am not able to figure out the broadcast receiver permission. Can anyone suggest how to figure out this?
Upvotes: 1
Views: 1224
Reputation: 39191
The permission you're looking for is "android.permission.BROADCAST_SMS"
, or you can use the android.Manifest.permission.BROADCAST_SMS
constant.
Upvotes: 2