Skip to content

Opening URLs Allowlist

Introduction

SAP BTP SDK for iOS v26.11 extends the opening URLs restriction feature introduced in v10.0 with an allowlist. When Restrict Opening URLs is enabled in mobile services cockpit, the allowlist defines URL patterns that remain permitted to open in an external application. Any URL that does not match an allowlist entry is blocked.

The allowlist gives you fine-grained control. Instead of blocking all external URLs, you can selectively allow specific schemes, URL patterns, or regular expressions.

Enabling the Allowlist in mobile services cockpit

  1. In mobile services cockpit, navigate to Mobile Settings Exchange > Client Configuration for your application.
  2. Set Restrict Opening URLs to Restricted.
  3. Under Open URL Allowlist, add one or more entries. Each entry requires:
    • Type — one of scheme, url, or regex
    • Value — the pattern to match against

You must add at least one entry before saving the Restricted policy.

iOS Security Policy Settings

Allowlist Entry Types

Type Description Example value
scheme Permits any URL whose scheme matches (case-insensitive) https, tel, mailto
url Permits URLs matching a wildcard pattern (* = any characters, ? = one character) https://www.sap.com/*
regex Permits URLs whose absolute string fully matches a regular expression https://(www\.)?sap\.com/.*

How It Works

When the policy is enforced:

  • URLs not in the allowlist — calls to UIApplication.open, UIScene.open, and UIApplication.canOpenURL return false/nil and do not open the URL.
  • URLs matching an allowlist entry — the URL opens normally in the external application.
  • UITextView link detection — when at least one allowlist entry is present, UITextView links remain tappable (the allowlist is enforced at tap time). When no allowlist entry is present, .link data detection is suppressed so links are visually and interactively disabled.

Usage

Direct API (SAPFoundation)

Pass an array of OpenURLAllowlistEntry values to the enforce(policy:allowlist:) method:

import SAPFoundation

// Permit only https and tel schemes
let allowlist: [OpenURLAllowlistEntry] = [
    OpenURLAllowlistEntry(from: ["type": "scheme", "value": "https"])!,
    OpenURLAllowlistEntry(from: ["type": "scheme", "value": "tel"])!
]
try OpenURLPolicyEnforcer.shared.enforce(policy: .blocked, allowlist: allowlist)

The original single-parameter enforce(policy:) API remains available and continues to block all URLs with no allowlist:

try OpenURLPolicyEnforcer.shared.enforce(policy: .blocked)

When you use SAPcpmsSecurityPolicyApplyStep, the allowlist is read automatically from the server policy and forwarded to OpenURLPolicyEnforcer. No additional code changes are required beyond the original opening URLs restriction setup.

Add SAPcpmsSecurityPolicyApplyStep to your onboardingSteps and restoringSteps in OnboardingFlowProvider.swift:

public var onboardingSteps: [OnboardingStep] {
    return [
        ...
        CompositeStep(steps: SAPcpmsDefaultSteps.settingsDownload),
        CompositeStep(steps: SAPcpmsDefaultSteps.applyDuringOnboard),
        SAPcpmsSecurityPolicyApplyStep(),
        ...
    ]
}
public var restoringSteps: [OnboardingStep] {
    return [
        ...
        CompositeStep(steps: SAPcpmsDefaultSteps.settingsDownload),
        CompositeStep(steps: SAPcpmsDefaultSteps.applyDuringRestore),
        SAPcpmsSecurityPolicyApplyStep(),
        ...
    ]
}

SAPcpmsSecurityPolicyApplyStep reads the openUrlAllowlist field from the downloaded SAPcpmsSecurityPolicy and calls OpenURLPolicyEnforcer.shared.enforce(policy:allowlist:) automatically.

Precondition

SAPcpmsSecurityPolicyApplyStep must run after SAPcpmsSettingsDownloadStep (typically via SAPcpmsDefaultSteps.settingsDownload) so that the allowlist entries are available in the onboarding context before being applied.


Last update: October 19, 2026