Security Protections
Security Protections
Starting with SDK 5.14.0, the host application can configure two optional security protections:
- Navigation protection: restricts campaign destinations using allowlists.
- Overlay protection: filters obscured touches on supported SDK screens and, on supported Android versions, hides non-system overlays.
Configure them after SiprocalSDK.init(...).
By default, navigation allowlist enforcement and overlay protection are disabled.
Configure navigation protection
Use setNavigationPolicy(...) to define the campaign formats and destinations to protect.
import android.app.Application;
import com.siprocal.sdk.client.NavigationPolicy;
import com.siprocal.sdk.client.NavigationPolicyScope;
import com.siprocal.sdk.client.SiprocalSDK;
import com.siprocal.sdk.client.SiprocalSDKSettings;
import java.util.Arrays;
import java.util.Collections;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
SiprocalSDKSettings settings = new SiprocalSDKSettings.Builder().build();
SiprocalSDK.init(this, settings);
NavigationPolicy policy = new NavigationPolicy(
NavigationPolicyScope.BOTH,
Arrays.asList("https://example.com", "https://play.google.com"),
Arrays.asList("myapp", "tel", "https://example.com/offers/"),
Collections.singletonList("com.example.partner"),
true
);
SiprocalSDK.setNavigationPolicy(getApplicationContext(), policy);
}
}import android.app.Application
import com.siprocal.sdk.client.NavigationPolicy
import com.siprocal.sdk.client.NavigationPolicyScope
import com.siprocal.sdk.client.SiprocalSDK
import com.siprocal.sdk.client.SiprocalSDKSettings
class App : Application() {
override fun onCreate() {
super.onCreate()
val settings = SiprocalSDKSettings.Builder().build()
SiprocalSDK.init(this, settings)
SiprocalSDK.setNavigationPolicy(
applicationContext,
NavigationPolicy(
scope = NavigationPolicyScope.BOTH,
allowedOrigins = listOf("https://example.com", "https://play.google.com"),
allowedDeepLinkSchemes = listOf("myapp", "tel", "https://example.com/offers/"),
allowedPackages = listOf("com.example.partner"),
allowIntentUrls = true
)
)
}
}Replace the example destinations with the origins, schemes, and application IDs your integration needs to authorize.
Select the campaign scope
The scope uses the campaign formats shown in the portal: Push and Push + In-App.
| Scope | Applies to |
|---|---|
DISABLED | Disables navigation allowlist enforcement. |
PUSH_ONLY | Push campaigns. |
PUSH_IN_APP | Push + In-App campaigns, including their notification CTAs. |
BOTH | Both campaign formats. |
For navigation policy, the SDK classifies a campaign as Push when it uses a supported notification format and runs the CTA directly on tap, with no In-App content or survey. The SDK evaluates other campaigns, including surveys, under PUSH_IN_APP.
Configure the allowlists
| Setting | Purpose |
|---|---|
allowedOrigins | Allowed HTTP and HTTPS origins, including scheme, host, and port. |
allowedDeepLinkSchemes | Allowed custom schemes, such as myapp and tel. For the Open deeplink CTA, this list also accepts exact HTTP(S) destinations. |
allowedDeepLinkDestinations | Optional exact custom deep-link destinations. Entries for a scheme take precedence over its general scheme permission. |
allowedPackages | Allowed application IDs for the Open installed app CTA. |
allowIntentUrls | Selects legacy or safe handling of Android intent:// URLs. |
When the selected scope applies, allowedOrigins, allowedDeepLinkSchemes, and allowedPackages use these defaults, subject to the exact destination rules below.
nullleaves that category unrestricted.- An empty list blocks destinations in that category.
- A non-empty list permits matching entries.
An exact HTTPS destination for Open deeplink can be allowed even when allowedOrigins is empty. Exact custom deep-link destinations take precedence for their scheme, including when allowedDeepLinkSchemes is null or empty. If allowedDeepLinkDestinations is null or empty, custom deep links are evaluated using allowedDeepLinkSchemes.
HTTP and HTTPS URLs
Configure an origin without a path, query, or fragment:
allowedOrigins = listOf("https://example.com")URLs on that origin may contain paths, query parameters, macros, and fragments. For example:
https://example.com/offers/details?source=pushTo allow URLs like https://www.example.com, add https://example.com to allowedOrigins.
To allow Google Play URLs for different applications, configure:
allowedOrigins = listOf("https://play.google.com")This permits app listing URLs such as:
https://play.google.com/store/apps/details?id=com.example.appExact HTTPS destinations for Open deeplink
For the Ask user to open deeplink CTA, a complete HTTP(S) URL can be included in allowedDeepLinkSchemes:
allowedOrigins = emptyList()
allowedDeepLinkSchemes = listOf("https://example.com/offers/")This authorizes that exact destination for this CTA, including its www. host variant. Path, query, and fragment must still match.
It does not authorize other routes on the domain or the same destination for the website or Google Play CTAs.
Exact custom deep-link destinations
Use allowedDeepLinkDestinations to restrict a custom scheme to specific destinations:
allowedDeepLinkSchemes = listOf("myapp", "tel")
allowedDeepLinkDestinations = listOf("myapp://offers/details")In this example, myapp://offers/details is allowed, but other myapp destinations are blocked. The tel scheme continues to use its general scheme permission.
Which CTA uses each rule?
The following checks apply when the campaign is within the selected scope:
| Portal objective / Flow | Policy check | Example |
|---|---|---|
| Ask user to open deeplink | Custom scheme and exact destination rules; exact HTTP(S) destinations can also be authorized through allowedDeepLinkSchemes. | myapp://offers → Allow myapp. |
| Send people to your website | allowedOrigins for HTTP and HTTPS URLs. | https://example.com/promo?source=push → Allow https://example.com. |
| Get installs of your application through Google Play | allowedOrigins. | https://play.google.com/store/apps/details?id=com.example.app → Allow https://play.google.com. |
| Ask people to call a Phone number | Custom scheme rules applied to the generated tel: URI. | CTA value 1234 becomes tel:1234 → Allow tel. |
| Ask people to open an existing application on their device | allowedPackages. | com.example.partner → Allow com.example.partner. |
| Survey | External CTAs are checked under PUSH_IN_APP or BOTH. Web URLs use allowedOrigins, and custom deep links use the scheme and destination rules. | https://example.com/survey/complete → Allow https://example.com. |
If a CTA fails an applicable allowlist check during campaign validation, the SDK reports a campaign analytics error. The SDK also checks the applicable rules when handling the CTA, so a notification can be visible while its destination is blocked.
Survey: The survey can open independently of its external CTA. The SDK checks the external destination when the user taps the CTA.
allowedPackages applies only to the Open installed app CTA. This CTA requires the AppServices module and an installed destination app. The package list does not restrict apps that Android resolves to handle URLs, custom schemes, or Intent URLs.
Android Intent URLs
Use the Ask user to open deeplink objective to send an intent:// URL:
intent://offers/details#Intent;scheme=myapp;endThis URI wraps the destination myapp://offers/details.
| Setting | Behavior |
|---|---|
allowIntentUrls = false — default | Preserves SDK 5.13.0 handling: passes the original Intent URI to Android without interpreting its fields or checking its wrapped destination against allowlists. |
allowIntentUrls = true | Parses and validates the Intent, checks the wrapped destination, and creates a new Intent to open it. |
With safe handling enabled, allow the destination scheme:
allowIntentUrls = true
allowedDeepLinkSchemes = listOf("myapp")The SDK rejects unsupported or unsafe Intents, including explicit components, selectors, and extras. Wrapped destinations are validated even outside the selected campaign scope.
Android must have an application capable of handling the destination.
allowIntentUrls = falseselects legacy handling; it does not block Intent URLs.
Enable overlay protection
Overlay protection is independent of the navigation allowlists and is disabled by default.
SiprocalSDK.setOverlayProtectionEnabled(getApplicationContext(), true);SiprocalSDK.setOverlayProtectionEnabled(applicationContext, true)This enables obscured-touch filtering on SDK ad and survey screens.
On Android 12 (API 31) or later, the SDK also hides non-system overlays on supported SDK windows and on the host Activity registered through enableActivityHandling(...). Declare the following permission directly under <manifest>:
<uses-permission android:name="android.permission.HIDE_OVERLAY_WINDOWS" />Overlay hiding is applied when a supported activity is created. Disabling or resetting the setting takes effect for newly created activities.
Persistence and configuration updates
The SDK saves the security configuration and restores it during initialization after app restarts and app updates.
Call the setters only when configuring or updating the protections. The SDK processes changes in the background in the order they are submitted. Pass read-only lists and submit a new policy to change them.
setNavigationPolicy(...) replaces the entire navigation policy. When changing one field, include every other setting that should remain active. Omitted fields use their constructor defaults.
Read the saved configuration
getCachedSecurityConfiguration(...) waits for previously queued security configuration calls. The callback runs in the background. Dispatch any UI updates to the main thread.
SiprocalSDK.getCachedSecurityConfiguration(
getApplicationContext(),
configuration -> {
NavigationPolicy policy = configuration.getNavigationPolicy();
boolean overlayEnabled = configuration.getOverlayProtectionEnabled();
// Inspect the saved settings here.
}
);SiprocalSDK.getCachedSecurityConfiguration(applicationContext) { configuration ->
val policy = configuration.navigationPolicy
val overlayEnabled = configuration.overlayProtectionEnabled
// Inspect the saved settings here.
}Remove protections between app versions
Removing the setter calls from a new app version does not remove previously saved protections.
If a new app version should remove the existing security configuration, call resetNavigationPolicy(...) after SiprocalSDK.init(...).
SiprocalSDK.resetNavigationPolicy(getApplicationContext());SiprocalSDK.resetNavigationPolicy(applicationContext)This method resets the complete security configuration:
- Sets the navigation scope to
DISABLED. - Clears the saved allowlists.
- Restores
allowIntentUrls = false, using legacy Intent handling. - Disables overlay protection.
The reset is asynchronous and is saved for subsequent app launches.
Updated about 13 hours ago
