NSPinnedDomains is an iOS and macOS app security setting that defines which certificate public keys or certificate authorities a network connection must match. It is used with App Transport Security to restrict trust for specific domains and reduce the risk of unexpected certificate chains or interception.
How NSPinnedDomains Shapes Trust for Mobile Connections
NSPinnedDomains narrows the trust model for selected domains by requiring a presented certificate chain to match an expected public key or certificate authority. That makes the app less dependent on the broader public CA ecosystem for those connections.
Used correctly, it is a targeted way to reduce exposure to interception, rogue certificate issuance, and mistakes in default trust evaluation. It does not replace transport security, but it can make the trust decision much stricter where the app truly needs it.
For a practical iOS view of the surrounding controls, see the iOS App Security Guide, which places ATS exceptions, pinning, Keychain, and Secure Enclave in the same mobile security model.
What Certificate Pinning Changes in Practice
Pinning changes the failure mode from “any valid public trust chain may work” to “only the expected anchor or key material may work.” That is useful when the app must protect a sensitive API path, defend against hostile networks, or harden a high-value domain against interception.
The trade-off is operational: if the pinned material changes and the app is not updated, legitimate traffic can fail. Teams should therefore treat pinned domains as a controlled trust policy, not as a one-time configuration detail.
The mobile pinning guidance in OWASP Mobile Top 10 M5 Insecure Communication Guide is especially relevant because it ties iOS ATS, public key pinning, and validation testing to the same communication risk.
Where NSPinnedDomains Fits with ATS and Other Trust Controls
NSPinnedDomains works alongside App Transport Security, rather than replacing it. ATS sets the baseline expectation for encrypted, policy-compliant transport, while pinning adds a stricter domain-specific trust check when the application cannot rely on generic certificate validation alone.
This distinction matters because developers sometimes treat pinning as a broad substitute for secure transport design. In reality, it should be reserved for the domains where the added assurance is worth the operational burden and where the app can safely manage change.
When teams implement the trust logic in code, the broader iOS secure coding context from Swift and iOS Secure Coding Guide helps connect pinning decisions to URLSession handling, trust callbacks, and safe certificate validation patterns.
Testing, Failure Modes, and Maintenance
Pinning should be tested as part of release validation because a misconfigured pin can create a self-inflicted outage. Common failure modes include stale pins, incomplete backup pin strategy, and assumptions about certificate rotation that do not match the app’s deployment cadence.
Good maintenance also means documenting which domains are pinned, why they are pinned, and how the application should behave if validation fails. That record is important for incident response, certificate rotation, and debugging connection failures that only appear in production networks.
For a deeper grounding in the mobile communication controls that surround this setting, the OWASP Mobile Top 10 M5 Insecure Communication Guide also covers when to pin keys, how to test the behavior, and how to avoid weakening certificate validation while doing so.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V12 — Secure Communication | NSPinnedDomains enforces stricter TLS trust validation for selected domains. |
| V15 — Secure Coding and Architecture | Pinning is implemented in app trust logic and must be designed around safe connection handling. | |
| Recommendation — Require domain-specific trust checks and validate certificate handling for pinned connections. Design pinning logic so certificate validation failures are safe, deterministic, and testable. | ||
| CIS Controls v8 | CIS-3 — Data Protection | Pinning protects sensitive app communications from interception and trust abuse. |
| Recommendation — Use strong transport controls for sensitive app data in transit and verify trust assumptions. | ||
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org