swiftlang / swiftlang/swift-build
[FileCopyTaskAction] Injected codeless-framework stubs retain the linker's temporary signing identifier
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 2.2k
- Forks
- 216
- Avg merge
- 21h 6m
- Merged PRs (30d)
- 66
Description
[!IMPORTANT]
The below is produced by Claude and Codex, I have read it and it sounds reasonable to me but my knowledge of Swift Build and code signing is rather limited.
Description
When builtin-copy -remove-static-executable leaves an embedded framework codeless, FileCopyTaskAction injects a dynamic stub binary. The stub is linked using -adhoc_codesign.
The resulting linker-generated signature uses the temporary per-architecture output filename as its identifier, for example:
Identifier=arm64-apple
flags=...linker-signed...
This does not match the framework bundle identifier:
CFBundleIdentifier=com.apple.AStaticFwk
Distribution signing flows can derive an explicit designated requirement from the existing signature before re-signing the framework. That captures the temporary identifier, while codesign subsequently derives the actual identifier from the framework bundle. The resulting signature has a mismatched designated requirement and can be rejected during App Store validation with:
90035: Invalid Signature. Code failed to satisfy specified code requirement(s).
Minimal reproduction
The regression test included in the associated pull request, codelessFrameworkStubSignatureNormalizationWithCodeSigningDisallowed, constructs an in-memory project containing:
- An application target
- A static framework copied into the application's Frameworks directory
codeSignOnCopy: falseCODE_SIGNING_ALLOWED=NO
It performs a real build operation and inspects the copied framework with codesign.
The test fails without the fix because the embedded framework reports the temporary identifier and retains the linker-signed flag. It covers both macOS and an iOS device destination without requiring signing identities or provisioning.
CODE_SIGNING_ALLOWED=NO is intentional: the linker ad-hoc signs the injected stub regardless of code-signing policy, and an unsigned archive may still be signed later during distribution.
Expected behavior
After injecting the stub:
Identifier=com.apple.AStaticFwk
The signature should not retain the linker-signed flag.
Actual behavior
The stub retains the linker's temporary filename identifier, such as:
Identifier=arm64-apple
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at FileCopyTaskAction and the builtin-copy -remove-static-executable path that injects the codeless framework stub. Run codelessFrameworkStubSignatureNormalizationWithCodeSigningDisallowed for the macOS and iOS device destinations, then verify the copied framework reports its CFBundleIdentifier and no longer retains the linker-signed flag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100