I turned on Xcode's Enhanced Security capability in a reading app I'm working on, an iOS and Mac Catalyst app whose parsing and indexing live in a Rust core behind UniFFI, and most of the work ended up being around the checkbox rather than in it. This post goes through why pointer authentication had to stay off, why a simulator build can't show you whether the entitlements are there, and how to measure what they cost in memory by signing the same binary twice.
What Enhanced Security is
Enhanced Security is a capability you add in the target's Signing & Capabilities tab, and it turns on a collection of entitlements and build settings that Apple describes as designed to mitigate common vulnerabilities. Most of them work the same way, by turning a memory bug into a crash at the bad access, instead of letting it corrupt memory that an attacker can then use to read or change the app's data. It's a bundle of separate things, and it helps to keep them apart, because each one has a different cost and you can adopt (or turn off) each one separately. Going by Apple's Enabling enhanced security for your app article and the reference Xcode ships (more on that below):
| Piece | Kind | What it does |
|---|---|---|
| Guard objects | entitlement (version 2) | replaces freed memory with inaccessible guard regions, so a use-after-free crashes |
| Hardened heap | entitlement | adds type-isolation buckets to the allocator, so allocations of different types are kept apart |
Read-only platform memory (dyld-ro) | entitlement | marks the memory the platform keeps its own state in as read-only |
| Platform restrictions | entitlement | adds checks on the dynamic libraries the app loads and the Mach messages it receives |
| Memory tagging | entitlement | tags every allocation and pointer, and crashes on a mismatch (use-after-free, out-of-bounds), on A19 and M5 hardware only |
| Stack zero-initialization | build setting | zeroes stack variables, against reusing a previous value in stack memory |
| Typed allocators | build setting | passes type information from C and C++ code to the allocator, which the hardened heap uses |
| Security warnings | build setting | turns on a set of compiler warnings for potentially insecure code |
| C++ standard library hardening | build setting | adds constant-time checks to container access in libc++ |
| Pointer authentication | build setting | signs pointers when they're created and checks the signature when they're used, against overwritten control flow, and builds every binary for arm64e |
The build settings all come in through one switch, ENABLE_ENHANCED_SECURITY, which cascades them, pointer authentication included.
As for why, the app imports EPUB, MOBI, FB2, comic archives and audio files that come from wherever the user got them, and a memory-safety bug in a parser is the kind of thing that turns a crafted book file into code execution. Safe Rust already rules out most of these bugs in the parser code itself, but the app is also Swift, Objective-C and C underneath (SQLite, for one), and the Rust code allocates from the same heap, so the protections cover all of it, and IMO it's worth having for any app that opens files it didn't create. Apple's article is careful to say it isn't free, since the checks can affect the performance and stability of an app that wasn't built with them in mind, and it suggests adopting the protections that fit your threat model and testing for the crashes they cause. The rest of this post is mostly about that part.
Where the keys come from
My first key set was a guess at what the capability editor writes, and it missed hardened-heap, so I went looking for something more authoritative. Xcode 27.2 ships a reference for its own security-settings audit inside the IDE bundle, and it lists every key, which ones are required, which are on by default, and which ones are deprecated. The two files worth reading are plain Markdown, despite the extension:
R=/Applications/Xcode.app/Contents/PlugIns/IDEIntelligenceChat.framework/Versions/A/Resources less "$R/audit-xcode-security-settings-ref-enhanced-security.md.packaged" less "$R/audit-xcode-security-settings-ref-settings-and-entitlements-catalog.md.packaged" Going by them, the entitlements look like this:
<key>com.apple.security.hardened-process</key> <true/> <key>com.apple.security.hardened-process.enhanced-security-version-string</key> <string>2</string> <key>com.apple.security.hardened-process.hardened-heap</key> <true/> <key>com.apple.security.hardened-process.dyld-ro</key> <true/> <key>com.apple.security.hardened-process.platform-restrictions-string</key> <string>2</string> <key>com.apple.security.hardened-process.checked-allocations</key> <true/> <key>com.apple.security.hardened-process.checked-allocations.soft-mode</key> <true/> The first two are required (version 2 is the level that, according to Apple's article, adds guard objects). hardened-heap, dyld-ro and platform-restrictions-string are on by default. The last two are memory tagging, which is off by default and which I opted into, and which only does anything on A19 or M5 hardware. None of my devices have it (sysctl hw.optional.arm.FEAT_MTE prints 0 on an M4 Max, and the iPad is an A13), so it stays in soft mode, where a tag mismatch writes a simulated crash report instead of killing the process. Soft mode is a rollout stage, and you'd drop it once a run on tagging hardware comes back clean. Also note the -string suffixes, since the variants without them are deprecated.
The heap keys cover the Rust code too, but only because the Rust core allocates through the system malloc. A crate that sets its own #[global_allocator] (mimalloc, jemalloc) would keep its allocations out of the hardened heap, so it's worth a grep -rn global_allocator over the crates you ship (in this app the only hits are in a test and a benchmark).
Why pointer authentication stays off
The reference also says that ENABLE_ENHANCED_SECURITY = YES turns pointer authentication on as part of its cascade, and that you shouldn't set the cascaded settings by hand. Pointer authentication means every linked binary needs an arm64e slice, and Rust can't provide one here. arm64e-apple-ios is a tier 3 target, so there is no prebuilt standard library for it (you'd need nightly and -Zbuild-std), and there is no arm64e Mac Catalyst target at all:
rustc --print target-list | grep '^arm64e-' # arm64e-apple-darwin, -ios, -tvos; no -macabi rustup target list | grep '^arm64e-' # nothing, no prebuilt std for any of them (That's as of rustc 1.95. Without the ^ and the dash, both commands also match arm64ec-pc-windows-msvc, which is confusing.) Sentry was the other dependency I checked, and there the answer is a product choice rather than a blocker. The app links sentry-cocoa's Sentry-Dynamic product, which has no arm64e slice, but the package ships one in Sentry-Dynamic-WithARM64e and in the static Sentry product (sentry-cocoa 9.34), so switching products would be enough. Rust is the part that has to wait.
Edit (2026-11-20): that's only true for
arm64e. With the platform-restrictions key on, Sentry's Mach exception handler gets the app killed at start, which I wrote about in a follow-up post.Edit (2026-11-27): Sentry Cocoa 9.36.0 has the fix.
Edit (2026-11-21): the app doesn't link
Sentry-Dynamic, I got that part wrong. It builds sentry-cocoa from source through the package'sSentrySPMproduct, which compiles for whatever architectures the app builds, so Sentry isn't a blocker for pointer authentication at all and Rust is the only one.
So the build settings on the app target are the cascade plus one explicit override:
ENABLE_ENHANCED_SECURITY: YES ENABLE_POINTER_AUTHENTICATION: NO The reference itself sanctions this and says to override pointer authentication off only on a target that links a binary dependency without arm64e, which describes the prebuilt Rust XCFramework. What you give up is the control-flow protection from the table above. The cascade's compiler settings still apply, and in this app they built without a single new warning, though they only reach the app target's own C-family code and not the SwiftPM packages or the prebuilt Rust library. Apple's article also suggests selecting Enable Enhanced Security for All Targets in the capability editor, which is the checkbox that turns ENABLE_POINTER_AUTHENTICATION on, so in an app like this one that's the box to leave unchecked.
Edit (2026-11-21): the app target compiles no C, so at the time the compiler settings reached no code at all. Getting them into the packages and the Rust library is in another follow-up post.
A simulator build can't show the entitlements
The simulator build signed and launched fine, and I took that as proof the entitlements were in place, until I read the signature. Xcode's simulator signing writes only two of the seven keys (hardened-process and checked-allocations) into the code signature, and puts all seven into a separate …-Simulated.xcent file that ends up embedded as a __TEXT,__entitlements section. You can see the difference by comparing the two .xcent files in the build's intermediates folder, or by running this on the built app:
codesign -d --entitlements - --xml Path/To/App.app | plutil -p - On a simulator build that shows the two keys, and on a device or Mac build it shows all seven. A signature only tells you what the binary asks for, though, and on the Mac we can also check what the running process got. The hardened process has address-space regions that an unhardened one doesn't, so with the app running:
vmmap -summary <pid> | grep -E '^(Guard|dyld private memory)' Both lines show up only in the copy signed with the keys (dyld private memory is most likely dyld-ro at work, though the comparison below removes all seven keys at once, so it can't pin a region on one key).
Getting the device build signed
The simulator also skips the provisioning check. The first device build was refused at signing with "Provisioning profile … doesn't include the Enhanced Security capability", followed by the list of all seven keys. Enhanced Security is a capability on the App ID, so the provisioning profile has to carry it. With automatic signing and an account signed in to Xcode, passing -allowProvisioningUpdates to xcodebuild lets Xcode add it, and with manual signing (or on CI without an account) you enable the capability on the App ID in the developer portal and regenerate the profile yourself. The Mac Catalyst build has its own profile, so it needed the same treatment.
In my case the same build also reported "PLA Update available", meaning a newer Program License Agreement was pending on the account, and until it was accepted automatic signing couldn't update the profile. The one to accept is on the account page at developer.apple.com, not in App Store Connect. After that the device build passed, its signature carried all seven keys, and a Debug build launched on iPadOS 26 to its main UI. I haven't been able to check how older OS releases treat the keys.
Measuring the memory cost by re-signing one binary twice
Apple's article asks you to profile after enabling version 2, since guard objects can increase memory use or slow the app down depending on its workload (and if the cost is too high, a no-guard-objects entitlement turns them off). Comparing two builds would mix in everything else that differs between builds, so instead we can take one Release Mac Catalyst binary and sign it twice, once with the entitlements and once without, so that the entitlements are the only difference. That also means the measurement covers the entitlements only. The compiler settings from the cascade are in both copies.
Edit (2026-11-21): when I measured, those compiler settings reached no code in either copy (see the edit above), so these numbers say nothing about what the compiler hardening costs.
First dump the entitlements the installed app is signed with, make a second file without the seven hardened-process keys, and re-sign two fresh copies:
rm -rf A B && mkdir A B ditto /Applications/App.app A/App.app ditto /Applications/App.app B/App.app codesign -d --entitlements - --xml /Applications/App.app > ent-A.plist cp ent-A.plist ent-B.plist for k in hardened-process hardened-process.enhanced-security-version-string \ hardened-process.hardened-heap hardened-process.dyld-ro \ hardened-process.platform-restrictions-string hardened-process.checked-allocations \ hardened-process.checked-allocations.soft-mode; do /usr/libexec/PlistBuddy -c "Delete :com.apple.security.$k" ent-B.plist done for v in A B; do codesign --force --sign "$IDENTITY" --entitlements ent-$v.plist \ --preserve-metadata=identifier,requirements,flags,runtime $v/App.app codesign --verify --strict $v/App.app done $IDENTITY has to be the certificate the installed app is already signed with (codesign -dvv /Applications/App.app 2>&1 | grep Authority), because the embedded provisioning profile only authorizes that one for the app's other entitlements. The --preserve-metadata part matters, since without it codesign starts from scratch and drops the hardened-runtime flag, and then the two copies differ from the shipped app and not only in the seven keys. With it, the identifier, the requirements and the runtime flag stay the same, and only the entitlements and the code hash change (codesign -dv A/App.app B/App.app 2>&1 | grep flags= should print runtime for both). My Release build is signed with a development identity, so both copies also keep get-task-allow, which is fine for measuring on your own Mac and not something to hand to anyone.
Both copies have the same bundle identifier, so they share the app's data, preferences and saved window state, and two things follow from that. Only one copy may run at a time, so every run starts by quitting whatever is running, the installed app included. And the first time a copy opens the book, the app imports it into its library, which is a one-time cost, so do one warm-up run that you throw away before the measured ones. One run then looks like this:
for p in $(pgrep -f '/App.app/Contents/MacOS/App'); do kill $p; while kill -0 $p 2>/dev/null; do sleep 1; done done open "$PWD/A/App.app" --args -ApplePersistenceIgnoreState YES; sleep 15 pid=$(pgrep -n -f "$PWD/A/App.app/Contents/MacOS/App") [[ -n $pid ]] || { echo "A did not launch"; exit 1; } open -a "$PWD/A/App.app" book.epub; sleep 45 vmmap -summary $pid | grep '^Physical footprint' footprint -p $pid | grep MALLOC_ sysctl -n vm.loadavg (-ApplePersistenceIgnoreState YES is there because otherwise macOS restores the previous reader window at whatever odd size it was left at.) The script around it repeats that for both variants, interleaved as A1 B1 A2 B2 A3 B3. The book was an illustrated EPUB of about 86 MB, far larger than a typical text-only book.
| 45 s after opening the book | With the keys | Without |
|---|---|---|
| Physical footprint, median of 3 | 136.3 MB | 138.2 MB |
| Peak footprint since launch, median of 3 | 144.9 MB | 141.9 MB |
| Spread of the footprint across the 3 runs | 7.2 MB | 11.2 MB |
| Spread of the peak across the 3 runs | 10.0 MB | 13.8 MB |
The difference between the variants is smaller than the spread within either one (and the peak goes the other way), so at this size there is no physical memory cost I could measure. Interleaving spread the noise across both variants but didn't even it out. The load average on the Mac swung from 24 to 256 during the series, and the first B run happened to land at 187 to 256 while the first A run saw 24 to 58, which is another reason not to read anything into a difference of a couple of megabytes.
The cost does show up in address space. In one snapshot of each copy, only the one signed with the keys had these regions in vmmap -summary:
Guard about 905 MB virtual over 217 regions, 0 resident dyld private memory 160 KB The guard regions are reserved and never touched, so they cost virtual address space and not RAM. The keyed copy also had an owned unmapped region (1.7 MB) and an empty MALLOC_LARGE one, but those depend on the allocator's state at the moment of the snapshot, so one sample isn't enough to pin them on the keys.
The numbers cover launching the app and opening one large book. Page turns barely moved the app's own footprint (about 1.3 MB over 40 pages in one run), since EPUB pages render in WebKit's WebContent processes, which run under WebKit's own entitlements and not the app's, and loading an on-device model is a separate allocation pattern I haven't measured.
Summary
In an app with a Rust core, Enhanced Security means adopting everything except pointer authentication, and setting ENABLE_POINTER_AUTHENTICATION = NO explicitly, because the capability turns it on and stable Rust has no arm64e standard library for iOS and no arm64e Catalyst target at all (Sentry builds from source, so it isn't a blocker). A simulator build can't tell you whether the entitlements are there, so check a device or Mac signature, and on the Mac check the running process in vmmap as well. To find out what the entitlements cost, re-sign the same binary with and without them, keep the hardened-runtime flag, run one copy at a time after a warm-up, and look at vmmap, which in this app showed about 905 MB of reserved address space in guard regions and no physical memory cost that stood out from the noise.