iOS Security

Apply iOS-specific package selection, build flags, runtime guards, pairing hygiene, and permission guidance for the native Ansight SDK.

The iOS SDK exposes core runtime products and discrete tool products. Use iOS Setup Packages for package selection, then keep developer tooling restricted to local builds.

Package Selection

For local development, the aggregate Ansight product is the simplest path. It includes AnsightCore, pairing UI, and standard native tool suites.

For a smaller surface, use AnsightCore plus only the products needed by the workflow:

.product(name: "AnsightCore", package: "ansight-sdk")
.product(name: "AnsightToolsVisualTree", package: "ansight-sdk")

Do not include the aggregate Ansight product or concrete AnsightTools* products in App Store, TestFlight, CI release, or other distributable builds unless they are explicitly internal and guarded.

Build Flags

The SwiftPM build tool and CocoaPods build phase understand these developer-build controls:

SettingPurpose
ANSIGHT_DEVELOPER_PAIRING_ENABLED=trueGenerate and embed developer pairing from ansight.json.
ANSIGHT_DEVELOPER_PAIRING_SOURCE_FILE=/absolute/path/to/ansight.jsonOverride the pairing source file.
ANSIGHT_ALLOW_REMOTE_TOOLS=truePermit concrete remote-tool implementations in the build.

Keep those settings scoped to local Debug schemes or internal development configurations.

Runtime Guard

The aggregate setup starts from developer defaults. Narrow the guard in the builder callback.

import Ansight

try AnsightRuntime.shared.initializeAndActivateAnsightSdk { options in
#if DEBUG
    options.withReadOnlyToolAccess()
#else
    options.withToolsDisabled()
#endif
}

Use .readWrite or .fullAccess only when a debugging workflow needs mutation or delete-scoped tools.

Pairing Files

Treat pairing files as sensitive. Keep them local and ignored:

ansight.json
*.ans.json
ansight.developer-pairing.json

Use Studio to issue signed pairing configs. Do not hand-author pairing JSON. Avoid embedding developer pairing in public builds.

If a developer must reuse a pairing config on-device, prefer syncing or importing the signed config at runtime into the app’s Keychain-backed secure storage, then loading it from there. Keep SwiftPM or CocoaPods developer pairing generation scoped to local Debug builds only.

Permissions

Local network pairing or host discovery requires an Info.plist usage string:

<key>NSLocalNetworkUsageDescription</key>
<string>Ansight client needs local network access to discover and connect to the host test harness.</string>

Only add NSCameraUsageDescription when QR pairing is actually exposed in the app.

Sensitive Tool Suites

  • VisualTree and screenshots expose rendered UI.
  • FileSystem can export app files from approved roots.
  • Database can expose SQLite schema and rows.
  • Preferences and SecureStorage can expose user-specific values.
  • Reflection can expose private runtime state and invoke supported members.

Prefer read-only access and allow-lists for roots, keys, stores, services, and reflection roots.