Skip to content

Remove deprecated keychain no-UI symbol#526

Open
iam-brain wants to merge 1 commit intosteipete:mainfrom
iam-brain:iam-brain/fix/keychain-no-ui-deprecation
Open

Remove deprecated keychain no-UI symbol#526
iam-brain wants to merge 1 commit intosteipete:mainfrom
iam-brain:iam-brain/fix/keychain-no-ui-deprecation

Conversation

@iam-brain
Copy link
Contributor

@iam-brain iam-brain commented Mar 13, 2026

Summary

  • remove the direct reference to the deprecated kSecUseAuthenticationUIFail symbol so production builds stop emitting the macOS deprecation warning
  • preserve the existing no-prompt behavior for legacy keychain items instead of changing the runtime query semantics
  • add a focused regression test and update the related keychain comments/docs to explain the compatibility tradeoff

Why This Change Is Structured This Way

The old helper explicitly documented a real behavior constraint:

While Apple recommends LAContext.interactionNotAllowed, that alone was not sufficient to prevent the legacy keychain prompt on some configurations, so the query also set the UI policy to fail and return errSecInteractionNotAllowed.

That matters because a naive cleanup would have been risky. Simply deleting the legacy UI-fail policy would remove the deprecation warning, but it could also reintroduce interactive keychain prompts for older generic-password items.

During review, that exact concern was raised and re-checked against the SDK behavior: Apple recommends the LAContext path, but legacy keychain items may still behave differently on macOS. Because these queries touch external keychain items such as Claude CLI credentials, preserving the existing no-UI behavior is more important than purely modernizing the code shape.

So this PR takes a compatibility-preserving approach:

  • keep kSecUseAuthenticationContext with LAContext.interactionNotAllowed = true
  • keep the legacy fail-without-prompt query policy so older keychain items still reject interaction instead of showing UI
  • stop referencing the deprecated typed symbol directly by using the underlying compatibility value instead

In other words: this is intended to be a warning cleanup without a behavior change.

What Changed

Verification

Automated verification run on the final diff:

  • swift test --filter KeychainNoUIQueryTests
  • swift build -c release
  • swift test
  • pnpm check
  • ./Scripts/compile_and_run.sh

Results:

  • the release build no longer reports the kSecUseAuthenticationUIFail deprecation warning
  • the focused helper regression test passes
  • the full test suite passes
  • lint/format checks pass
  • the app rebuild/relaunch script succeeds

What We Can And Cannot Prove

What this PR proves well:

  • we removed the deprecated symbol reference from the build
  • we preserved the helper query shape needed for the app's no-UI keychain path
  • the app still handles the non-interactive keychain flow correctly in tests

What this PR cannot fully prove in automation:

  • macOS prompt behavior for every real legacy keychain item and ACL state

That part is inherently environment-dependent. The strongest runtime check is a manual smoke test against a real promptable legacy keychain item on a machine where CodexBar is not already trusted. The expected outcome is still: no prompt during preflight, and errSecInteractionNotAllowed/.interactionRequired instead.

Risk / Tradeoff

This keeps a compatibility shim ("u_AuthUIF") rather than a typed constant. That is less ideal than a fully modern API-only path, but it is the safer choice here because it preserves the behavior the old code was intentionally relying on while still removing the compile-time deprecation warning.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant