Choosing Between Certificate Pinning and System Trust Store for TLS Validation in Appcelerator Titanium
0 reputation · 24 Jan 2025, 23:57 UTC
0 reputation · 24 Jan 2025, 23:57 UTC
Goal: Determine whether to enable certificate pinning with a backup pin and forced‑update mechanism or to rely on the platform trust store together with App Transport Security (ATS) exceptions for TLS validation in Ti.Network.HTTPClient.
Constraint: Pinning protects against compromised CAs but causes hard failures when the server certificate rotates without an app update, whereas trusting the system store survives rotation automatically but accepts any certificate chained to a trusted CA, leaving the app vulnerable to MITM attacks from locally installed or fraudulently issued certs. ATS enforces TLS minimums and can block weak configurations, but broad exceptions may trigger App Store review scrutiny.
Which approach best balances security against MITM with minimal user impact during certificate rotation? How should a backup pin be managed to avoid hard failures when the primary pin expires? What ATS exception settings are acceptable for App Store review while still allowing necessary endpoints?
30275 reputation · 25 Jan 2025, 09:58 UTC
For most Appcelerator Titanium applications, the optimal balance between security and availability is to rely on the system trust store with strict App Transport Security (ATS) settings, applying certificate pinning only to high-value endpoints.
Relying on the system store prevents the "hard failure" scenario where an app becomes unusable after a server certificate rotates without a corresponding update. While this leaves the app vulnerable to Man-in-the-Middle (MITM) attacks from compromised or locally installed CAs, it ensures continuous service during routine certificate lifecycles.
If certificate pinning is required for your use case, avoid pinning only the leaf certificate. To prevent outages during rotation, follow this hierarchy:
To pass App Store review while maintaining connectivity, avoid NSAllowsArbitraryLoads = YES, as this often triggers a request for justification from Apple. Instead, use scoped exceptions in your Info.plist via NSExceptionDomains. This tells Apple exactly which domains require deviations from standard TLS 1.2+ requirements. Acceptable settings include:
NSIncludesSubdomains: Set to YES to cover all API endpoints for a specific domain.NSTemporaryExceptionAllowsInsecureHTToads: Use only for legacy endpoints that cannot be upgraded to HTTPS; be prepared to provide a technical justification.To verify your implementation, perform these scoped tests:
Info.plist to ensure NSAllowsArbitraryLoads is absent and only specific domains are listed under NSExceptionDomains.Note: This guidance assumes the use of Ti.Network.HTTPClient. Because Titanium's security manager implementation can vary by SDK version, verify that your specific version supports the security manager hooks required for custom pin validation on both iOS and Android.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.