Most iOS and macOS apps pull dozens of third-party libraries through CocoaPods or Swift Package Manager, and the lockfile that decides which code ships is often uncommitted, unreviewed or silently rewritten by the build. The CocoaPods trunk, the central spec repository most pods are published through, is moving to read-only on 2 December 2026, so teams that depend on it now have to plan where their future dependency updates come from. This guide covers the practical controls for both dependency managers: how resolution and locking actually work, how to make CI fail instead of drifting, how source order and private spec repositories create dependency confusion risk, what Swift registry signing and fingerprint checks give you, and how to migrate off trunk without losing integrity. It is written for iOS leads, mobile platform engineers and application security teams. For code-level Swift practices see the Swift and iOS Secure Coding Guide; this page stays on the dependency layer.
Key takeaways
- Commit the lockfile and make CI refuse to change it. Podfile.lock with
pod install --deployment, and Package.resolved with--only-use-versions-from-resolved-file, turn silent drift into a failed build. - Package.resolved only pins leaf projects. SwiftPM ignores a library's own Package.resolved when that library is consumed by another package, so libraries must constrain dependencies in Package.swift.
- Source order is a security setting in CocoaPods. CocoaPods takes the highest version from the first source that contains a pod name, so a private pod name that also exists on a public source is a dependency confusion risk unless you pin the source per pod.
- Trunk goes read-only on 2 December 2026. Existing pods stay downloadable, but no new versions arrive through trunk after that date; move each dependency to Swift Package Manager, a private spec repository or vendored source.
- Fingerprints and signatures catch tampering, not bad authors. SwiftPM trust-on-first-use and registry signing detect changed content for a version you already trust; they do not tell you the publisher is safe.
How CocoaPods and SwiftPM resolve and lock dependencies
Both tools separate the declared intent (a version range in a manifest) from the resolved result (exact versions in a lockfile). Supply chain risk lives in the gap between the two: whenever the resolved result can change without a reviewed commit, new code can enter the app.
| Aspect | CocoaPods | Swift Package Manager |
|---|---|---|
| Manifest | Podfile (Ruby DSL), with podspecs describing each pod | Package.swift, or the Xcode project's package dependency list |
| Lockfile | Podfile.lock records the installed version of every pod, including transitive pods | Package.resolved records resolved versions and revisions for the top-level (leaf) project |
| Where packages come from | Spec repositories (trunk via the CDN, private spec repos), or a pod declared with :git, :path or :podspec | Git repository URLs, or a package registry addressed as scope.package-name |
| Honour the lockfile | pod install uses locked versions; only pods missing from the lockfile are resolved | swift package resolve keeps recorded versions while they remain eligible |
| Move to newer versions | pod update PODNAME (or all pods with no name) | swift package update, which rewrites Package.resolved |
| Strict CI mode | pod install --deployment prevents any change to the Podfile or Podfile.lock | --force-resolved-versions (aliases --disable-automatic-resolution, --only-use-versions-from-resolved-file) fails if Package.resolved is out of date |
| Integrity check on download | Version and source recorded in Podfile.lock; content trust rests on the spec source and Git | Fingerprint trust-on-first-use: Git revision hash, or source archive checksum for registry packages |
The CocoaPods guide is explicit that exact versions in the Podfile are not enough: a pod's own dependencies are not pinned by your Podfile, so two developers can get different transitive versions unless Podfile.lock is shared. Its advice is to always commit and push Podfile.lock, even if you do not commit the Pods folder. The general trade-off between ranges and exact versions is covered in Dependency Pinning vs Version Ranges.
Pinning that holds in CI
- Commit both lockfiles for apps: Podfile.lock at the repository root; for Xcode projects, the Package.resolved inside the project's shared workspace data. Treat a diff to either as a code change that needs review.
- Fail on drift: run
pod install --deploymentin CI and the release pipeline. For SwiftPM command-line builds pass--force-resolved-versionstoswift buildorswift package resolve; for xcodebuild, disable automatic package resolution so a stale Package.resolved stops the build rather than being rewritten. - Never add a pod with
pod update: the CocoaPods guide warns it can unexpectedly update existing pods. Add pods withpod installand update named pods deliberately. - Prefer tags or commits over branches: a pod declared with
:gitand:branch, or a Swift package that tracks a branch, follows whatever the upstream pushes. Use:tagor:commitin the Podfile and version or revision requirements in Package.swift for anything that ships. - Constrain libraries in the manifest: if your team publishes an internal Swift package, its Package.resolved is ignored by consumers. Put the bounds that matter in Package.swift and test against the lowest and highest versions you allow.
- Batch updates through automation: let a bot raise update pull requests so every lockfile change has a diff, a changelog and a test run. See the Dependency Update Automation Guide.
Sources, private spec repos and dependency confusion
CocoaPods sources are global and their order matters. The Podfile syntax reference states that CocoaPods uses the highest version of a pod from the first source that includes it, even if a later source has a higher version, and that once you declare any source the official CDN source is no longer implicit. That rule is the basis of the CocoaPods dependency confusion case: if an internal pod name also exists on a public source listed first, the public pod wins.
| Risk | How it arises | Control |
|---|---|---|
| Public pod shadows a private pod | Public source listed before the private spec repo, and the internal name exists publicly | List the private repo first, add :source on each internal pod, and keep :warn_for_multiple_pod_sources on (default true) and treat the warning as a failure |
| Unreviewed podspec from a URL | :podspec pointing at a web URL you do not control | Copy the podspec into a private spec repo you own and pin the version |
| Branch-tracking dependency | :branch or a SwiftPM branch requirement | Pin :commit or :tag; require review for any change |
| Abandoned repository URL | Swift package or pod source points at a GitHub owner that was renamed or deleted | Inventory URLs and claim or mirror them; see the RepoJacking and Namespace Takeover Guide |
| Swift package resolved from two origins | Same package reachable by Git URL and by registry identity | Use --use-registry-identity-for-scm or --replace-scm-with-registry deliberately and document which origin is authoritative |
| Binary framework you cannot read | XCFramework or binary target from a vendor | Require a checksum, Apple SDK signature for listed SDKs, and a privacy manifest |
For private pods, the CocoaPods guide describes a Git-hosted spec repository registered with pod repo add, checked with pod repo lint and updated with pod repo push. Restrict push access to that repository to the release pipeline and a small maintainer group, because anyone who can push a podspec can redirect a pod to new source.
SwiftPM integrity: fingerprints, registries and signing
Swift Package Manager records a fingerprint for every package version it downloads, under ~/.swiftpm/security/fingerprints, and requires later downloads of the same version to match. For Git packages the fingerprint is the Git hash of the revision; for registry packages it is the checksum of the source archive. If registries report conflicting fingerprints SwiftPM returns an error; --resolver-fingerprint-checking defaults to strict and can be lowered to warn, which you should not do in CI.
Package registries (SE-0292 and later proposals) let organisations serve Swift packages by scope instead of Git URL. Registries are mapped per scope in registries.json at project level (.swiftpm/configuration/registries.json) or user level, and swift package-registry login supports basic and token authentication. Registry credentials are non-human credentials: issue CI its own read-only token, store it in the CI secret store and rotate it. See the Secrets Management Guide.
SE-0391, implemented in Swift 5.9, added package signing with a single format, cms-1.0.0, using a detached CMS signature over the source archive with ECDSA P-256 and SHA-256. Signing certificates must carry the code signing extended key usage. Consumers control validation in the security section of the user-level registries.json:
| Setting | Values | Recommended for CI |
|---|---|---|
signing.onUnsigned | error, prompt, warn, silentAllow | error for scopes where your registry requires signing; warn elsewhere while you build coverage |
signing.onUntrustedCertificate | error, prompt, warn, silentAllow | error; continuing with an untrusted certificate is treated as unsigned |
signing.trustedRootCertificatesPath | Directory of DER-encoded roots | Your internal signing root, deployed with the build image |
signing.validationChecks.certificateExpiration | enabled, disabled | enabled |
signing.validationChecks.certificateRevocation | strict, allowSoftFail, disabled | allowSoftFail at minimum; strict where OCSP is reachable |
Overrides apply per package, then per scope, then per registry, then the default. The SE-0391 proposal itself cautions that signed packages should not be trusted unconditionally: signing proves the archive was signed by a certificate you trust, and SwiftPM still trusts the registry for authenticity.
Planning for the CocoaPods trunk read-only date
The CocoaPods team announced that trunk will permanently stop accepting new podspecs on 2 December 2026, after a test run on 2 to 6 November 2026 that rejected new podspecs so automation fails early. New podspecs using prepare_command have been blocked since May 2025. The announcement says existing builds keep working, the Specs repository and CDN stay available in read-only form, and the dates could slip later but not earlier. Projects that use their own spec repositories, or that vendor all their dependencies, are not affected.
The security consequence is quieter than an outage: a pod whose maintainer only publishes through trunk will stop receiving fixes through CocoaPods. A team that keeps resolving from trunk after December 2026 is pinned to the last trunk version of every pod, including any later security patch that only ships elsewhere.
| Migration path | Choose when | Integrity controls to carry over |
|---|---|---|
| Move the dependency to Swift Package Manager | The upstream already ships a Package.swift or a binary target | Exact or revision requirement, committed Package.resolved, strict fingerprint checking, checksum on binary targets |
| Private spec repository | You need CocoaPods for a while longer, or must patch a pod yourself | Restricted push rights, podspec review, private repo first in source order, :source per pod |
| Vendor the source into the repository | The pod is small, abandoned or rarely changes | Record origin and commit in an SBOM, scan with SCA, assign an owner for patches |
| Remove or replace the dependency | The pod is unmaintained and duplicates platform APIs | Track removal in the dependency inventory |
- Inventory (week 1): parse every Podfile.lock across repositories into a list of pods, versions and sources. Generate an SBOM per app; see the SBOM Guide.
- Classify (week 2): for each pod record whether upstream offers Swift Package Manager support, whether it is maintained, and whether it contains binaries.
- Pilot (weeks 3 to 4): migrate one app with few pods. Keep Podfile.lock and Package.resolved side by side, build both ways and compare the shipped binary's linked frameworks.
- Roll out by risk: migrate pods in networking, authentication, cryptography and analytics first, because these see the most security fixes and handle the most data.
- Rollback: keep the last working Podfile and Podfile.lock on a branch until the SwiftPM build has shipped at least one release; trunk content stays readable, so reverting is possible.
- Close out: remove the CDN source line from Podfiles that no longer need it and record the remaining CocoaPods dependencies with a named owner.
Pod authors who still publish should confirm automation has been moved off pod trunk push, and remove stale trunk owners with care: researchers reported trunk flaws, including CVE-2024-38368 in the "claim your pods" flow, which let pods never claimed after the move from the pre-2014 pull request workflow, or left with no owners, be claimed again. CocoaPods said in October 2023 that the flaws were fixed and that it had reset all user sessions.
Binary SDKs and Apple's requirements
Both managers can deliver closed binaries (vendored frameworks in pods, binary targets and XCFrameworks in SwiftPM). Apple's third-party SDK requirements apply here: when you adopt a new version of a third-party SDK, Xcode validates that it was signed by the same developer, and for SDKs on Apple's list of commonly used SDKs a privacy manifest is required, and a signature is required when the SDK is a binary dependency, for new apps and updates that add a listed SDK. You remain responsible for everything an SDK includes. Use these checks as a gate in review: a change of signer on a binary SDK update should stop the merge until someone confirms why. The OWASP view of this risk is covered in the OWASP Mobile Top 10 M2 Inadequate Supply Chain Security Guide.
Choosing controls by team size
- Small team, one app: commit both lockfiles, run strict resolution in CI, enable automated update pull requests and keep sources to the CDN plus Git tags. Plan the trunk exit as part of normal dependency updates.
- Several apps and shared internal libraries: add a private spec repository or Swift registry for internal code, enforce
:sourceon internal pods, and generate SBOMs per release. - Regulated or high-value apps (banking, health): proxy or mirror all external packages, require signed registry packages for internal scopes with
onUnsignedset to error, require two-person review of lockfile diffs, and block binary SDK updates whose signer changes.
Detection and measurement
Watch for lockfile changes that did not come through the update process, new sources or registry mappings, fingerprint mismatch errors in build logs, and changes to registries.json or Podfile source lines. Alert when a CI job runs pod update or swift package update, since release builds should never resolve new versions.
- Lockfile coverage: share of app repositories with a committed Podfile.lock or Package.resolved and strict resolution in CI (target 100 percent).
- Unpinned references: count of branch-tracking pods or packages in shipped apps (target zero).
- Trunk dependence: number of pods still resolved from trunk, tracked down to the agreed exit date.
- Patch latency: days from a security fix upstream to the release that contains it, per app.
- Integrity failures: fingerprint or signature errors per month, each investigated rather than overridden.
Framework mapping
| Framework | Reference | Where it applies |
|---|---|---|
| MITRE ATT&CK | T1195.001 Compromise Software Dependencies and Development Tools | Malicious or shadowed pods and packages |
| NIST SP 800-53 Rev. 5 | SR-3, SR-4 Provenance, SR-11 Component Authenticity | Source control, private repos, SBOM of origin |
| NIST SP 800-53 Rev. 5 | SI-7 and SI-7(6), CM-14 Signed Components | Fingerprints, registry signing, binary SDK signatures |
| NIST SP 800-53 Rev. 5 | CM-8, SA-15 | Dependency inventory and build tool configuration |
| NIST CSF 2.0 | ID.AM-02, PR.PS-02, GV.SC-07 | Software inventory, maintenance and supplier risk |
| CIS Controls v8.1 | 16.4, 16.5 | Third-party component inventory and trusted, current components |
| ISO/IEC 27001:2022 Annex A | 5.21, 8.28, 8.32 | ICT supply chain, secure coding, change management |
Common failure patterns
- Lockfile in .gitignore: every CI run resolves afresh, so a compromised or broken new release ships without anyone choosing it.
- Xcode rewrites Package.resolved in CI: automatic resolution quietly updates the file on the build agent and the build passes, hiding drift.
- Private pod names without source pinning: internal pods resolved by name across several sources, so a public pod with the same name can win.
- Fingerprint errors turned into warnings: a team lowers
--resolver-fingerprint-checkingto fix one flaky build and leaves it there, removing the main tamper check. - Assuming trunk will just keep working: builds do keep working after December 2026, which is the trap: the app stops receiving pod updates and nobody notices until a fix is needed.
- Registry token on developer laptops: a broad-scope registry token copied into every machine and never rotated. Scope CI tokens to read-only and keep them in the CI secret store.
Practitioner checklist
- Commit Podfile.lock and Package.resolved for every app and review their diffs.
- Run
pod install --deploymentand SwiftPM with--force-resolved-versionsin CI and release builds. - Replace branch references with tags, commits or exact versions.
- Put the private spec repository first and add
:sourceto every internal pod. - Keep
--resolver-fingerprint-checkingat strict and investigate every mismatch. - Set registry signing to error on unsigned or untrusted packages for internal scopes.
- Inventory every pod resolved from trunk and assign a migration path before 2 December 2026.
- Gate binary SDK updates on signer continuity and a privacy manifest.
- Give CI its own read-only registry token and rotate it.
Standards and references
- CocoaPods: CocoaPods Trunk vulnerabilities, October 2023
- CocoaPods: CocoaPods Specs Repo read-only plan
- CocoaPods: pod install vs. pod update
- CocoaPods: Podfile syntax reference
- Swift Package Manager: Package Security
- Swift Package Manager: Resolving and updating dependencies
- Swift Evolution: SE-0391 Package Registry Publish
- Apple: Third-party SDK requirements
- MITRE ATT&CK: Compromise Software Dependencies and Development Tools
Related NHI Mgmt Group resources: Software Supply Chain Security Guide · Swift and iOS Secure Coding Guide · RepoJacking and Namespace Takeover Guide · OWASP Mobile Top 10 M2 Inadequate Supply Chain Security Guide