Join our Newsletter — 33% off our NHI Course
Home› Guides› CocoaPods and Swift Package Manager Security Guide: Pinning,…
Guide Software & AI Supply Chain

CocoaPods and Swift Package Manager Security Guide: Pinning, Lockfile Integrity and Trunk Sunset Migration

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 14 November 2026 15 min read
On this page

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.

AspectCocoaPodsSwift Package Manager
ManifestPodfile (Ruby DSL), with podspecs describing each podPackage.swift, or the Xcode project's package dependency list
LockfilePodfile.lock records the installed version of every pod, including transitive podsPackage.resolved records resolved versions and revisions for the top-level (leaf) project
Where packages come fromSpec repositories (trunk via the CDN, private spec repos), or a pod declared with :git, :path or :podspecGit repository URLs, or a package registry addressed as scope.package-name
Honour the lockfilepod install uses locked versions; only pods missing from the lockfile are resolvedswift package resolve keeps recorded versions while they remain eligible
Move to newer versionspod update PODNAME (or all pods with no name)swift package update, which rewrites Package.resolved
Strict CI modepod 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 downloadVersion and source recorded in Podfile.lock; content trust rests on the spec source and GitFingerprint 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 --deployment in CI and the release pipeline. For SwiftPM command-line builds pass --force-resolved-versions to swift build or swift 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 with pod install and update named pods deliberately.
  • Prefer tags or commits over branches: a pod declared with :git and :branch, or a Swift package that tracks a branch, follows whatever the upstream pushes. Use :tag or :commit in 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.

RiskHow it arisesControl
Public pod shadows a private podPublic source listed before the private spec repo, and the internal name exists publiclyList 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 controlCopy the podspec into a private spec repo you own and pin the version
Branch-tracking dependency:branch or a SwiftPM branch requirementPin :commit or :tag; require review for any change
Abandoned repository URLSwift package or pod source points at a GitHub owner that was renamed or deletedInventory URLs and claim or mirror them; see the RepoJacking and Namespace Takeover Guide
Swift package resolved from two originsSame package reachable by Git URL and by registry identityUse --use-registry-identity-for-scm or --replace-scm-with-registry deliberately and document which origin is authoritative
Binary framework you cannot readXCFramework or binary target from a vendorRequire 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:

SettingValuesRecommended for CI
signing.onUnsignederror, prompt, warn, silentAllowerror for scopes where your registry requires signing; warn elsewhere while you build coverage
signing.onUntrustedCertificateerror, prompt, warn, silentAllowerror; continuing with an untrusted certificate is treated as unsigned
signing.trustedRootCertificatesPathDirectory of DER-encoded rootsYour internal signing root, deployed with the build image
signing.validationChecks.certificateExpirationenabled, disabledenabled
signing.validationChecks.certificateRevocationstrict, allowSoftFail, disabledallowSoftFail 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 pathChoose whenIntegrity controls to carry over
Move the dependency to Swift Package ManagerThe upstream already ships a Package.swift or a binary targetExact or revision requirement, committed Package.resolved, strict fingerprint checking, checksum on binary targets
Private spec repositoryYou need CocoaPods for a while longer, or must patch a pod yourselfRestricted push rights, podspec review, private repo first in source order, :source per pod
Vendor the source into the repositoryThe pod is small, abandoned or rarely changesRecord origin and commit in an SBOM, scan with SCA, assign an owner for patches
Remove or replace the dependencyThe pod is unmaintained and duplicates platform APIsTrack removal in the dependency inventory
  1. 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.
  2. Classify (week 2): for each pod record whether upstream offers Swift Package Manager support, whether it is maintained, and whether it contains binaries.
  3. 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.
  4. 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.
  5. 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.
  6. 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 :source on 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 onUnsigned set 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

FrameworkReferenceWhere it applies
MITRE ATT&CKT1195.001 Compromise Software Dependencies and Development ToolsMalicious or shadowed pods and packages
NIST SP 800-53 Rev. 5SR-3, SR-4 Provenance, SR-11 Component AuthenticitySource control, private repos, SBOM of origin
NIST SP 800-53 Rev. 5SI-7 and SI-7(6), CM-14 Signed ComponentsFingerprints, registry signing, binary SDK signatures
NIST SP 800-53 Rev. 5CM-8, SA-15Dependency inventory and build tool configuration
NIST CSF 2.0ID.AM-02, PR.PS-02, GV.SC-07Software inventory, maintenance and supplier risk
CIS Controls v8.116.4, 16.5Third-party component inventory and trusted, current components
ISO/IEC 27001:2022 Annex A5.21, 8.28, 8.32ICT 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-checking to 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 --deployment and SwiftPM with --force-resolved-versions in CI and release builds.
  • Replace branch references with tags, commits or exact versions.
  • Put the private spec repository first and add :source to every internal pod.
  • Keep --resolver-fingerprint-checking at 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

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.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 14 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.