Skip to content

[SecurityInterface] Update bindings up to Xcode 27.0 Beta 4 - #26281

Open
dalexsoto wants to merge 5 commits into
xcode27.0from
dev/alex/xc27-SecurityInterface
Open

[SecurityInterface] Update bindings up to Xcode 27.0 Beta 4#26281
dalexsoto wants to merge 5 commits into
xcode27.0from
dev/alex/xc27-SecurityInterface

Conversation

@dalexsoto

Copy link
Copy Markdown
Member

Summary

  • add complete macOS bindings for SecurityInterface
  • add safe managed wrappers for authorization callbacks, authorization rights, authorization engine handles, keychains, and keychain settings
  • add strongly typed certificate, identity, and policy APIs, plus Action-based sheet completion overloads
  • register SecurityInterface in the macOS framework and linking infrastructure
  • resolve the SecurityInterface xtro todo and retain only the informal-protocol selector ignores

This supersedes #25141 and incorporates all review feedback from that PR.

Validation

  • make world
  • clean xtro generation/classification: sanity passed
  • clean cecil suite
  • macOS introspection: 32 passed, 2 host-version-gated
  • iOS introspection: 44 passed
  • tvOS introspection: 43 passed
  • Mac Catalyst non-constructor introspection fixtures passed; the full constructor fixture hit the documented headless TCC crash in CLLocationButton
  • SecurityInterface monotouch tests: 61 passed
  • linked native framework tests: 8 passed
  • clean macOS CoreCLR app-size test, forced past the beta-Xcode skip

Add complete macOS bindings for the SecurityInterface framework, including
authorization views, certificate panels, identity selection, keychain panels,
informal delegates, enums, notifications, and constants.

Add safe managed support for the Security types used by these APIs:
authorization callback tables and rights, the non-retaining authorization
engine handle, keychain references, and keychain settings. Provide strongly
typed certificate, identity, and policy APIs plus Action-based sheet
completion overloads.

Register SecurityInterface in the macOS framework lists, resolve the xtro todo,
update the app-size baseline, and add runtime, ABI, ownership, API-shape, and
framework-linking coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3afd7cac-e572-41ec-89e3-c727fd15b3c2
Copilot AI review requested due to automatic review settings July 24, 2026 00:36
@dalexsoto
dalexsoto requested a review from rolfbjarne as a code owner July 24, 2026 00:36
@dalexsoto dalexsoto added this to the xcode27 milestone Jul 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the repo’s macOS binding surface to include the SecurityInterface framework (Xcode 27.0 Beta 3), adds managed convenience wrappers around several SecurityInterface/Security types, wires the framework into the build/link infrastructure, and refreshes the xtro expectations + test suites accordingly.

Changes:

  • Register SecurityInterface as a macOS framework and enable HAS_SECURITYINTERFACE in .NET defines.
  • Add SecurityInterface bindings + managed wrappers (sheet completion Action<NSModalResponse> overloads, strongly-typed certificate/identity/policy APIs, keychain/keychain-settings helpers, and authorization callback helpers).
  • Update xtro todo/ignore + add monotouch tests and cecil known-failure entries required by the new surface.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/common/Frameworks.cs Registers SecurityInterface in the macOS frameworks list.
tests/xtro-sharpie/api-annotations-dotnet/macOS-SecurityInterface.todo Deletes resolved todo entries for SecurityInterface.
tests/xtro-sharpie/api-annotations-dotnet/macOS-SecurityInterface.ignore Adds ignores for informal-protocol selectors that xtro reports on NSObject.
tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.ignore Removes now-bound enums from Security ignore list.
tests/monotouch-test/SecurityInterface/SFFieldsAndEnumsTest.cs Adds validation tests for new fields/enums and Security enums used by the bindings.
tests/monotouch-test/SecurityInterface/SFChooseIdentityPanelTest.cs Adds basic construction/property tests for choose-identity UI types.
tests/monotouch-test/SecurityInterface/SFCertificateViewTest.cs Adds certificate view behavior and notification existence tests.
tests/monotouch-test/SecurityInterface/SFAuthorizationViewTest.cs Adds authorization view smoke tests + AuthorizationRights round-trip test.
tests/monotouch-test/SecurityInterface/SecurityInterfaceApiShapeTest.cs Verifies presence of strongly-typed APIs and one-shot sheet dispatcher semantics.
tests/monotouch-test/SecurityInterface/SecKeychainTest.cs Adds basic SecKeychain wrapper tests.
tests/monotouch-test/SecurityInterface/SecKeychainSettingsTest.cs Adds SecKeychainSettings layout + round-trip tests.
tests/monotouch-test/SecurityInterface/AuthorizationRightsTest.cs Adds AuthorizationRights/AuthorizationRight behavior + native layout tests.
tests/monotouch-test/SecurityInterface/AuthorizationManualBindingsTest.cs Adds callback-table interop tests for AuthorizationCallbacks/AuthorizationEngine.
tests/dotnet/UnitTests/ProjectTest.cs Updates expected framework list to include SecurityInterface.
tests/cecil-tests/HandleSafety.KnownFailures.cs Adds a known failure for new callback-based handle usage.
tests/cecil-tests/HandleSafety.cs Adds handle-safety exceptions for AuthorizationCallbacks’ non-owning handle wrapper.
tests/cecil-tests/Documentation.KnownFailures.txt Updates known-failure list for generated Dispose docs.
tests/cecil-tests/ApiTest.KnownFailures.cs Adds known failure entry for Preserve usage on SecKeychain ctor.
src/SecurityInterface/SFKeychainSettingsPanel.cs Adds managed overloads for modal/sheet flows and Action-based completion.
src/SecurityInterface/SFKeychainSavePanel.cs Adds strongly-typed Keychain property + Action-based sheet overload.
src/SecurityInterface/SFChooseIdentityPanel.cs Adds strongly-typed policies helpers + Action-based sheet overload.
src/SecurityInterface/SFCertificateView.cs Adds strongly typed Certificate/Policies helpers.
src/SecurityInterface/SFCertificatePanel.cs Adds policies helpers and Action-based sheet overloads for cert/trust panels.
src/SecurityInterface/SFAuthorizationView.cs Adds managed wrappers for authorization string + rights.
src/SecurityInterface/SFAuthorizationPluginView.cs Adds safe managed constructor and strongly typed properties.
src/SecurityInterface/SecurityInterfaceSheetDispatcher.cs Adds dispatcher glue for Action-based sheet completions.
src/SecurityInterface/Enums.cs Introduces strongly typed SecurityInterface enums.
src/securityinterface.cs Adds the SecurityInterface binding definitions (macOS only).
src/Security/SecKeychainSettings.cs Introduces blittable SecKeychainSettings struct wrapper (macOS only).
src/Security/SecKeychain.cs Adds SecKeychain NativeObject wrapper (macOS only).
src/Security/AuthorizationRights.cs Adds managed AuthorizationRights collection wrapper (macOS only).
src/Security/AuthorizationEnums.cs Moves/refreshes AuthorizationStatus/AuthorizationFlags enums into a dedicated file.
src/Security/AuthorizationEngine.cs Adds AuthorizationEngine wrapper (macOS only).
src/Security/AuthorizationCallbacks.cs Adds AuthorizationCallbacks wrapper + related enums (macOS only).
src/Security/Authorization.cs Removes duplicated AuthorizationStatus/AuthorizationFlags definitions now moved to AuthorizationEnums.cs.
src/rsp/dotnet/macos-defines-dotnet.rsp Adds HAS_SECURITYINTERFACE.
src/frameworks.sources Adds SecurityInterface source lists + framework registration for macOS.
src/build/dotnet/generator-frameworks.g.cs Adds SecurityInterface to generated framework availability infrastructure.

Comment thread src/Security/AuthorizationRights.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto
dalexsoto enabled auto-merge (squash) July 24, 2026 02:21
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

dalexsoto and others added 2 commits July 24, 2026 02:33
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e9e228af-33c5-4ac3-ac5e-f8839d48f8bc
The native init method returns nil, so callers must use the shared panel accessor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e9e228af-33c5-4ac3-ac5e-f8839d48f8bc
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Comment thread tools/dotnet-linker/Steps/InlineClassGetHandleStep.cs Outdated
Comment thread src/Security/AuthorizationRights.cs Outdated
Comment thread src/Security/AuthorizationRights.cs Outdated
Comment thread src/Security/SecKeychain.cs
Comment thread src/SecurityInterface/SecurityInterfaceSheetDispatcher.cs
Comment thread src/securityinterface.cs Outdated
Comment thread src/securityinterface.cs Outdated
Comment thread src/securityinterface.cs Outdated
Comment thread src/SecurityInterface/SFKeychainSettingsPanel.cs Outdated
Comment thread src/Security/AuthorizationCallbacks.cs Outdated
@dalexsoto dalexsoto changed the title [SecurityInterface] Update bindings up to Xcode 27.0 Beta 3 [SecurityInterface] Update bindings up to Xcode 27.0 Beta 4 Jul 27, 2026
Model authorization callbacks as pointer-backed disposable tables, support owned C# callback tables, and tie plugin-view callback copies to native object lifetime.

Convert property candidates and modal APIs to idiomatic bindings, remove obsolete macOS introduction metadata, optimize authorization-right copying, and mark SecKeychain obsolete.

Replace the table-cell linker hardcode with declarative native-symbol metadata and extend focused coverage for the updated API and ownership behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3afd7cac-e572-41ec-89e3-c727fd15b3c2
@dalexsoto

Copy link
Copy Markdown
Member Author

@rolfbjarne Addressed the review in f457523.

  • Converted all property candidates and modal APIs to properties/RunModal overloads, and removed macOS introduction attributes below the supported minimum.
  • Changed AuthorizationRight to an immutable class and eliminated the native-value double copy with ReadOnlySpan<byte>.
  • Redesigned AuthorizationCallbacks around an AuthorizationCallbacksNative*, removed INativeObject/Handle/CreationMode, added owned C# function-pointer tables with deterministic disposal, and tied plugin-view copies to native view lifetime using associated NSData ownership.
  • Added class-level SecKeychain obsoletion.
  • Replaced the SFChooseIdentityTableCellView linker hardcode with declarative ReferenceNativeSymbol Ignore metadata. The class has no exported Objective-C symbol, but NSClassFromString resolves and instantiates it; both trimmed and untrimmed managed tests pass.
  • Kept SetFlags as a method because the native header exposes no getter.
  • Restored DynamicDependency: removing it reproducibly trimmed DidEnd in a PublishTrimmed dynamic-registrar build. The full trimmed SecurityInterface suite now passes.

Final validation includes make world, clean xtro and cecil suites, untrimmed and trimmed SecurityInterface tests, macOS introspection, and the forced macOS CoreCLR app-size test.

@vs-mobiletools-engineering-service2

This comment has been minimized.

The new SFAuthorizationPluginView binding declares a P/Invoke for
objc_setAssociatedObject to tie the lifetime of the copied callbacks
buffer to the native object.

objc_setAssociatedObject is declared in <objc/runtime.h>, which is not a
framework umbrella header, so xtro-sharpie's DllImportCheck can never
match it and always reports it as !unknown-pinvoke!. Because the entry
point resolves through /usr/lib/libobjc.dylib, xtro attributes it to the
ObjCRuntime "framework", and since SecurityInterface is macOS-only the
entry only shows up for macOS.

This left one unclassified entry, which failed the xtro test:

    @MonkeyWrench: SetSummary: 1 unclassified found.

Classify it in macOS-ObjCRuntime.ignore, next to the other libobjc and
non-framework P/Invokes we already ignore.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ebf4376b-3b4c-4492-acef-18607e6f4ea1
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 39fa0abc6ea70a7ab8e900f9a958bfef776e05f7 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #39fa0ab] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 200 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ framework: All 2 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ generator: All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ windows: All 3 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Golden Gate (27): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 39fa0abc6ea70a7ab8e900f9a958bfef776e05f7 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants