Overview
Thrust uses SSL certificate pinning to protect against man-in-the-middle attacks on critical API connections, especially banking APIs (GoCardless). The system supports dynamic hash updates via remote configuration to handle certificate rotation without app releases.Architecture
iOS App
CertificatePinningManager— Validates SSL certificatesRemoteCertificateConfig— Fetches remote hashes
Server
/api/certificates.json— Current hashes endpointupdate-certificates.sh— Daily update script
How It Works
App Startup
On launch, the app calls
refreshRemoteHashes() which fetches the latest hashes from thrust.finance/api/certificates.json.Connection Validation
When connecting to a pinned domain, the certificate chain is validated against:
- Remote hashes (if available and fresh)
- Hardcoded fallback hashes (if remote unavailable)
Pinned Domains
| Domain | Service | Priority |
|---|---|---|
bankaccountdata.gocardless.com | GoCardless Banking API | 🔴 Critical |
accounts.google.com | Google OAuth | Standard |
oauth2.googleapis.com | Google OAuth API | Standard |
gmail.googleapis.com | Gmail API | Standard |
login.microsoftonline.com | Microsoft OAuth | Standard |
graph.microsoft.com | Microsoft Graph API | Standard |
api.coingecko.com | Crypto Prices | Standard |
api.twelvedata.com | Stock Prices | Standard |
API Endpoint
Fallback Behavior
| Scenario | Behavior |
|---|---|
| Remote config available | Uses remote hashes (updated daily) |
| Remote config unavailable | Uses hardcoded hashes in app |
| Pinning fails + graceful mode ON | Logs error, allows connection |
| Pinning fails + graceful mode OFF | Blocks connection (default) |
iOS Implementation
Key Files
Startup Integration
Thrust.swift
Enable Graceful Fallback
Server Configuration
File Locations
| File | Path |
|---|---|
| API Endpoint | /volume1/Web/thrust/api/certificates.json |
| Update Script | /volume1/Web/thrust/scripts/update-certificates.sh |
| Cron Log | /volume1/Web/thrust/scripts/cron.log |
| Backups | /volume1/Web/thrust/scripts/backups/ |
Cron Schedule
Manual Update
Emergency Response
Users report banking connection failures
Users report banking connection failures
- SSH to server:
ssh Kondrick@192.168.1.75 - Run update script:
/volume1/Web/thrust/scripts/update-certificates.sh - Verify endpoint:
curl https://thrust.finance/api/certificates.json - Users will get new hashes on next app launch
CI/CD Verification
CI/CD Verification
Before each release, run:This checks that all hardcoded hashes match current certificates.
Monitoring
When pinning fails with graceful fallback enabled, errors are logged toCrashReportingManager with:
- Host that failed
- Actual certificate chain hashes
- Expected hashes
Related Files
CertificatePinningManager.swift
Main certificate pinning implementation
RemoteCertificateConfig.swift
Remote configuration fetcher
GoCardlessAuthService.swift
Banking API authentication with pinned session
verify-certificates.sh
CI/CD certificate verification script