Reject unsafe Core Foundation object hooks#46
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 11, 2026, 6:58 AM ET / 10:58 UTC. Summary Reproducibility: yes. there is a high-confidence source-level reproduction path: the linked report calls NSURL.host through object.hook, and current master reaches object_setClass without a Core Foundation guard. I did not execute the macOS runtime repro in this read-only review. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge this safety guard if maintainers accept the fail-fast compatibility change, preserving the README/changelog caveat and NSURL regression coverage. Do we have a high-confidence way to reproduce the issue? Yes, there is a high-confidence source-level reproduction path: the linked report calls NSURL.host through object.hook, and current master reaches object_setClass without a Core Foundation guard. I did not execute the macOS runtime repro in this read-only review. Is this the best way to solve the issue? Yes, the proposed approach is narrow: it rejects unsafe objects before dynamic subclassing and applies the same validation to both object-hook APIs. The main maintainer decision is whether the new fail-fast behavior is an acceptable compatibility tradeoff. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning high; reviewed against 20945a4b67cb. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
Interpose(object)and directobject.hook(...)Root cause
Swift ARC releases Objective-C objects through
swift_unknownObjectRelease. Afterobject_setClasschanges an NSURL instance to an InterposeKit-generated subclass, that release traps on current Apple runtimes. Core Foundation-backed Foundation objects therefore cannot safely use InterposeKit's per-object isa-swizzling path.Verification
swift testswift test -c releasebash Tests/verify_release_linking.shbash Tests/verify_class_load_watcher.shIKT_FORCE_DYLD_IMAGE_CALLBACK=1 bash Tests/verify_class_load_watcher.sh$autoreview: cleanCloses #23